diff --git a/sdk/containerservice/azure-mgmt-containerservice/_meta.json b/sdk/containerservice/azure-mgmt-containerservice/_meta.json index a9da08a41ba0..a76bebe53be1 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/_meta.json +++ b/sdk/containerservice/azure-mgmt-containerservice/_meta.json @@ -1,11 +1,11 @@ { "autorest": "3.7.2", "use": [ - "@autorest/python@5.13.0", + "@autorest/python@5.16.0", "@autorest/modelerfour@4.19.3" ], - "commit": "2d6cb29af754f48a08f94cb6113bb1f01a4e0eb9", + "commit": "c04659509b528a9eab1f78e5728691d562e83c25", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest_command": "autorest specification/containerservice/resource-manager/readme.md --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --python3-only --use=@autorest/python@5.13.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", + "autorest_command": "autorest specification/containerservice/resource-manager/readme.md --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --python3-only --use=@autorest/python@5.16.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", "readme": "specification/containerservice/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/_container_service_client.py index ec3e1171b458..9d9028e0f7d9 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/_container_service_client.py @@ -130,6 +130,7 @@ def models(cls, api_version=DEFAULT_API_VERSION): * 2022-04-01: :mod:`v2022_04_01.models` * 2022-04-02-preview: :mod:`v2022_04_02_preview.models` * 2022-05-02-preview: :mod:`v2022_05_02_preview.models` + * 2022-06-02-preview: :mod:`v2022_06_02_preview.models` """ if api_version == '2017-07-01': from .v2017_07_01 import models @@ -248,6 +249,9 @@ def models(cls, api_version=DEFAULT_API_VERSION): elif api_version == '2022-05-02-preview': from .v2022_05_02_preview import models return models + elif api_version == '2022-06-02-preview': + from .v2022_06_02_preview import models + return models raise ValueError("API version {} is not available".format(api_version)) @property @@ -286,6 +290,7 @@ def agent_pools(self): * 2022-04-01: :class:`AgentPoolsOperations` * 2022-04-02-preview: :class:`AgentPoolsOperations` * 2022-05-02-preview: :class:`AgentPoolsOperations` + * 2022-06-02-preview: :class:`AgentPoolsOperations` """ api_version = self._get_api_version('agent_pools') if api_version == '2019-02-01': @@ -352,6 +357,8 @@ def agent_pools(self): from .v2022_04_02_preview.operations import AgentPoolsOperations as OperationClass elif api_version == '2022-05-02-preview': from .v2022_05_02_preview.operations import AgentPoolsOperations as OperationClass + elif api_version == '2022-06-02-preview': + from .v2022_06_02_preview.operations import AgentPoolsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'agent_pools'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -369,6 +376,32 @@ def container_services(self): raise ValueError("API version {} does not have operation group 'container_services'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property + def fleet_members(self): + """Instance depends on the API version: + + * 2022-06-02-preview: :class:`FleetMembersOperations` + """ + api_version = self._get_api_version('fleet_members') + if api_version == '2022-06-02-preview': + from .v2022_06_02_preview.operations import FleetMembersOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'fleet_members'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def fleets(self): + """Instance depends on the API version: + + * 2022-06-02-preview: :class:`FleetsOperations` + """ + api_version = self._get_api_version('fleets') + if api_version == '2022-06-02-preview': + from .v2022_06_02_preview.operations import FleetsOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'fleets'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property def maintenance_configurations(self): """Instance depends on the API version: @@ -391,6 +424,7 @@ def maintenance_configurations(self): * 2022-04-01: :class:`MaintenanceConfigurationsOperations` * 2022-04-02-preview: :class:`MaintenanceConfigurationsOperations` * 2022-05-02-preview: :class:`MaintenanceConfigurationsOperations` + * 2022-06-02-preview: :class:`MaintenanceConfigurationsOperations` """ api_version = self._get_api_version('maintenance_configurations') if api_version == '2020-12-01': @@ -429,6 +463,8 @@ def maintenance_configurations(self): from .v2022_04_02_preview.operations import MaintenanceConfigurationsOperations as OperationClass elif api_version == '2022-05-02-preview': from .v2022_05_02_preview.operations import MaintenanceConfigurationsOperations as OperationClass + elif api_version == '2022-06-02-preview': + from .v2022_06_02_preview.operations import MaintenanceConfigurationsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'maintenance_configurations'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -441,6 +477,7 @@ def managed_cluster_snapshots(self): * 2022-03-02-preview: :class:`ManagedClusterSnapshotsOperations` * 2022-04-02-preview: :class:`ManagedClusterSnapshotsOperations` * 2022-05-02-preview: :class:`ManagedClusterSnapshotsOperations` + * 2022-06-02-preview: :class:`ManagedClusterSnapshotsOperations` """ api_version = self._get_api_version('managed_cluster_snapshots') if api_version == '2022-02-02-preview': @@ -451,6 +488,8 @@ def managed_cluster_snapshots(self): from .v2022_04_02_preview.operations import ManagedClusterSnapshotsOperations as OperationClass elif api_version == '2022-05-02-preview': from .v2022_05_02_preview.operations import ManagedClusterSnapshotsOperations as OperationClass + elif api_version == '2022-06-02-preview': + from .v2022_06_02_preview.operations import ManagedClusterSnapshotsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'managed_cluster_snapshots'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -493,6 +532,7 @@ def managed_clusters(self): * 2022-04-01: :class:`ManagedClustersOperations` * 2022-04-02-preview: :class:`ManagedClustersOperations` * 2022-05-02-preview: :class:`ManagedClustersOperations` + * 2022-06-02-preview: :class:`ManagedClustersOperations` """ api_version = self._get_api_version('managed_clusters') if api_version == '2018-03-31': @@ -563,6 +603,8 @@ def managed_clusters(self): from .v2022_04_02_preview.operations import ManagedClustersOperations as OperationClass elif api_version == '2022-05-02-preview': from .v2022_05_02_preview.operations import ManagedClustersOperations as OperationClass + elif api_version == '2022-06-02-preview': + from .v2022_06_02_preview.operations import ManagedClustersOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'managed_clusters'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -627,6 +669,7 @@ def operations(self): * 2022-04-01: :class:`Operations` * 2022-04-02-preview: :class:`Operations` * 2022-05-02-preview: :class:`Operations` + * 2022-06-02-preview: :class:`Operations` """ api_version = self._get_api_version('operations') if api_version == '2018-03-31': @@ -697,6 +740,8 @@ def operations(self): from .v2022_04_02_preview.operations import Operations as OperationClass elif api_version == '2022-05-02-preview': from .v2022_05_02_preview.operations import Operations as OperationClass + elif api_version == '2022-06-02-preview': + from .v2022_06_02_preview.operations import Operations as OperationClass else: raise ValueError("API version {} does not have operation group 'operations'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -727,6 +772,7 @@ def private_endpoint_connections(self): * 2022-04-01: :class:`PrivateEndpointConnectionsOperations` * 2022-04-02-preview: :class:`PrivateEndpointConnectionsOperations` * 2022-05-02-preview: :class:`PrivateEndpointConnectionsOperations` + * 2022-06-02-preview: :class:`PrivateEndpointConnectionsOperations` """ api_version = self._get_api_version('private_endpoint_connections') if api_version == '2020-06-01': @@ -773,6 +819,8 @@ def private_endpoint_connections(self): from .v2022_04_02_preview.operations import PrivateEndpointConnectionsOperations as OperationClass elif api_version == '2022-05-02-preview': from .v2022_05_02_preview.operations import PrivateEndpointConnectionsOperations as OperationClass + elif api_version == '2022-06-02-preview': + from .v2022_06_02_preview.operations import PrivateEndpointConnectionsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'private_endpoint_connections'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -801,6 +849,7 @@ def private_link_resources(self): * 2022-04-01: :class:`PrivateLinkResourcesOperations` * 2022-04-02-preview: :class:`PrivateLinkResourcesOperations` * 2022-05-02-preview: :class:`PrivateLinkResourcesOperations` + * 2022-06-02-preview: :class:`PrivateLinkResourcesOperations` """ api_version = self._get_api_version('private_link_resources') if api_version == '2020-09-01': @@ -843,6 +892,8 @@ def private_link_resources(self): from .v2022_04_02_preview.operations import PrivateLinkResourcesOperations as OperationClass elif api_version == '2022-05-02-preview': from .v2022_05_02_preview.operations import PrivateLinkResourcesOperations as OperationClass + elif api_version == '2022-06-02-preview': + from .v2022_06_02_preview.operations import PrivateLinkResourcesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'private_link_resources'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -871,6 +922,7 @@ def resolve_private_link_service_id(self): * 2022-04-01: :class:`ResolvePrivateLinkServiceIdOperations` * 2022-04-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` * 2022-05-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` + * 2022-06-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` """ api_version = self._get_api_version('resolve_private_link_service_id') if api_version == '2020-09-01': @@ -913,6 +965,8 @@ def resolve_private_link_service_id(self): from .v2022_04_02_preview.operations import ResolvePrivateLinkServiceIdOperations as OperationClass elif api_version == '2022-05-02-preview': from .v2022_05_02_preview.operations import ResolvePrivateLinkServiceIdOperations as OperationClass + elif api_version == '2022-06-02-preview': + from .v2022_06_02_preview.operations import ResolvePrivateLinkServiceIdOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'resolve_private_link_service_id'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -934,6 +988,7 @@ def snapshots(self): * 2022-04-01: :class:`SnapshotsOperations` * 2022-04-02-preview: :class:`SnapshotsOperations` * 2022-05-02-preview: :class:`SnapshotsOperations` + * 2022-06-02-preview: :class:`SnapshotsOperations` """ api_version = self._get_api_version('snapshots') if api_version == '2021-08-01': @@ -962,6 +1017,8 @@ def snapshots(self): from .v2022_04_02_preview.operations import SnapshotsOperations as OperationClass elif api_version == '2022-05-02-preview': from .v2022_05_02_preview.operations import SnapshotsOperations as OperationClass + elif api_version == '2022-06-02-preview': + from .v2022_06_02_preview.operations import SnapshotsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'snapshots'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -972,12 +1029,15 @@ def trusted_access_role_bindings(self): * 2022-04-02-preview: :class:`TrustedAccessRoleBindingsOperations` * 2022-05-02-preview: :class:`TrustedAccessRoleBindingsOperations` + * 2022-06-02-preview: :class:`TrustedAccessRoleBindingsOperations` """ api_version = self._get_api_version('trusted_access_role_bindings') if api_version == '2022-04-02-preview': from .v2022_04_02_preview.operations import TrustedAccessRoleBindingsOperations as OperationClass elif api_version == '2022-05-02-preview': from .v2022_05_02_preview.operations import TrustedAccessRoleBindingsOperations as OperationClass + elif api_version == '2022-06-02-preview': + from .v2022_06_02_preview.operations import TrustedAccessRoleBindingsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'trusted_access_role_bindings'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -988,12 +1048,15 @@ def trusted_access_roles(self): * 2022-04-02-preview: :class:`TrustedAccessRolesOperations` * 2022-05-02-preview: :class:`TrustedAccessRolesOperations` + * 2022-06-02-preview: :class:`TrustedAccessRolesOperations` """ api_version = self._get_api_version('trusted_access_roles') if api_version == '2022-04-02-preview': from .v2022_04_02_preview.operations import TrustedAccessRolesOperations as OperationClass elif api_version == '2022-05-02-preview': from .v2022_05_02_preview.operations import TrustedAccessRolesOperations as OperationClass + elif api_version == '2022-06-02-preview': + from .v2022_06_02_preview.operations import TrustedAccessRolesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'trusted_access_roles'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/aio/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/aio/_container_service_client.py index 8cd76c6271e9..c8d276283f65 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/aio/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/aio/_container_service_client.py @@ -129,6 +129,7 @@ def models(cls, api_version=DEFAULT_API_VERSION): * 2022-04-01: :mod:`v2022_04_01.models` * 2022-04-02-preview: :mod:`v2022_04_02_preview.models` * 2022-05-02-preview: :mod:`v2022_05_02_preview.models` + * 2022-06-02-preview: :mod:`v2022_06_02_preview.models` """ if api_version == '2017-07-01': from ..v2017_07_01 import models @@ -247,6 +248,9 @@ def models(cls, api_version=DEFAULT_API_VERSION): elif api_version == '2022-05-02-preview': from ..v2022_05_02_preview import models return models + elif api_version == '2022-06-02-preview': + from ..v2022_06_02_preview import models + return models raise ValueError("API version {} is not available".format(api_version)) @property @@ -285,6 +289,7 @@ def agent_pools(self): * 2022-04-01: :class:`AgentPoolsOperations` * 2022-04-02-preview: :class:`AgentPoolsOperations` * 2022-05-02-preview: :class:`AgentPoolsOperations` + * 2022-06-02-preview: :class:`AgentPoolsOperations` """ api_version = self._get_api_version('agent_pools') if api_version == '2019-02-01': @@ -351,6 +356,8 @@ def agent_pools(self): from ..v2022_04_02_preview.aio.operations import AgentPoolsOperations as OperationClass elif api_version == '2022-05-02-preview': from ..v2022_05_02_preview.aio.operations import AgentPoolsOperations as OperationClass + elif api_version == '2022-06-02-preview': + from ..v2022_06_02_preview.aio.operations import AgentPoolsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'agent_pools'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -368,6 +375,32 @@ def container_services(self): raise ValueError("API version {} does not have operation group 'container_services'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property + def fleet_members(self): + """Instance depends on the API version: + + * 2022-06-02-preview: :class:`FleetMembersOperations` + """ + api_version = self._get_api_version('fleet_members') + if api_version == '2022-06-02-preview': + from ..v2022_06_02_preview.aio.operations import FleetMembersOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'fleet_members'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def fleets(self): + """Instance depends on the API version: + + * 2022-06-02-preview: :class:`FleetsOperations` + """ + api_version = self._get_api_version('fleets') + if api_version == '2022-06-02-preview': + from ..v2022_06_02_preview.aio.operations import FleetsOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'fleets'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property def maintenance_configurations(self): """Instance depends on the API version: @@ -390,6 +423,7 @@ def maintenance_configurations(self): * 2022-04-01: :class:`MaintenanceConfigurationsOperations` * 2022-04-02-preview: :class:`MaintenanceConfigurationsOperations` * 2022-05-02-preview: :class:`MaintenanceConfigurationsOperations` + * 2022-06-02-preview: :class:`MaintenanceConfigurationsOperations` """ api_version = self._get_api_version('maintenance_configurations') if api_version == '2020-12-01': @@ -428,6 +462,8 @@ def maintenance_configurations(self): from ..v2022_04_02_preview.aio.operations import MaintenanceConfigurationsOperations as OperationClass elif api_version == '2022-05-02-preview': from ..v2022_05_02_preview.aio.operations import MaintenanceConfigurationsOperations as OperationClass + elif api_version == '2022-06-02-preview': + from ..v2022_06_02_preview.aio.operations import MaintenanceConfigurationsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'maintenance_configurations'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -440,6 +476,7 @@ def managed_cluster_snapshots(self): * 2022-03-02-preview: :class:`ManagedClusterSnapshotsOperations` * 2022-04-02-preview: :class:`ManagedClusterSnapshotsOperations` * 2022-05-02-preview: :class:`ManagedClusterSnapshotsOperations` + * 2022-06-02-preview: :class:`ManagedClusterSnapshotsOperations` """ api_version = self._get_api_version('managed_cluster_snapshots') if api_version == '2022-02-02-preview': @@ -450,6 +487,8 @@ def managed_cluster_snapshots(self): from ..v2022_04_02_preview.aio.operations import ManagedClusterSnapshotsOperations as OperationClass elif api_version == '2022-05-02-preview': from ..v2022_05_02_preview.aio.operations import ManagedClusterSnapshotsOperations as OperationClass + elif api_version == '2022-06-02-preview': + from ..v2022_06_02_preview.aio.operations import ManagedClusterSnapshotsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'managed_cluster_snapshots'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -492,6 +531,7 @@ def managed_clusters(self): * 2022-04-01: :class:`ManagedClustersOperations` * 2022-04-02-preview: :class:`ManagedClustersOperations` * 2022-05-02-preview: :class:`ManagedClustersOperations` + * 2022-06-02-preview: :class:`ManagedClustersOperations` """ api_version = self._get_api_version('managed_clusters') if api_version == '2018-03-31': @@ -562,6 +602,8 @@ def managed_clusters(self): from ..v2022_04_02_preview.aio.operations import ManagedClustersOperations as OperationClass elif api_version == '2022-05-02-preview': from ..v2022_05_02_preview.aio.operations import ManagedClustersOperations as OperationClass + elif api_version == '2022-06-02-preview': + from ..v2022_06_02_preview.aio.operations import ManagedClustersOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'managed_clusters'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -626,6 +668,7 @@ def operations(self): * 2022-04-01: :class:`Operations` * 2022-04-02-preview: :class:`Operations` * 2022-05-02-preview: :class:`Operations` + * 2022-06-02-preview: :class:`Operations` """ api_version = self._get_api_version('operations') if api_version == '2018-03-31': @@ -696,6 +739,8 @@ def operations(self): from ..v2022_04_02_preview.aio.operations import Operations as OperationClass elif api_version == '2022-05-02-preview': from ..v2022_05_02_preview.aio.operations import Operations as OperationClass + elif api_version == '2022-06-02-preview': + from ..v2022_06_02_preview.aio.operations import Operations as OperationClass else: raise ValueError("API version {} does not have operation group 'operations'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -726,6 +771,7 @@ def private_endpoint_connections(self): * 2022-04-01: :class:`PrivateEndpointConnectionsOperations` * 2022-04-02-preview: :class:`PrivateEndpointConnectionsOperations` * 2022-05-02-preview: :class:`PrivateEndpointConnectionsOperations` + * 2022-06-02-preview: :class:`PrivateEndpointConnectionsOperations` """ api_version = self._get_api_version('private_endpoint_connections') if api_version == '2020-06-01': @@ -772,6 +818,8 @@ def private_endpoint_connections(self): from ..v2022_04_02_preview.aio.operations import PrivateEndpointConnectionsOperations as OperationClass elif api_version == '2022-05-02-preview': from ..v2022_05_02_preview.aio.operations import PrivateEndpointConnectionsOperations as OperationClass + elif api_version == '2022-06-02-preview': + from ..v2022_06_02_preview.aio.operations import PrivateEndpointConnectionsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'private_endpoint_connections'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -800,6 +848,7 @@ def private_link_resources(self): * 2022-04-01: :class:`PrivateLinkResourcesOperations` * 2022-04-02-preview: :class:`PrivateLinkResourcesOperations` * 2022-05-02-preview: :class:`PrivateLinkResourcesOperations` + * 2022-06-02-preview: :class:`PrivateLinkResourcesOperations` """ api_version = self._get_api_version('private_link_resources') if api_version == '2020-09-01': @@ -842,6 +891,8 @@ def private_link_resources(self): from ..v2022_04_02_preview.aio.operations import PrivateLinkResourcesOperations as OperationClass elif api_version == '2022-05-02-preview': from ..v2022_05_02_preview.aio.operations import PrivateLinkResourcesOperations as OperationClass + elif api_version == '2022-06-02-preview': + from ..v2022_06_02_preview.aio.operations import PrivateLinkResourcesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'private_link_resources'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -870,6 +921,7 @@ def resolve_private_link_service_id(self): * 2022-04-01: :class:`ResolvePrivateLinkServiceIdOperations` * 2022-04-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` * 2022-05-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` + * 2022-06-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` """ api_version = self._get_api_version('resolve_private_link_service_id') if api_version == '2020-09-01': @@ -912,6 +964,8 @@ def resolve_private_link_service_id(self): from ..v2022_04_02_preview.aio.operations import ResolvePrivateLinkServiceIdOperations as OperationClass elif api_version == '2022-05-02-preview': from ..v2022_05_02_preview.aio.operations import ResolvePrivateLinkServiceIdOperations as OperationClass + elif api_version == '2022-06-02-preview': + from ..v2022_06_02_preview.aio.operations import ResolvePrivateLinkServiceIdOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'resolve_private_link_service_id'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -933,6 +987,7 @@ def snapshots(self): * 2022-04-01: :class:`SnapshotsOperations` * 2022-04-02-preview: :class:`SnapshotsOperations` * 2022-05-02-preview: :class:`SnapshotsOperations` + * 2022-06-02-preview: :class:`SnapshotsOperations` """ api_version = self._get_api_version('snapshots') if api_version == '2021-08-01': @@ -961,6 +1016,8 @@ def snapshots(self): from ..v2022_04_02_preview.aio.operations import SnapshotsOperations as OperationClass elif api_version == '2022-05-02-preview': from ..v2022_05_02_preview.aio.operations import SnapshotsOperations as OperationClass + elif api_version == '2022-06-02-preview': + from ..v2022_06_02_preview.aio.operations import SnapshotsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'snapshots'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -971,12 +1028,15 @@ def trusted_access_role_bindings(self): * 2022-04-02-preview: :class:`TrustedAccessRoleBindingsOperations` * 2022-05-02-preview: :class:`TrustedAccessRoleBindingsOperations` + * 2022-06-02-preview: :class:`TrustedAccessRoleBindingsOperations` """ api_version = self._get_api_version('trusted_access_role_bindings') if api_version == '2022-04-02-preview': from ..v2022_04_02_preview.aio.operations import TrustedAccessRoleBindingsOperations as OperationClass elif api_version == '2022-05-02-preview': from ..v2022_05_02_preview.aio.operations import TrustedAccessRoleBindingsOperations as OperationClass + elif api_version == '2022-06-02-preview': + from ..v2022_06_02_preview.aio.operations import TrustedAccessRoleBindingsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'trusted_access_role_bindings'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -987,12 +1047,15 @@ def trusted_access_roles(self): * 2022-04-02-preview: :class:`TrustedAccessRolesOperations` * 2022-05-02-preview: :class:`TrustedAccessRolesOperations` + * 2022-06-02-preview: :class:`TrustedAccessRolesOperations` """ api_version = self._get_api_version('trusted_access_roles') if api_version == '2022-04-02-preview': from ..v2022_04_02_preview.aio.operations import TrustedAccessRolesOperations as OperationClass elif api_version == '2022-05-02-preview': from ..v2022_05_02_preview.aio.operations import TrustedAccessRolesOperations as OperationClass + elif api_version == '2022-06-02-preview': + from ..v2022_06_02_preview.aio.operations import TrustedAccessRolesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'trusted_access_roles'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/__init__.py index 53c675bd95e2..37a5f9e02e6f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._container_service_client import ContainerServiceClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['ContainerServiceClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/_container_service_client.py index 8f070e8d6b63..7946cd0a6009 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/_container_service_client.py @@ -53,7 +53,9 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.container_services = ContainerServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.container_services = ContainerServicesOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/aio/__init__.py index 53c675bd95e2..37a5f9e02e6f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/aio/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/aio/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._container_service_client import ContainerServiceClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['ContainerServiceClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/aio/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/aio/_container_service_client.py index c3f5db634a79..4dd58f78ab86 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/aio/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/aio/_container_service_client.py @@ -53,7 +53,9 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.container_services = ContainerServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.container_services = ContainerServicesOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/aio/operations/__init__.py index db0e90a3a5aa..a96e407a7be1 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/aio/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/aio/operations/__init__.py @@ -8,6 +8,11 @@ from ._container_services_operations import ContainerServicesOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'ContainerServicesOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/aio/operations/_container_services_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/aio/operations/_container_services_operations.py index 89dc21af553b..7d2aae2df1ac 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/aio/operations/_container_services_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/aio/operations/_container_services_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. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ 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 @@ -26,32 +27,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ContainerServicesOperations: - """ContainerServicesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2017_07_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2017_07_01.aio.ContainerServiceClient`'s + :attr:`container_services` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.ContainerServiceListResult"]: + ) -> AsyncIterable[_models.ContainerServiceListResult]: """Gets a list of container services in the specified subscription. Gets a list of container services in the specified subscription. The operation returns @@ -68,13 +67,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2017_07_01.models.ContainerServiceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2017-07-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ContainerServiceListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ContainerServiceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -82,9 +84,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -92,9 +96,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -131,17 +137,20 @@ async def _create_or_update_initial( self, resource_group_name: str, container_service_name: str, - parameters: "_models.ContainerService", + parameters: _models.ContainerService, **kwargs: Any - ) -> "_models.ContainerService": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ContainerService"] + ) -> _models.ContainerService: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2017-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ContainerService] _json = self._serialize.body(parameters, 'ContainerService') @@ -153,11 +162,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -190,9 +201,9 @@ async def begin_create_or_update( self, resource_group_name: str, container_service_name: str, - parameters: "_models.ContainerService", + parameters: _models.ContainerService, **kwargs: Any - ) -> AsyncLROPoller["_models.ContainerService"]: + ) -> AsyncLROPoller[_models.ContainerService]: """Creates or updates a container service. Creates or updates a container service with the specified configuration of orchestrator, @@ -222,37 +233,47 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2017_07_01.models.ContainerService] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2017-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ContainerService] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ContainerService"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, container_service_name=container_service_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ContainerService', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -271,7 +292,7 @@ async def get( resource_group_name: str, container_service_name: str, **kwargs: Any - ) -> "_models.ContainerService": + ) -> _models.ContainerService: """Gets the properties of the specified container service. Gets the properties of the specified container service in the specified subscription and @@ -291,13 +312,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2017_07_01.models.ContainerService :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ContainerService"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2017-07-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ContainerService] request = build_get_request( @@ -306,11 +330,13 @@ async def get( 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -337,13 +363,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements container_service_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2017-07-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -352,11 +381,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements subscription_id=self._config.subscription_id, api_version=api_version, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -407,20 +438,25 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2017-07-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-07-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, container_service_name=container_service_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -430,8 +466,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -449,7 +491,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ContainerServiceListResult"]: + ) -> AsyncIterable[_models.ContainerServiceListResult]: """Gets a list of container services in the specified resource group. Gets a list of container services in the specified subscription and resource group. The @@ -468,13 +510,16 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2017_07_01.models.ContainerServiceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2017-07-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ContainerServiceListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ContainerServiceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -483,9 +528,11 @@ def prepare_request(next_link=None): 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -494,9 +541,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -535,7 +584,7 @@ async def list_orchestrators( location: str, resource_type: Optional[str] = None, **kwargs: Any - ) -> "_models.OrchestratorVersionProfileListResult": + ) -> _models.OrchestratorVersionProfileListResult: """Gets a list of supported orchestrators in the specified subscription. Gets a list of supported orchestrators in the specified subscription. The operation returns @@ -555,13 +604,16 @@ async def list_orchestrators( :rtype: ~azure.mgmt.containerservice.v2017_07_01.models.OrchestratorVersionProfileListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OrchestratorVersionProfileListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-04-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OrchestratorVersionProfileListResult] request = build_list_orchestrators_request( @@ -570,11 +622,13 @@ async def list_orchestrators( api_version=api_version, resource_type=resource_type, template_url=self.list_orchestrators.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/aio/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/aio/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/models/__init__.py index 51f3979cb9a3..22ff2933917b 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/models/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/models/__init__.py @@ -33,7 +33,9 @@ Count, OSType, ) - +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'ContainerService', 'ContainerServiceAgentPoolProfile', @@ -59,3 +61,5 @@ 'Count', 'OSType', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/models/_container_service_client_enums.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/models/_container_service_client_enums.py index 5d7f0f6cd4c4..0dc545173c26 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/models/_container_service_client_enums.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/models/_container_service_client_enums.py @@ -7,11 +7,10 @@ # -------------------------------------------------------------------------- from enum import Enum -from six import with_metaclass from azure.core import CaseInsensitiveEnumMeta -class ContainerServiceOrchestratorTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ContainerServiceOrchestratorTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The orchestrator to use to manage container service cluster resources. Valid values are Kubernetes, Swarm, DCOS, DockerCE and Custom. """ @@ -22,7 +21,7 @@ class ContainerServiceOrchestratorTypes(with_metaclass(CaseInsensitiveEnumMeta, DOCKER_CE = "DockerCE" CUSTOM = "Custom" -class ContainerServiceStorageProfileTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the orchestrator choice. """ @@ -30,7 +29,7 @@ class ContainerServiceStorageProfileTypes(with_metaclass(CaseInsensitiveEnumMeta STORAGE_ACCOUNT = "StorageAccount" MANAGED_DISKS = "ManagedDisks" -class ContainerServiceVMSizeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Size of agent VMs. """ @@ -209,7 +208,7 @@ class ContainerServiceVMSizeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, E STANDARD_NV24 = "Standard_NV24" STANDARD_NV6 = "Standard_NV6" -class Count(with_metaclass(CaseInsensitiveEnumMeta, int, Enum)): +class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): """Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, and 5. The default value is 1. """ @@ -218,7 +217,7 @@ class Count(with_metaclass(CaseInsensitiveEnumMeta, int, Enum)): THREE = 3 FIVE = 5 -class OSType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux. """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/models/_models_py3.py index 59476c21795f..657fa541206d 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/models/_models_py3.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/models/_models_py3.py @@ -6,11 +6,13 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Dict, List, Optional, Union +from typing import Dict, List, Optional, TYPE_CHECKING, Union import msrest.serialization -from ._container_service_client_enums import * +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + import __init__ as _models class Resource(msrest.serialization.Model): @@ -146,14 +148,14 @@ def __init__( *, location: str, tags: Optional[Dict[str, str]] = None, - orchestrator_profile: Optional["ContainerServiceOrchestratorProfile"] = None, - custom_profile: Optional["ContainerServiceCustomProfile"] = None, - service_principal_profile: Optional["ContainerServicePrincipalProfile"] = None, - master_profile: Optional["ContainerServiceMasterProfile"] = None, - agent_pool_profiles: Optional[List["ContainerServiceAgentPoolProfile"]] = None, - windows_profile: Optional["ContainerServiceWindowsProfile"] = None, - linux_profile: Optional["ContainerServiceLinuxProfile"] = None, - diagnostics_profile: Optional["ContainerServiceDiagnosticsProfile"] = None, + orchestrator_profile: Optional["_models.ContainerServiceOrchestratorProfile"] = None, + custom_profile: Optional["_models.ContainerServiceCustomProfile"] = None, + service_principal_profile: Optional["_models.ContainerServicePrincipalProfile"] = None, + master_profile: Optional["_models.ContainerServiceMasterProfile"] = None, + agent_pool_profiles: Optional[List["_models.ContainerServiceAgentPoolProfile"]] = None, + windows_profile: Optional["_models.ContainerServiceWindowsProfile"] = None, + linux_profile: Optional["_models.ContainerServiceLinuxProfile"] = None, + diagnostics_profile: Optional["_models.ContainerServiceDiagnosticsProfile"] = None, **kwargs ): """ @@ -213,13 +215,13 @@ class ContainerServiceAgentPoolProfile(msrest.serialization.Model): :ivar count: Number of agents (VMs) 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: Required. Size of agent VMs. Possible values include: "Standard_A1", - "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", - "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", - "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", - "Standard_A8m_v2", "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", - "Standard_B8ms", "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", - "Standard_D12", "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", + :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", + "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", + "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", + "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", "Standard_B8ms", + "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", "Standard_D12", + "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", "Standard_D13_v2_Promo", "Standard_D14", "Standard_D14_v2", "Standard_D14_v2_Promo", "Standard_D15_v2", "Standard_D16_v3", "Standard_D16s_v3", "Standard_D1_v2", "Standard_D2", "Standard_D2_v2", "Standard_D2_v2_Promo", "Standard_D2_v3", "Standard_D2s_v3", "Standard_D3", @@ -266,13 +268,13 @@ class ContainerServiceAgentPoolProfile(msrest.serialization.Model): :vartype ports: list[int] :ivar storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Possible values include: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". :vartype storage_profile: str or ~azure.mgmt.containerservice.v2017_07_01.models.ContainerServiceStorageProfileTypes :ivar vnet_subnet_id: VNet SubnetID specifies the VNet's subnet identifier. :vartype vnet_subnet_id: str :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2017_07_01.models.OSType """ @@ -301,14 +303,14 @@ def __init__( self, *, name: str, - vm_size: Union[str, "ContainerServiceVMSizeTypes"], + vm_size: Union[str, "_models.ContainerServiceVMSizeTypes"], count: Optional[int] = 1, os_disk_size_gb: Optional[int] = None, dns_prefix: Optional[str] = None, ports: Optional[List[int]] = None, - storage_profile: Optional[Union[str, "ContainerServiceStorageProfileTypes"]] = None, + storage_profile: Optional[Union[str, "_models.ContainerServiceStorageProfileTypes"]] = None, vnet_subnet_id: Optional[str] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", **kwargs ): """ @@ -318,13 +320,13 @@ def __init__( :keyword count: Number of agents (VMs) 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: Required. Size of agent VMs. Possible values include: "Standard_A1", - "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", - "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", - "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", - "Standard_A8m_v2", "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", - "Standard_B8ms", "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", - "Standard_D12", "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", + :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", + "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", + "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", + "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", "Standard_B8ms", + "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", "Standard_D12", + "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", "Standard_D13_v2_Promo", "Standard_D14", "Standard_D14_v2", "Standard_D14_v2_Promo", "Standard_D15_v2", "Standard_D16_v3", "Standard_D16s_v3", "Standard_D1_v2", "Standard_D2", "Standard_D2_v2", "Standard_D2_v2_Promo", "Standard_D2_v3", "Standard_D2s_v3", "Standard_D3", @@ -369,13 +371,13 @@ def __init__( :paramtype ports: list[int] :keyword storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Possible values include: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". :paramtype storage_profile: str or ~azure.mgmt.containerservice.v2017_07_01.models.ContainerServiceStorageProfileTypes :keyword vnet_subnet_id: VNet SubnetID specifies the VNet's subnet identifier. :paramtype vnet_subnet_id: str :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2017_07_01.models.OSType """ super(ContainerServiceAgentPoolProfile, self).__init__(**kwargs) @@ -443,7 +445,7 @@ class ContainerServiceDiagnosticsProfile(msrest.serialization.Model): def __init__( self, *, - vm_diagnostics: "ContainerServiceVMDiagnostics", + vm_diagnostics: "_models.ContainerServiceVMDiagnostics", **kwargs ): """ @@ -480,7 +482,7 @@ def __init__( self, *, admin_username: str, - ssh: "ContainerServiceSshConfiguration", + ssh: "_models.ContainerServiceSshConfiguration", **kwargs ): """ @@ -518,7 +520,7 @@ class ContainerServiceListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["ContainerService"]] = None, + value: Optional[List["_models.ContainerService"]] = None, **kwargs ): """ @@ -538,17 +540,17 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar count: Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, - and 5. The default value is 1. Possible values include: 1, 3, 5. Default value: "1". + and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". :vartype count: int or ~azure.mgmt.containerservice.v2017_07_01.models.Count :ivar dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. :vartype dns_prefix: str - :ivar vm_size: Required. Size of agent VMs. Possible values include: "Standard_A1", - "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", - "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", - "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", - "Standard_A8m_v2", "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", - "Standard_B8ms", "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", - "Standard_D12", "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", + :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", + "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", + "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", + "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", "Standard_B8ms", + "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", "Standard_D12", + "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", "Standard_D13_v2_Promo", "Standard_D14", "Standard_D14_v2", "Standard_D14_v2_Promo", "Standard_D15_v2", "Standard_D16_v3", "Standard_D16s_v3", "Standard_D1_v2", "Standard_D2", "Standard_D2_v2", "Standard_D2_v2_Promo", "Standard_D2_v3", "Standard_D2s_v3", "Standard_D3", @@ -593,7 +595,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): :vartype first_consecutive_static_ip: str :ivar storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Possible values include: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". :vartype storage_profile: str or ~azure.mgmt.containerservice.v2017_07_01.models.ContainerServiceStorageProfileTypes :ivar fqdn: FQDN for the master pool. @@ -622,27 +624,27 @@ def __init__( self, *, dns_prefix: str, - vm_size: Union[str, "ContainerServiceVMSizeTypes"], - count: Optional[Union[int, "Count"]] = 1, + vm_size: Union[str, "_models.ContainerServiceVMSizeTypes"], + count: Optional[Union[int, "_models.Count"]] = 1, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, first_consecutive_static_ip: Optional[str] = "10.240.255.5", - storage_profile: Optional[Union[str, "ContainerServiceStorageProfileTypes"]] = None, + storage_profile: Optional[Union[str, "_models.ContainerServiceStorageProfileTypes"]] = None, **kwargs ): """ :keyword count: Number of masters (VMs) in the container service cluster. Allowed values are 1, - 3, and 5. The default value is 1. Possible values include: 1, 3, 5. Default value: "1". + 3, and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". :paramtype count: int or ~azure.mgmt.containerservice.v2017_07_01.models.Count :keyword dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. :paramtype dns_prefix: str - :keyword vm_size: Required. Size of agent VMs. Possible values include: "Standard_A1", - "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", - "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", - "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", - "Standard_A8m_v2", "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", - "Standard_B8ms", "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", - "Standard_D12", "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", + :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", + "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", + "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", + "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", "Standard_B8ms", + "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", "Standard_D12", + "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", "Standard_D13_v2_Promo", "Standard_D14", "Standard_D14_v2", "Standard_D14_v2_Promo", "Standard_D15_v2", "Standard_D16_v3", "Standard_D16s_v3", "Standard_D1_v2", "Standard_D2", "Standard_D2_v2", "Standard_D2_v2_Promo", "Standard_D2_v3", "Standard_D2s_v3", "Standard_D3", @@ -687,7 +689,7 @@ def __init__( :paramtype first_consecutive_static_ip: str :keyword storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Possible values include: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". :paramtype storage_profile: str or ~azure.mgmt.containerservice.v2017_07_01.models.ContainerServiceStorageProfileTypes """ @@ -708,8 +710,8 @@ class ContainerServiceOrchestratorProfile(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar orchestrator_type: Required. The orchestrator to use to manage container service cluster - resources. Valid values are Kubernetes, Swarm, DCOS, DockerCE and Custom. Possible values - include: "Kubernetes", "Swarm", "DCOS", "DockerCE", "Custom". + resources. Valid values are Kubernetes, Swarm, DCOS, DockerCE and Custom. Known values are: + "Kubernetes", "Swarm", "DCOS", "DockerCE", "Custom". :vartype orchestrator_type: str or ~azure.mgmt.containerservice.v2017_07_01.models.ContainerServiceOrchestratorTypes :ivar orchestrator_version: The version of the orchestrator to use. You can specify the @@ -729,14 +731,14 @@ class ContainerServiceOrchestratorProfile(msrest.serialization.Model): def __init__( self, *, - orchestrator_type: Union[str, "ContainerServiceOrchestratorTypes"], + orchestrator_type: Union[str, "_models.ContainerServiceOrchestratorTypes"], orchestrator_version: Optional[str] = None, **kwargs ): """ :keyword orchestrator_type: Required. The orchestrator to use to manage container service - cluster resources. Valid values are Kubernetes, Swarm, DCOS, DockerCE and Custom. Possible - values include: "Kubernetes", "Swarm", "DCOS", "DockerCE", "Custom". + cluster resources. Valid values are Kubernetes, Swarm, DCOS, DockerCE and Custom. Known values + are: "Kubernetes", "Swarm", "DCOS", "DockerCE", "Custom". :paramtype orchestrator_type: str or ~azure.mgmt.containerservice.v2017_07_01.models.ContainerServiceOrchestratorTypes :keyword orchestrator_version: The version of the orchestrator to use. You can specify the @@ -777,7 +779,7 @@ def __init__( *, client_id: str, secret: Optional[str] = None, - key_vault_secret_ref: Optional["KeyVaultSecretRef"] = None, + key_vault_secret_ref: Optional["_models.KeyVaultSecretRef"] = None, **kwargs ): """ @@ -817,7 +819,7 @@ class ContainerServiceSshConfiguration(msrest.serialization.Model): def __init__( self, *, - public_keys: List["ContainerServiceSshPublicKey"], + public_keys: List["_models.ContainerServiceSshPublicKey"], **kwargs ): """ @@ -1068,7 +1070,7 @@ def __init__( orchestrator_version: str, default: Optional[bool] = None, is_preview: Optional[bool] = None, - upgrades: Optional[List["OrchestratorProfile"]] = None, + upgrades: Optional[List["_models.OrchestratorProfile"]] = None, **kwargs ): """ @@ -1126,7 +1128,7 @@ class OrchestratorVersionProfileListResult(msrest.serialization.Model): def __init__( self, *, - orchestrators: List["OrchestratorVersionProfile"], + orchestrators: List["_models.OrchestratorVersionProfile"], **kwargs ): """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/models/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/models/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/operations/__init__.py index db0e90a3a5aa..a96e407a7be1 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/operations/__init__.py @@ -8,6 +8,11 @@ from ._container_services_operations import ContainerServicesOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'ContainerServicesOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/operations/_container_services_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/operations/_container_services_operations.py index 4b2829a8d548..cb6bfc424257 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/operations/_container_services_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/operations/_container_services_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -33,9 +33,12 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2017-07-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-07-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/containerServices") # pylint: disable=line-too-long path_format_arguments = { @@ -45,18 +48,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -66,14 +67,17 @@ def build_create_or_update_request_initial( container_service_name: str, subscription_id: str, *, - json: JSONType = None, + json: Optional[_models.ContainerService] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2017-07-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/containerServices/{containerServiceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -85,20 +89,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -111,9 +113,12 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2017-07-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-07-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/containerServices/{containerServiceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -125,18 +130,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -147,8 +150,9 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2017-07-01") # type: str + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-07-01")) # type: str # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/containerServices/{containerServiceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -160,13 +164,12 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, + params=_params, **kwargs ) @@ -176,9 +179,12 @@ def build_list_by_resource_group_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2017-07-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-07-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/containerServices") # pylint: disable=line-too-long path_format_arguments = { @@ -189,18 +195,16 @@ def build_list_by_resource_group_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -212,9 +216,12 @@ def build_list_orchestrators_request( resource_type: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-04-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/orchestrators") # pylint: disable=line-too-long path_format_arguments = { @@ -225,50 +232,46 @@ def build_list_orchestrators_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if resource_type is not None: - _query_parameters['resource-type'] = _SERIALIZER.query("resource_type", resource_type, 'str') + _params['resource-type'] = _SERIALIZER.query("resource_type", resource_type, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class ContainerServicesOperations(object): - """ContainerServicesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ContainerServicesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2017_07_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2017_07_01.ContainerServiceClient`'s + :attr:`container_services` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> Iterable["_models.ContainerServiceListResult"]: + ) -> Iterable[_models.ContainerServiceListResult]: """Gets a list of container services in the specified subscription. Gets a list of container services in the specified subscription. The operation returns @@ -285,13 +288,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2017_07_01.models.ContainerServiceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2017-07-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ContainerServiceListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ContainerServiceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -299,9 +305,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -309,9 +317,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -348,17 +358,20 @@ def _create_or_update_initial( self, resource_group_name: str, container_service_name: str, - parameters: "_models.ContainerService", + parameters: _models.ContainerService, **kwargs: Any - ) -> "_models.ContainerService": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ContainerService"] + ) -> _models.ContainerService: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2017-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ContainerService] _json = self._serialize.body(parameters, 'ContainerService') @@ -370,11 +383,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -407,9 +422,9 @@ def begin_create_or_update( self, resource_group_name: str, container_service_name: str, - parameters: "_models.ContainerService", + parameters: _models.ContainerService, **kwargs: Any - ) -> LROPoller["_models.ContainerService"]: + ) -> LROPoller[_models.ContainerService]: """Creates or updates a container service. Creates or updates a container service with the specified configuration of orchestrator, @@ -439,37 +454,47 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2017_07_01.models.ContainerService] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2017-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ContainerService] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ContainerService"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, container_service_name=container_service_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ContainerService', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -488,7 +513,7 @@ def get( resource_group_name: str, container_service_name: str, **kwargs: Any - ) -> "_models.ContainerService": + ) -> _models.ContainerService: """Gets the properties of the specified container service. Gets the properties of the specified container service in the specified subscription and @@ -508,13 +533,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2017_07_01.models.ContainerService :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ContainerService"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2017-07-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ContainerService] request = build_get_request( @@ -523,11 +551,13 @@ def get( 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -554,13 +584,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements container_service_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2017-07-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -569,11 +602,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements subscription_id=self._config.subscription_id, api_version=api_version, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -624,20 +659,25 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2017-07-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-07-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, container_service_name=container_service_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -647,8 +687,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -666,7 +712,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.ContainerServiceListResult"]: + ) -> Iterable[_models.ContainerServiceListResult]: """Gets a list of container services in the specified resource group. Gets a list of container services in the specified subscription and resource group. The @@ -685,13 +731,16 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2017_07_01.models.ContainerServiceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2017-07-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2017-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ContainerServiceListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ContainerServiceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -700,9 +749,11 @@ def prepare_request(next_link=None): 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -711,9 +762,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -752,7 +805,7 @@ def list_orchestrators( location: str, resource_type: Optional[str] = None, **kwargs: Any - ) -> "_models.OrchestratorVersionProfileListResult": + ) -> _models.OrchestratorVersionProfileListResult: """Gets a list of supported orchestrators in the specified subscription. Gets a list of supported orchestrators in the specified subscription. The operation returns @@ -772,13 +825,16 @@ def list_orchestrators( :rtype: ~azure.mgmt.containerservice.v2017_07_01.models.OrchestratorVersionProfileListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OrchestratorVersionProfileListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-04-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OrchestratorVersionProfileListResult] request = build_list_orchestrators_request( @@ -787,11 +843,13 @@ def list_orchestrators( api_version=api_version, resource_type=resource_type, template_url=self.list_orchestrators.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2017_07_01/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/__init__.py index 53c675bd95e2..37a5f9e02e6f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._container_service_client import ContainerServiceClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['ContainerServiceClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/_container_service_client.py index 340e0ee5f97c..51eafa374445 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/_container_service_client.py @@ -58,8 +58,12 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.managed_clusters = ManagedClustersOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_clusters = ManagedClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/aio/__init__.py index 53c675bd95e2..37a5f9e02e6f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/aio/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/aio/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._container_service_client import ContainerServiceClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['ContainerServiceClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/aio/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/aio/_container_service_client.py index 04156f7e553c..5abcaf69854c 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/aio/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/aio/_container_service_client.py @@ -58,8 +58,12 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.managed_clusters = ManagedClustersOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_clusters = ManagedClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/aio/operations/__init__.py index 77613c407d74..79c2682d6c29 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/aio/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/aio/operations/__init__.py @@ -9,7 +9,12 @@ from ._operations import Operations from ._managed_clusters_operations import ManagedClustersOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'Operations', 'ManagedClustersOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/aio/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/aio/operations/_managed_clusters_operations.py index 0eb46672a07b..61c25479c93d 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/aio/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/aio/operations/_managed_clusters_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. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ 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 @@ -26,32 +27,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ManagedClustersOperations: - """ManagedClustersOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2018_03_31.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2018_03_31.aio.ContainerServiceClient`'s + :attr:`managed_clusters` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.ManagedClusterListResult"]: + ) -> AsyncIterable[_models.ManagedClusterListResult]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. The operation returns properties @@ -64,13 +63,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2018_03_31.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2018-03-31") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -78,9 +80,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -88,9 +92,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -128,7 +134,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ManagedClusterListResult"]: + ) -> AsyncIterable[_models.ManagedClusterListResult]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. The operation returns @@ -143,13 +149,16 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2018_03_31.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2018-03-31") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -158,9 +167,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -169,9 +180,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -210,7 +223,7 @@ async def get_upgrade_profile( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedClusterUpgradeProfile": + ) -> _models.ManagedClusterUpgradeProfile: """Gets upgrade profile for a managed cluster. Gets the details of the upgrade profile for a managed cluster with a specified resource group @@ -225,13 +238,16 @@ async def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2018_03_31.models.ManagedClusterUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2018-03-31") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] request = build_get_upgrade_profile_request( @@ -240,11 +256,13 @@ async def get_upgrade_profile( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -272,7 +290,7 @@ async def get_access_profile( resource_name: str, role_name: str, **kwargs: Any - ) -> "_models.ManagedClusterAccessProfile": + ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. Gets the accessProfile for the specified role name of the managed cluster with a specified @@ -289,13 +307,16 @@ async def get_access_profile( :rtype: ~azure.mgmt.containerservice.v2018_03_31.models.ManagedClusterAccessProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterAccessProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2018-03-31") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] request = build_get_access_profile_request( @@ -305,11 +326,13 @@ async def get_access_profile( role_name=role_name, api_version=api_version, template_url=self.get_access_profile.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -336,7 +359,7 @@ async def list_cluster_admin_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster admin credential of a managed cluster. Gets cluster admin credential of the managed cluster with a specified resource group and name. @@ -350,13 +373,16 @@ async def list_cluster_admin_credentials( :rtype: ~azure.mgmt.containerservice.v2018_03_31.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2018-03-31") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_admin_credentials_request( @@ -365,11 +391,13 @@ async def list_cluster_admin_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_admin_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -396,7 +424,7 @@ async def list_cluster_user_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster user credential of a managed cluster. Gets cluster user credential of the managed cluster with a specified resource group and name. @@ -410,13 +438,16 @@ async def list_cluster_user_credentials( :rtype: ~azure.mgmt.containerservice.v2018_03_31.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2018-03-31") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_user_credentials_request( @@ -425,11 +456,13 @@ async def list_cluster_user_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -456,7 +489,7 @@ async def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedCluster": + ) -> _models.ManagedCluster: """Gets a managed cluster. Gets the details of the managed cluster with a specified resource group and name. @@ -470,13 +503,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2018_03_31.models.ManagedCluster :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2018-03-31") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] request = build_get_request( @@ -485,11 +521,13 @@ async def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -514,17 +552,20 @@ async def _create_or_update_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2018-03-31") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'ManagedCluster') @@ -536,11 +577,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -570,9 +613,9 @@ async def begin_create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> AsyncLROPoller["_models.ManagedCluster"]: + ) -> AsyncLROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. Creates or updates a managed cluster with the specified configuration for agents and Kubernetes @@ -598,37 +641,47 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2018_03_31.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2018-03-31") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -645,17 +698,20 @@ async def _update_tags_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2018-03-31") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'TagsObject') @@ -667,11 +723,13 @@ async def _update_tags_initial( content_type=content_type, json=_json, template_url=self._update_tags_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -697,9 +755,9 @@ async def begin_update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> AsyncLROPoller["_models.ManagedCluster"]: + ) -> AsyncLROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates a managed cluster with the specified tags. @@ -724,37 +782,47 @@ async def begin_update_tags( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2018_03_31.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2018-03-31") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._update_tags_initial( + raw_result = await self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -773,13 +841,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2018-03-31") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -788,11 +859,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -836,20 +909,25 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2018-03-31") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_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) @@ -859,8 +937,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -877,17 +961,20 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2018-03-31") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') @@ -899,11 +986,13 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist content_type=content_type, json=_json, template_url=self._reset_service_principal_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -925,7 +1014,7 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> AsyncLROPoller[None]: """Reset Service Principal Profile of a managed cluster. @@ -952,23 +1041,28 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2018-03-31") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._reset_service_principal_profile_initial( + raw_result = await self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -978,8 +1072,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -996,17 +1096,20 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2018-03-31") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') @@ -1018,11 +1121,13 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta content_type=content_type, json=_json, template_url=self._reset_aad_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1044,7 +1149,7 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> AsyncLROPoller[None]: """Reset AAD Profile of a managed cluster. @@ -1070,23 +1175,28 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2018-03-31") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._reset_aad_profile_initial( + raw_result = await self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1096,8 +1206,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/aio/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/aio/operations/_operations.py index 9acc332b8a04..607554bc1517 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/aio/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/aio/operations/_operations.py @@ -14,6 +14,7 @@ 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 @@ -23,32 +24,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class Operations: - """Operations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2018_03_31.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2018_03_31.aio.ContainerServiceClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.OperationListResult"]: + ) -> AsyncIterable[_models.OperationListResult]: """Gets a list of compute operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -57,31 +56,38 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2018_03_31.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2018-03-31") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/aio/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/aio/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/models/__init__.py index f44d371e62f3..1cfef05788b7 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/models/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/models/__init__.py @@ -40,7 +40,9 @@ NetworkPolicy, OSType, ) - +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'ContainerServiceDiagnosticsProfile', 'ContainerServiceLinuxProfile', @@ -73,3 +75,5 @@ 'NetworkPolicy', 'OSType', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/models/_container_service_client_enums.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/models/_container_service_client_enums.py index 139990e598ab..5835a9bfa4b2 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/models/_container_service_client_enums.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/models/_container_service_client_enums.py @@ -7,11 +7,10 @@ # -------------------------------------------------------------------------- from enum import Enum -from six import with_metaclass from azure.core import CaseInsensitiveEnumMeta -class ContainerServiceStorageProfileTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the orchestrator choice. """ @@ -19,7 +18,7 @@ class ContainerServiceStorageProfileTypes(with_metaclass(CaseInsensitiveEnumMeta STORAGE_ACCOUNT = "StorageAccount" MANAGED_DISKS = "ManagedDisks" -class ContainerServiceVMSizeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Size of agent VMs. """ @@ -198,7 +197,7 @@ class ContainerServiceVMSizeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, E STANDARD_NV24 = "Standard_NV24" STANDARD_NV6 = "Standard_NV6" -class Count(with_metaclass(CaseInsensitiveEnumMeta, int, Enum)): +class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): """Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, and 5. The default value is 1. """ @@ -207,20 +206,20 @@ class Count(with_metaclass(CaseInsensitiveEnumMeta, int, Enum)): THREE = 3 FIVE = 5 -class NetworkPlugin(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkPlugin(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Network plugin used for building Kubernetes network. """ AZURE = "azure" KUBENET = "kubenet" -class NetworkPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Network policy used for building Kubernetes network. """ CALICO = "calico" -class OSType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux. """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/models/_models_py3.py index 6bcca5f22652..c548e149a28d 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/models/_models_py3.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/models/_models_py3.py @@ -6,11 +6,13 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Dict, List, Optional, Union +from typing import Dict, List, Optional, TYPE_CHECKING, Union import msrest.serialization -from ._container_service_client_enums import * +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + import __init__ as _models class ContainerServiceDiagnosticsProfile(msrest.serialization.Model): @@ -34,7 +36,7 @@ class ContainerServiceDiagnosticsProfile(msrest.serialization.Model): def __init__( self, *, - vm_diagnostics: "ContainerServiceVMDiagnostics", + vm_diagnostics: "_models.ContainerServiceVMDiagnostics", **kwargs ): """ @@ -71,7 +73,7 @@ def __init__( self, *, admin_username: str, - ssh: "ContainerServiceSshConfiguration", + ssh: "_models.ContainerServiceSshConfiguration", **kwargs ): """ @@ -94,17 +96,17 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar count: Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, - and 5. The default value is 1. Possible values include: 1, 3, 5. Default value: "1". + and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". :vartype count: int or ~azure.mgmt.containerservice.v2018_03_31.models.Count :ivar dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. :vartype dns_prefix: str - :ivar vm_size: Required. Size of agent VMs. Possible values include: "Standard_A1", - "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", - "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", - "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", - "Standard_A8m_v2", "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", - "Standard_B8ms", "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", - "Standard_D12", "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", + :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", + "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", + "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", + "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", "Standard_B8ms", + "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", "Standard_D12", + "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", "Standard_D13_v2_Promo", "Standard_D14", "Standard_D14_v2", "Standard_D14_v2_Promo", "Standard_D15_v2", "Standard_D16_v3", "Standard_D16s_v3", "Standard_D1_v2", "Standard_D2", "Standard_D2_v2", "Standard_D2_v2_Promo", "Standard_D2_v3", "Standard_D2s_v3", "Standard_D3", @@ -149,7 +151,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): :vartype first_consecutive_static_ip: str :ivar storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Possible values include: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". :vartype storage_profile: str or ~azure.mgmt.containerservice.v2018_03_31.models.ContainerServiceStorageProfileTypes :ivar fqdn: FQDN for the master pool. @@ -178,27 +180,27 @@ def __init__( self, *, dns_prefix: str, - vm_size: Union[str, "ContainerServiceVMSizeTypes"], - count: Optional[Union[int, "Count"]] = 1, + vm_size: Union[str, "_models.ContainerServiceVMSizeTypes"], + count: Optional[Union[int, "_models.Count"]] = 1, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, first_consecutive_static_ip: Optional[str] = "10.240.255.5", - storage_profile: Optional[Union[str, "ContainerServiceStorageProfileTypes"]] = None, + storage_profile: Optional[Union[str, "_models.ContainerServiceStorageProfileTypes"]] = None, **kwargs ): """ :keyword count: Number of masters (VMs) in the container service cluster. Allowed values are 1, - 3, and 5. The default value is 1. Possible values include: 1, 3, 5. Default value: "1". + 3, and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". :paramtype count: int or ~azure.mgmt.containerservice.v2018_03_31.models.Count :keyword dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. :paramtype dns_prefix: str - :keyword vm_size: Required. Size of agent VMs. Possible values include: "Standard_A1", - "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", - "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", - "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", - "Standard_A8m_v2", "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", - "Standard_B8ms", "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", - "Standard_D12", "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", + :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", + "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", + "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", + "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", "Standard_B8ms", + "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", "Standard_D12", + "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", "Standard_D13_v2_Promo", "Standard_D14", "Standard_D14_v2", "Standard_D14_v2_Promo", "Standard_D15_v2", "Standard_D16_v3", "Standard_D16s_v3", "Standard_D1_v2", "Standard_D2", "Standard_D2_v2", "Standard_D2_v2_Promo", "Standard_D2_v3", "Standard_D2s_v3", "Standard_D3", @@ -243,7 +245,7 @@ def __init__( :paramtype first_consecutive_static_ip: str :keyword storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Possible values include: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". :paramtype storage_profile: str or ~azure.mgmt.containerservice.v2018_03_31.models.ContainerServiceStorageProfileTypes """ @@ -261,11 +263,11 @@ def __init__( class ContainerServiceNetworkProfile(msrest.serialization.Model): """Profile of network configuration. - :ivar network_plugin: Network plugin used for building Kubernetes network. Possible values - include: "azure", "kubenet". Default value: "kubenet". + :ivar network_plugin: Network plugin used for building Kubernetes network. Known values are: + "azure", "kubenet". Default value: "kubenet". :vartype network_plugin: str or ~azure.mgmt.containerservice.v2018_03_31.models.NetworkPlugin - :ivar network_policy: Network policy used for building Kubernetes network. Possible values - include: "calico". + :ivar network_policy: Network policy used for building Kubernetes network. Known values are: + "calico". :vartype network_policy: str or ~azure.mgmt.containerservice.v2018_03_31.models.NetworkPolicy :ivar pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :vartype pod_cidr: str @@ -299,8 +301,8 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): def __init__( self, *, - network_plugin: Optional[Union[str, "NetworkPlugin"]] = "kubenet", - network_policy: Optional[Union[str, "NetworkPolicy"]] = None, + network_plugin: Optional[Union[str, "_models.NetworkPlugin"]] = "kubenet", + network_policy: Optional[Union[str, "_models.NetworkPolicy"]] = None, pod_cidr: Optional[str] = "10.244.0.0/16", service_cidr: Optional[str] = "10.0.0.0/16", dns_service_ip: Optional[str] = "10.0.0.10", @@ -308,11 +310,11 @@ def __init__( **kwargs ): """ - :keyword network_plugin: Network plugin used for building Kubernetes network. Possible values - include: "azure", "kubenet". Default value: "kubenet". + :keyword network_plugin: Network plugin used for building Kubernetes network. Known values are: + "azure", "kubenet". Default value: "kubenet". :paramtype network_plugin: str or ~azure.mgmt.containerservice.v2018_03_31.models.NetworkPlugin - :keyword network_policy: Network policy used for building Kubernetes network. Possible values - include: "calico". + :keyword network_policy: Network policy used for building Kubernetes network. Known values are: + "calico". :paramtype network_policy: str or ~azure.mgmt.containerservice.v2018_03_31.models.NetworkPolicy :keyword pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :paramtype pod_cidr: str @@ -357,7 +359,7 @@ class ContainerServiceSshConfiguration(msrest.serialization.Model): def __init__( self, *, - public_keys: List["ContainerServiceSshPublicKey"], + public_keys: List["_models.ContainerServiceSshPublicKey"], **kwargs ): """ @@ -682,13 +684,13 @@ def __init__( tags: Optional[Dict[str, str]] = None, kubernetes_version: Optional[str] = None, dns_prefix: Optional[str] = None, - agent_pool_profiles: Optional[List["ManagedClusterAgentPoolProfile"]] = None, - linux_profile: Optional["ContainerServiceLinuxProfile"] = None, - service_principal_profile: Optional["ManagedClusterServicePrincipalProfile"] = None, - addon_profiles: Optional[Dict[str, "ManagedClusterAddonProfile"]] = None, + agent_pool_profiles: Optional[List["_models.ManagedClusterAgentPoolProfile"]] = None, + linux_profile: Optional["_models.ContainerServiceLinuxProfile"] = None, + service_principal_profile: Optional["_models.ManagedClusterServicePrincipalProfile"] = None, + addon_profiles: Optional[Dict[str, "_models.ManagedClusterAddonProfile"]] = None, enable_rbac: Optional[bool] = None, - network_profile: Optional["ContainerServiceNetworkProfile"] = None, - aad_profile: Optional["ManagedClusterAADProfile"] = None, + network_profile: Optional["_models.ContainerServiceNetworkProfile"] = None, + aad_profile: Optional["_models.ManagedClusterAADProfile"] = None, **kwargs ): """ @@ -901,13 +903,13 @@ class ManagedClusterAgentPoolProfile(msrest.serialization.Model): :ivar count: Number of agents (VMs) 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: Required. Size of agent VMs. Possible values include: "Standard_A1", - "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", - "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", - "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", - "Standard_A8m_v2", "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", - "Standard_B8ms", "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", - "Standard_D12", "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", + :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", + "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", + "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", + "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", "Standard_B8ms", + "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", "Standard_D12", + "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", "Standard_D13_v2_Promo", "Standard_D14", "Standard_D14_v2", "Standard_D14_v2_Promo", "Standard_D15_v2", "Standard_D16_v3", "Standard_D16s_v3", "Standard_D1_v2", "Standard_D2", "Standard_D2_v2", "Standard_D2_v2_Promo", "Standard_D2_v3", "Standard_D2s_v3", "Standard_D3", @@ -946,7 +948,7 @@ class ManagedClusterAgentPoolProfile(msrest.serialization.Model): the vmSize specified. :vartype os_disk_size_gb: int :ivar storage_profile: Storage profile specifies what kind of storage used. Defaults to - ManagedDisks. Possible values include: "StorageAccount", "ManagedDisks". + ManagedDisks. Known values are: "StorageAccount", "ManagedDisks". :vartype storage_profile: str or ~azure.mgmt.containerservice.v2018_03_31.models.ContainerServiceStorageProfileTypes :ivar vnet_subnet_id: VNet SubnetID specifies the VNet's subnet identifier. @@ -954,7 +956,7 @@ class ManagedClusterAgentPoolProfile(msrest.serialization.Model): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2018_03_31.models.OSType """ @@ -981,12 +983,12 @@ def __init__( self, *, name: str, - vm_size: Union[str, "ContainerServiceVMSizeTypes"], + vm_size: Union[str, "_models.ContainerServiceVMSizeTypes"], count: Optional[int] = 1, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", **kwargs ): """ @@ -996,13 +998,13 @@ def __init__( :keyword count: Number of agents (VMs) 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: Required. Size of agent VMs. Possible values include: "Standard_A1", - "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", - "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", - "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", - "Standard_A8m_v2", "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", - "Standard_B8ms", "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", - "Standard_D12", "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", + :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", + "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", + "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", + "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", "Standard_B8ms", + "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", "Standard_D12", + "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", "Standard_D13_v2_Promo", "Standard_D14", "Standard_D14_v2", "Standard_D14_v2_Promo", "Standard_D15_v2", "Standard_D16_v3", "Standard_D16s_v3", "Standard_D1_v2", "Standard_D2", "Standard_D2_v2", "Standard_D2_v2_Promo", "Standard_D2_v3", "Standard_D2s_v3", "Standard_D3", @@ -1045,7 +1047,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2018_03_31.models.OSType """ super(ManagedClusterAgentPoolProfile, self).__init__(**kwargs) @@ -1082,7 +1084,7 @@ class ManagedClusterListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["ManagedCluster"]] = None, + value: Optional[List["_models.ManagedCluster"]] = None, **kwargs ): """ @@ -1104,7 +1106,7 @@ class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): :ivar name: Pool name. :vartype name: str :ivar os_type: Required. OsType to be used to specify os type. Choose from Linux and Windows. - Default to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2018_03_31.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: list[str] @@ -1126,7 +1128,7 @@ def __init__( self, *, kubernetes_version: str, - os_type: Union[str, "OSType"] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", name: Optional[str] = None, upgrades: Optional[List[str]] = None, **kwargs @@ -1137,7 +1139,7 @@ def __init__( :keyword name: Pool name. :paramtype name: str :keyword os_type: Required. OsType to be used to specify os type. Choose from Linux and - Windows. Default to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Windows. Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2018_03_31.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: list[str] @@ -1228,8 +1230,8 @@ class ManagedClusterUpgradeProfile(msrest.serialization.Model): def __init__( self, *, - control_plane_profile: "ManagedClusterPoolUpgradeProfile", - agent_pool_profiles: List["ManagedClusterPoolUpgradeProfile"], + control_plane_profile: "_models.ManagedClusterPoolUpgradeProfile", + agent_pool_profiles: List["_models.ManagedClusterPoolUpgradeProfile"], **kwargs ): """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/models/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/models/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/operations/__init__.py index 77613c407d74..79c2682d6c29 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/operations/__init__.py @@ -9,7 +9,12 @@ from ._operations import Operations from ._managed_clusters_operations import ManagedClustersOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'Operations', 'ManagedClustersOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/operations/_managed_clusters_operations.py index 982c27cbf856..655274ffd5b0 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/operations/_managed_clusters_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -33,9 +33,12 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2018-03-31") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters") path_format_arguments = { @@ -45,18 +48,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -66,9 +67,12 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2018-03-31") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters") # pylint: disable=line-too-long path_format_arguments = { @@ -79,18 +83,16 @@ def build_list_by_resource_group_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -101,9 +103,12 @@ def build_get_upgrade_profile_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2018-03-31") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default") # pylint: disable=line-too-long path_format_arguments = { @@ -115,18 +120,16 @@ def build_get_upgrade_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -138,9 +141,12 @@ def build_get_access_profile_request( role_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2018-03-31") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -153,18 +159,16 @@ def build_get_access_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -175,9 +179,12 @@ def build_list_cluster_admin_credentials_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2018-03-31") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -189,18 +196,16 @@ def build_list_cluster_admin_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -211,9 +216,12 @@ def build_list_cluster_user_credentials_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2018-03-31") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -225,18 +233,16 @@ def build_list_cluster_user_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -247,9 +253,12 @@ def build_get_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2018-03-31") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -261,18 +270,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -282,14 +289,17 @@ def build_create_or_update_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedCluster] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2018-03-31") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -301,20 +311,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -326,14 +334,17 @@ def build_update_tags_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.TagsObject] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2018-03-31") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -345,20 +356,18 @@ def build_update_tags_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -371,8 +380,9 @@ def build_delete_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2018-03-31") # type: str + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -384,13 +394,12 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, + params=_params, **kwargs ) @@ -400,13 +409,15 @@ def build_reset_service_principal_profile_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedClusterServicePrincipalProfile] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2018-03-31") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile") # pylint: disable=line-too-long path_format_arguments = { @@ -418,19 +429,17 @@ def build_reset_service_principal_profile_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -442,13 +451,15 @@ def build_reset_aad_profile_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedClusterAADProfile] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2018-03-31") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile") # pylint: disable=line-too-long path_format_arguments = { @@ -460,51 +471,47 @@ def build_reset_aad_profile_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs ) -class ManagedClustersOperations(object): - """ManagedClustersOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ManagedClustersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2018_03_31.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2018_03_31.ContainerServiceClient`'s + :attr:`managed_clusters` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> Iterable["_models.ManagedClusterListResult"]: + ) -> Iterable[_models.ManagedClusterListResult]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. The operation returns properties @@ -517,13 +524,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2018_03_31.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2018-03-31") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -531,9 +541,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -541,9 +553,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -581,7 +595,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.ManagedClusterListResult"]: + ) -> Iterable[_models.ManagedClusterListResult]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. The operation returns @@ -596,13 +610,16 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2018_03_31.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2018-03-31") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -611,9 +628,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -622,9 +641,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -663,7 +684,7 @@ def get_upgrade_profile( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedClusterUpgradeProfile": + ) -> _models.ManagedClusterUpgradeProfile: """Gets upgrade profile for a managed cluster. Gets the details of the upgrade profile for a managed cluster with a specified resource group @@ -678,13 +699,16 @@ def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2018_03_31.models.ManagedClusterUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2018-03-31") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] request = build_get_upgrade_profile_request( @@ -693,11 +717,13 @@ def get_upgrade_profile( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -725,7 +751,7 @@ def get_access_profile( resource_name: str, role_name: str, **kwargs: Any - ) -> "_models.ManagedClusterAccessProfile": + ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. Gets the accessProfile for the specified role name of the managed cluster with a specified @@ -742,13 +768,16 @@ def get_access_profile( :rtype: ~azure.mgmt.containerservice.v2018_03_31.models.ManagedClusterAccessProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterAccessProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2018-03-31") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] request = build_get_access_profile_request( @@ -758,11 +787,13 @@ def get_access_profile( role_name=role_name, api_version=api_version, template_url=self.get_access_profile.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -789,7 +820,7 @@ def list_cluster_admin_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster admin credential of a managed cluster. Gets cluster admin credential of the managed cluster with a specified resource group and name. @@ -803,13 +834,16 @@ def list_cluster_admin_credentials( :rtype: ~azure.mgmt.containerservice.v2018_03_31.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2018-03-31") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_admin_credentials_request( @@ -818,11 +852,13 @@ def list_cluster_admin_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_admin_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -849,7 +885,7 @@ def list_cluster_user_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster user credential of a managed cluster. Gets cluster user credential of the managed cluster with a specified resource group and name. @@ -863,13 +899,16 @@ def list_cluster_user_credentials( :rtype: ~azure.mgmt.containerservice.v2018_03_31.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2018-03-31") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_user_credentials_request( @@ -878,11 +917,13 @@ def list_cluster_user_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -909,7 +950,7 @@ def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedCluster": + ) -> _models.ManagedCluster: """Gets a managed cluster. Gets the details of the managed cluster with a specified resource group and name. @@ -923,13 +964,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2018_03_31.models.ManagedCluster :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2018-03-31") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] request = build_get_request( @@ -938,11 +982,13 @@ def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -967,17 +1013,20 @@ def _create_or_update_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2018-03-31") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'ManagedCluster') @@ -989,11 +1038,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1023,9 +1074,9 @@ def begin_create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> LROPoller["_models.ManagedCluster"]: + ) -> LROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. Creates or updates a managed cluster with the specified configuration for agents and Kubernetes @@ -1051,37 +1102,47 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2018_03_31.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2018-03-31") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1098,17 +1159,20 @@ def _update_tags_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2018-03-31") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'TagsObject') @@ -1120,11 +1184,13 @@ def _update_tags_initial( content_type=content_type, json=_json, template_url=self._update_tags_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1150,9 +1216,9 @@ def begin_update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> LROPoller["_models.ManagedCluster"]: + ) -> LROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates a managed cluster with the specified tags. @@ -1177,37 +1243,47 @@ def begin_update_tags( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2018_03_31.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2018-03-31") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._update_tags_initial( + raw_result = self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1226,13 +1302,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2018-03-31") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -1241,11 +1320,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1289,20 +1370,25 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2018-03-31") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_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) @@ -1312,8 +1398,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1330,17 +1422,20 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2018-03-31") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') @@ -1352,11 +1447,13 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re content_type=content_type, json=_json, template_url=self._reset_service_principal_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1378,7 +1475,7 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> LROPoller[None]: """Reset Service Principal Profile of a managed cluster. @@ -1405,23 +1502,28 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2018-03-31") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._reset_service_principal_profile_initial( + raw_result = self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1431,8 +1533,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1449,17 +1557,20 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2018-03-31") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') @@ -1471,11 +1582,13 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement content_type=content_type, json=_json, template_url=self._reset_aad_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1497,7 +1610,7 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> LROPoller[None]: """Reset AAD Profile of a managed cluster. @@ -1523,23 +1636,28 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2018-03-31") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._reset_aad_profile_initial( + raw_result = self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1549,8 +1667,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/operations/_operations.py index 2280e5fc974a..7241fae07e66 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/operations/_operations.py @@ -16,6 +16,7 @@ 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 @@ -29,55 +30,54 @@ def build_list_request( **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2018-03-31") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.ContainerService/operations") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class Operations(object): - """Operations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2018_03_31.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2018_03_31.ContainerServiceClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> Iterable["_models.OperationListResult"]: + ) -> Iterable[_models.OperationListResult]: """Gets a list of compute operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -86,31 +86,38 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2018_03_31.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2018-03-31") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-03-31")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_03_31/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/__init__.py index 53c675bd95e2..37a5f9e02e6f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._container_service_client import ContainerServiceClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['ContainerServiceClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/_container_service_client.py index 436ce2bb01f8..03a23e2a1d1b 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/_container_service_client.py @@ -58,8 +58,12 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.managed_clusters = ManagedClustersOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_clusters = ManagedClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/aio/__init__.py index 53c675bd95e2..37a5f9e02e6f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/aio/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/aio/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._container_service_client import ContainerServiceClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['ContainerServiceClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/aio/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/aio/_container_service_client.py index 0db31af427ee..b1847fb3580c 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/aio/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/aio/_container_service_client.py @@ -58,8 +58,12 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.managed_clusters = ManagedClustersOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_clusters = ManagedClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/aio/operations/__init__.py index 77613c407d74..79c2682d6c29 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/aio/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/aio/operations/__init__.py @@ -9,7 +9,12 @@ from ._operations import Operations from ._managed_clusters_operations import ManagedClustersOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'Operations', 'ManagedClustersOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/aio/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/aio/operations/_managed_clusters_operations.py index b3fbbd1e084d..6b9326e28968 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/aio/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/aio/operations/_managed_clusters_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. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ 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 @@ -26,32 +27,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ManagedClustersOperations: - """ManagedClustersOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2018_08_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2018_08_01_preview.aio.ContainerServiceClient`'s + :attr:`managed_clusters` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.ManagedClusterListResult"]: + ) -> AsyncIterable[_models.ManagedClusterListResult]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. The operation returns properties @@ -64,13 +63,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2018_08_01_preview.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2018-08-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -78,9 +80,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -88,9 +92,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -128,7 +134,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ManagedClusterListResult"]: + ) -> AsyncIterable[_models.ManagedClusterListResult]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. The operation returns @@ -143,13 +149,16 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2018_08_01_preview.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2018-08-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -158,9 +167,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -169,9 +180,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -210,7 +223,7 @@ async def get_upgrade_profile( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedClusterUpgradeProfile": + ) -> _models.ManagedClusterUpgradeProfile: """Gets upgrade profile for a managed cluster. Gets the details of the upgrade profile for a managed cluster with a specified resource group @@ -225,13 +238,16 @@ async def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2018_08_01_preview.models.ManagedClusterUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2018-08-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] request = build_get_upgrade_profile_request( @@ -240,11 +256,13 @@ async def get_upgrade_profile( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -272,7 +290,7 @@ async def get_access_profile( resource_name: str, role_name: str, **kwargs: Any - ) -> "_models.ManagedClusterAccessProfile": + ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. Gets the accessProfile for the specified role name of the managed cluster with a specified @@ -289,13 +307,16 @@ async def get_access_profile( :rtype: ~azure.mgmt.containerservice.v2018_08_01_preview.models.ManagedClusterAccessProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterAccessProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2018-08-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] request = build_get_access_profile_request( @@ -305,11 +326,13 @@ async def get_access_profile( role_name=role_name, api_version=api_version, template_url=self.get_access_profile.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -336,7 +359,7 @@ async def list_cluster_admin_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster admin credential of a managed cluster. Gets cluster admin credential of the managed cluster with a specified resource group and name. @@ -350,13 +373,16 @@ async def list_cluster_admin_credentials( :rtype: ~azure.mgmt.containerservice.v2018_08_01_preview.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2018-08-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_admin_credentials_request( @@ -365,11 +391,13 @@ async def list_cluster_admin_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_admin_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -396,7 +424,7 @@ async def list_cluster_user_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster user credential of a managed cluster. Gets cluster user credential of the managed cluster with a specified resource group and name. @@ -410,13 +438,16 @@ async def list_cluster_user_credentials( :rtype: ~azure.mgmt.containerservice.v2018_08_01_preview.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2018-08-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_user_credentials_request( @@ -425,11 +456,13 @@ async def list_cluster_user_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -456,7 +489,7 @@ async def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedCluster": + ) -> _models.ManagedCluster: """Gets a managed cluster. Gets the details of the managed cluster with a specified resource group and name. @@ -470,13 +503,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2018_08_01_preview.models.ManagedCluster :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2018-08-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] request = build_get_request( @@ -485,11 +521,13 @@ async def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -514,17 +552,20 @@ async def _create_or_update_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2018-08-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'ManagedCluster') @@ -536,11 +577,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -570,9 +613,9 @@ async def begin_create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> AsyncLROPoller["_models.ManagedCluster"]: + ) -> AsyncLROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. Creates or updates a managed cluster with the specified configuration for agents and Kubernetes @@ -598,37 +641,47 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2018_08_01_preview.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2018-08-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -645,17 +698,20 @@ async def _update_tags_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2018-08-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'TagsObject') @@ -667,11 +723,13 @@ async def _update_tags_initial( content_type=content_type, json=_json, template_url=self._update_tags_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -697,9 +755,9 @@ async def begin_update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> AsyncLROPoller["_models.ManagedCluster"]: + ) -> AsyncLROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates a managed cluster with the specified tags. @@ -724,37 +782,47 @@ async def begin_update_tags( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2018_08_01_preview.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2018-08-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._update_tags_initial( + raw_result = await self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -773,13 +841,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2018-08-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -788,11 +859,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -836,20 +909,25 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2018-08-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_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) @@ -859,8 +937,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -877,17 +961,20 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2018-08-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') @@ -899,11 +986,13 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist content_type=content_type, json=_json, template_url=self._reset_service_principal_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -925,7 +1014,7 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> AsyncLROPoller[None]: """Reset Service Principal Profile of a managed cluster. @@ -952,23 +1041,28 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2018-08-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._reset_service_principal_profile_initial( + raw_result = await self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -978,8 +1072,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -996,17 +1096,20 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2018-08-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') @@ -1018,11 +1121,13 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta content_type=content_type, json=_json, template_url=self._reset_aad_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1044,7 +1149,7 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> AsyncLROPoller[None]: """Reset AAD Profile of a managed cluster. @@ -1071,23 +1176,28 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2018-08-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._reset_aad_profile_initial( + raw_result = await self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1097,8 +1207,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/aio/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/aio/operations/_operations.py index 2df80a80b010..d2f89a1a0072 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/aio/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/aio/operations/_operations.py @@ -14,6 +14,7 @@ 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 @@ -23,32 +24,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class Operations: - """Operations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2018_08_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2018_08_01_preview.aio.ContainerServiceClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.OperationListResult"]: + ) -> AsyncIterable[_models.OperationListResult]: """Gets a list of compute operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -57,31 +56,38 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2018_08_01_preview.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2018-08-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/aio/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/aio/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/models/__init__.py index 973922e9e06d..1ce7f1900a82 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/models/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/models/__init__.py @@ -42,7 +42,9 @@ NetworkPolicy, OSType, ) - +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'CloudErrorBody', 'ContainerServiceDiagnosticsProfile', @@ -77,3 +79,5 @@ 'NetworkPolicy', 'OSType', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/models/_container_service_client_enums.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/models/_container_service_client_enums.py index aa7c375fed85..e5a5445ed6cb 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/models/_container_service_client_enums.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/models/_container_service_client_enums.py @@ -7,18 +7,17 @@ # -------------------------------------------------------------------------- from enum import Enum -from six import with_metaclass from azure.core import CaseInsensitiveEnumMeta -class AgentPoolType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class AgentPoolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """AgentPoolType represents types of an agent pool """ VIRTUAL_MACHINE_SCALE_SETS = "VirtualMachineScaleSets" AVAILABILITY_SET = "AvailabilitySet" -class ContainerServiceStorageProfileTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the orchestrator choice. """ @@ -26,7 +25,7 @@ class ContainerServiceStorageProfileTypes(with_metaclass(CaseInsensitiveEnumMeta STORAGE_ACCOUNT = "StorageAccount" MANAGED_DISKS = "ManagedDisks" -class ContainerServiceVMSizeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Size of agent VMs. """ @@ -205,7 +204,7 @@ class ContainerServiceVMSizeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, E STANDARD_NV24 = "Standard_NV24" STANDARD_NV6 = "Standard_NV6" -class Count(with_metaclass(CaseInsensitiveEnumMeta, int, Enum)): +class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): """Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, and 5. The default value is 1. """ @@ -214,20 +213,20 @@ class Count(with_metaclass(CaseInsensitiveEnumMeta, int, Enum)): THREE = 3 FIVE = 5 -class NetworkPlugin(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkPlugin(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Network plugin used for building Kubernetes network. """ AZURE = "azure" KUBENET = "kubenet" -class NetworkPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Network policy used for building Kubernetes network. """ CALICO = "calico" -class OSType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux. """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/models/_models_py3.py index 09ae71717b3b..c8a0bdf6f28d 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/models/_models_py3.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/models/_models_py3.py @@ -6,11 +6,13 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Dict, List, Optional, Union +from typing import Dict, List, Optional, TYPE_CHECKING, Union import msrest.serialization -from ._container_service_client_enums import * +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + import __init__ as _models class CloudErrorBody(msrest.serialization.Model): @@ -42,7 +44,7 @@ def __init__( code: Optional[str] = None, message: Optional[str] = None, target: Optional[str] = None, - details: Optional[List["CloudErrorBody"]] = None, + details: Optional[List["_models.CloudErrorBody"]] = None, **kwargs ): """ @@ -87,7 +89,7 @@ class ContainerServiceDiagnosticsProfile(msrest.serialization.Model): def __init__( self, *, - vm_diagnostics: "ContainerServiceVMDiagnostics", + vm_diagnostics: "_models.ContainerServiceVMDiagnostics", **kwargs ): """ @@ -125,7 +127,7 @@ def __init__( self, *, admin_username: str, - ssh: "ContainerServiceSshConfiguration", + ssh: "_models.ContainerServiceSshConfiguration", **kwargs ): """ @@ -148,17 +150,17 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar count: Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, - and 5. The default value is 1. Possible values include: 1, 3, 5. Default value: "1". + and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". :vartype count: int or ~azure.mgmt.containerservice.v2018_08_01_preview.models.Count :ivar dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. :vartype dns_prefix: str - :ivar vm_size: Required. Size of agent VMs. Possible values include: "Standard_A1", - "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", - "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", - "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", - "Standard_A8m_v2", "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", - "Standard_B8ms", "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", - "Standard_D12", "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", + :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", + "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", + "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", + "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", "Standard_B8ms", + "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", "Standard_D12", + "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", "Standard_D13_v2_Promo", "Standard_D14", "Standard_D14_v2", "Standard_D14_v2_Promo", "Standard_D15_v2", "Standard_D16_v3", "Standard_D16s_v3", "Standard_D1_v2", "Standard_D2", "Standard_D2_v2", "Standard_D2_v2_Promo", "Standard_D2_v3", "Standard_D2s_v3", "Standard_D3", @@ -203,7 +205,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): :vartype first_consecutive_static_ip: str :ivar storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Possible values include: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". :vartype storage_profile: str or ~azure.mgmt.containerservice.v2018_08_01_preview.models.ContainerServiceStorageProfileTypes :ivar fqdn: FQDN for the master pool. @@ -232,27 +234,27 @@ def __init__( self, *, dns_prefix: str, - vm_size: Union[str, "ContainerServiceVMSizeTypes"], - count: Optional[Union[int, "Count"]] = 1, + vm_size: Union[str, "_models.ContainerServiceVMSizeTypes"], + count: Optional[Union[int, "_models.Count"]] = 1, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, first_consecutive_static_ip: Optional[str] = "10.240.255.5", - storage_profile: Optional[Union[str, "ContainerServiceStorageProfileTypes"]] = None, + storage_profile: Optional[Union[str, "_models.ContainerServiceStorageProfileTypes"]] = None, **kwargs ): """ :keyword count: Number of masters (VMs) in the container service cluster. Allowed values are 1, - 3, and 5. The default value is 1. Possible values include: 1, 3, 5. Default value: "1". + 3, and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". :paramtype count: int or ~azure.mgmt.containerservice.v2018_08_01_preview.models.Count :keyword dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. :paramtype dns_prefix: str - :keyword vm_size: Required. Size of agent VMs. Possible values include: "Standard_A1", - "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", - "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", - "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", - "Standard_A8m_v2", "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", - "Standard_B8ms", "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", - "Standard_D12", "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", + :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", + "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", + "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", + "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", "Standard_B8ms", + "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", "Standard_D12", + "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", "Standard_D13_v2_Promo", "Standard_D14", "Standard_D14_v2", "Standard_D14_v2_Promo", "Standard_D15_v2", "Standard_D16_v3", "Standard_D16s_v3", "Standard_D1_v2", "Standard_D2", "Standard_D2_v2", "Standard_D2_v2_Promo", "Standard_D2_v3", "Standard_D2s_v3", "Standard_D3", @@ -297,7 +299,7 @@ def __init__( :paramtype first_consecutive_static_ip: str :keyword storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Possible values include: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". :paramtype storage_profile: str or ~azure.mgmt.containerservice.v2018_08_01_preview.models.ContainerServiceStorageProfileTypes """ @@ -315,12 +317,12 @@ def __init__( class ContainerServiceNetworkProfile(msrest.serialization.Model): """Profile of network configuration. - :ivar network_plugin: Network plugin used for building Kubernetes network. Possible values - include: "azure", "kubenet". Default value: "kubenet". + :ivar network_plugin: Network plugin used for building Kubernetes network. Known values are: + "azure", "kubenet". Default value: "kubenet". :vartype network_plugin: str or ~azure.mgmt.containerservice.v2018_08_01_preview.models.NetworkPlugin - :ivar network_policy: Network policy used for building Kubernetes network. Possible values - include: "calico". + :ivar network_policy: Network policy used for building Kubernetes network. Known values are: + "calico". :vartype network_policy: str or ~azure.mgmt.containerservice.v2018_08_01_preview.models.NetworkPolicy :ivar pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. @@ -355,8 +357,8 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): def __init__( self, *, - network_plugin: Optional[Union[str, "NetworkPlugin"]] = "kubenet", - network_policy: Optional[Union[str, "NetworkPolicy"]] = None, + network_plugin: Optional[Union[str, "_models.NetworkPlugin"]] = "kubenet", + network_policy: Optional[Union[str, "_models.NetworkPolicy"]] = None, pod_cidr: Optional[str] = "10.244.0.0/16", service_cidr: Optional[str] = "10.0.0.0/16", dns_service_ip: Optional[str] = "10.0.0.10", @@ -364,12 +366,12 @@ def __init__( **kwargs ): """ - :keyword network_plugin: Network plugin used for building Kubernetes network. Possible values - include: "azure", "kubenet". Default value: "kubenet". + :keyword network_plugin: Network plugin used for building Kubernetes network. Known values are: + "azure", "kubenet". Default value: "kubenet". :paramtype network_plugin: str or ~azure.mgmt.containerservice.v2018_08_01_preview.models.NetworkPlugin - :keyword network_policy: Network policy used for building Kubernetes network. Possible values - include: "calico". + :keyword network_policy: Network policy used for building Kubernetes network. Known values are: + "calico". :paramtype network_policy: str or ~azure.mgmt.containerservice.v2018_08_01_preview.models.NetworkPolicy :keyword pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. @@ -415,7 +417,7 @@ class ContainerServiceSshConfiguration(msrest.serialization.Model): def __init__( self, *, - public_keys: List["ContainerServiceSshPublicKey"], + public_keys: List["_models.ContainerServiceSshPublicKey"], **kwargs ): """ @@ -741,13 +743,13 @@ def __init__( tags: Optional[Dict[str, str]] = None, kubernetes_version: Optional[str] = None, dns_prefix: Optional[str] = None, - agent_pool_profiles: Optional[List["ManagedClusterAgentPoolProfile"]] = None, - linux_profile: Optional["ContainerServiceLinuxProfile"] = None, - service_principal_profile: Optional["ManagedClusterServicePrincipalProfile"] = None, - addon_profiles: Optional[Dict[str, "ManagedClusterAddonProfile"]] = None, + agent_pool_profiles: Optional[List["_models.ManagedClusterAgentPoolProfile"]] = None, + linux_profile: Optional["_models.ContainerServiceLinuxProfile"] = None, + service_principal_profile: Optional["_models.ManagedClusterServicePrincipalProfile"] = None, + addon_profiles: Optional[Dict[str, "_models.ManagedClusterAddonProfile"]] = None, enable_rbac: Optional[bool] = None, - network_profile: Optional["ContainerServiceNetworkProfile"] = None, - aad_profile: Optional["ManagedClusterAADProfile"] = None, + network_profile: Optional["_models.ContainerServiceNetworkProfile"] = None, + aad_profile: Optional["_models.ManagedClusterAADProfile"] = None, **kwargs ): """ @@ -957,13 +959,13 @@ class ManagedClusterAgentPoolProfile(msrest.serialization.Model): :ivar count: Required. Number of agents (VMs) 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: Required. Size of agent VMs. Possible values include: "Standard_A1", - "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", - "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", - "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", - "Standard_A8m_v2", "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", - "Standard_B8ms", "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", - "Standard_D12", "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", + :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", + "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", + "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", + "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", "Standard_B8ms", + "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", "Standard_D12", + "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", "Standard_D13_v2_Promo", "Standard_D14", "Standard_D14_v2", "Standard_D14_v2_Promo", "Standard_D15_v2", "Standard_D16_v3", "Standard_D16s_v3", "Standard_D1_v2", "Standard_D2", "Standard_D2_v2", "Standard_D2_v2_Promo", "Standard_D2_v3", "Standard_D2s_v3", "Standard_D3", @@ -1006,7 +1008,7 @@ class ManagedClusterAgentPoolProfile(msrest.serialization.Model): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2018_08_01_preview.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -1014,7 +1016,7 @@ class ManagedClusterAgentPoolProfile(msrest.serialization.Model): :vartype min_count: int :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool - :ivar type: AgentPoolType represents types of an agent pool. Possible values include: + :ivar type: AgentPoolType represents types of an agent pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2018_08_01_preview.models.AgentPoolType """ @@ -1045,15 +1047,15 @@ def __init__( *, name: str, count: int = 1, - vm_size: Union[str, "ContainerServiceVMSizeTypes"], + vm_size: Union[str, "_models.ContainerServiceVMSizeTypes"], os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - type: Optional[Union[str, "AgentPoolType"]] = None, + type: Optional[Union[str, "_models.AgentPoolType"]] = None, **kwargs ): """ @@ -1063,13 +1065,13 @@ def __init__( :keyword count: Required. Number of agents (VMs) 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: Required. Size of agent VMs. Possible values include: "Standard_A1", - "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", - "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", - "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", - "Standard_A8m_v2", "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", - "Standard_B8ms", "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", - "Standard_D12", "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", + :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", + "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", + "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", + "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", "Standard_B8ms", + "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", "Standard_D12", + "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", "Standard_D13_v2_Promo", "Standard_D14", "Standard_D14_v2", "Standard_D14_v2_Promo", "Standard_D15_v2", "Standard_D16_v3", "Standard_D16s_v3", "Standard_D1_v2", "Standard_D2", "Standard_D2_v2", "Standard_D2_v2_Promo", "Standard_D2_v3", "Standard_D2s_v3", "Standard_D3", @@ -1112,7 +1114,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2018_08_01_preview.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -1120,7 +1122,7 @@ def __init__( :paramtype min_count: int :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool - :keyword type: AgentPoolType represents types of an agent pool. Possible values include: + :keyword type: AgentPoolType represents types of an agent pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2018_08_01_preview.models.AgentPoolType """ @@ -1161,7 +1163,7 @@ class ManagedClusterListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["ManagedCluster"]] = None, + value: Optional[List["_models.ManagedCluster"]] = None, **kwargs ): """ @@ -1183,7 +1185,7 @@ class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): :ivar name: Pool name. :vartype name: str :ivar os_type: Required. OsType to be used to specify os type. Choose from Linux and Windows. - Default to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2018_08_01_preview.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: list[str] @@ -1205,7 +1207,7 @@ def __init__( self, *, kubernetes_version: str, - os_type: Union[str, "OSType"] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", name: Optional[str] = None, upgrades: Optional[List[str]] = None, **kwargs @@ -1216,7 +1218,7 @@ def __init__( :keyword name: Pool name. :paramtype name: str :keyword os_type: Required. OsType to be used to specify os type. Choose from Linux and - Windows. Default to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Windows. Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2018_08_01_preview.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: list[str] @@ -1307,8 +1309,8 @@ class ManagedClusterUpgradeProfile(msrest.serialization.Model): def __init__( self, *, - control_plane_profile: "ManagedClusterPoolUpgradeProfile", - agent_pool_profiles: List["ManagedClusterPoolUpgradeProfile"], + control_plane_profile: "_models.ManagedClusterPoolUpgradeProfile", + agent_pool_profiles: List["_models.ManagedClusterPoolUpgradeProfile"], **kwargs ): """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/models/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/models/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/operations/__init__.py index 77613c407d74..79c2682d6c29 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/operations/__init__.py @@ -9,7 +9,12 @@ from ._operations import Operations from ._managed_clusters_operations import ManagedClustersOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'Operations', 'ManagedClustersOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/operations/_managed_clusters_operations.py index da171d34ee62..c259496701bf 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/operations/_managed_clusters_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -33,9 +33,12 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2018-08-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters") path_format_arguments = { @@ -45,18 +48,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -66,9 +67,12 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2018-08-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters") # pylint: disable=line-too-long path_format_arguments = { @@ -79,18 +83,16 @@ def build_list_by_resource_group_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -101,9 +103,12 @@ def build_get_upgrade_profile_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2018-08-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default") # pylint: disable=line-too-long path_format_arguments = { @@ -115,18 +120,16 @@ def build_get_upgrade_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -138,9 +141,12 @@ def build_get_access_profile_request( role_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2018-08-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -153,18 +159,16 @@ def build_get_access_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -175,9 +179,12 @@ def build_list_cluster_admin_credentials_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2018-08-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -189,18 +196,16 @@ def build_list_cluster_admin_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -211,9 +216,12 @@ def build_list_cluster_user_credentials_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2018-08-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -225,18 +233,16 @@ def build_list_cluster_user_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -247,9 +253,12 @@ def build_get_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2018-08-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -261,18 +270,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -282,14 +289,17 @@ def build_create_or_update_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedCluster] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2018-08-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -301,20 +311,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -326,14 +334,17 @@ def build_update_tags_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.TagsObject] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2018-08-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -345,20 +356,18 @@ def build_update_tags_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -371,8 +380,9 @@ def build_delete_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2018-08-01-preview") # type: str + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -384,13 +394,12 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, + params=_params, **kwargs ) @@ -400,14 +409,17 @@ def build_reset_service_principal_profile_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedClusterServicePrincipalProfile] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2018-08-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile") # pylint: disable=line-too-long path_format_arguments = { @@ -419,20 +431,18 @@ def build_reset_service_principal_profile_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -444,14 +454,17 @@ def build_reset_aad_profile_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedClusterAADProfile] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2018-08-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile") # pylint: disable=line-too-long path_format_arguments = { @@ -463,52 +476,48 @@ def build_reset_aad_profile_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs ) -class ManagedClustersOperations(object): - """ManagedClustersOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ManagedClustersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2018_08_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2018_08_01_preview.ContainerServiceClient`'s + :attr:`managed_clusters` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> Iterable["_models.ManagedClusterListResult"]: + ) -> Iterable[_models.ManagedClusterListResult]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. The operation returns properties @@ -521,13 +530,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2018_08_01_preview.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2018-08-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -535,9 +547,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -545,9 +559,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -585,7 +601,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.ManagedClusterListResult"]: + ) -> Iterable[_models.ManagedClusterListResult]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. The operation returns @@ -600,13 +616,16 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2018_08_01_preview.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2018-08-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -615,9 +634,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -626,9 +647,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -667,7 +690,7 @@ def get_upgrade_profile( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedClusterUpgradeProfile": + ) -> _models.ManagedClusterUpgradeProfile: """Gets upgrade profile for a managed cluster. Gets the details of the upgrade profile for a managed cluster with a specified resource group @@ -682,13 +705,16 @@ def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2018_08_01_preview.models.ManagedClusterUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2018-08-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] request = build_get_upgrade_profile_request( @@ -697,11 +723,13 @@ def get_upgrade_profile( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -729,7 +757,7 @@ def get_access_profile( resource_name: str, role_name: str, **kwargs: Any - ) -> "_models.ManagedClusterAccessProfile": + ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. Gets the accessProfile for the specified role name of the managed cluster with a specified @@ -746,13 +774,16 @@ def get_access_profile( :rtype: ~azure.mgmt.containerservice.v2018_08_01_preview.models.ManagedClusterAccessProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterAccessProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2018-08-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] request = build_get_access_profile_request( @@ -762,11 +793,13 @@ def get_access_profile( role_name=role_name, api_version=api_version, template_url=self.get_access_profile.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -793,7 +826,7 @@ def list_cluster_admin_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster admin credential of a managed cluster. Gets cluster admin credential of the managed cluster with a specified resource group and name. @@ -807,13 +840,16 @@ def list_cluster_admin_credentials( :rtype: ~azure.mgmt.containerservice.v2018_08_01_preview.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2018-08-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_admin_credentials_request( @@ -822,11 +858,13 @@ def list_cluster_admin_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_admin_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -853,7 +891,7 @@ def list_cluster_user_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster user credential of a managed cluster. Gets cluster user credential of the managed cluster with a specified resource group and name. @@ -867,13 +905,16 @@ def list_cluster_user_credentials( :rtype: ~azure.mgmt.containerservice.v2018_08_01_preview.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2018-08-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_user_credentials_request( @@ -882,11 +923,13 @@ def list_cluster_user_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -913,7 +956,7 @@ def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedCluster": + ) -> _models.ManagedCluster: """Gets a managed cluster. Gets the details of the managed cluster with a specified resource group and name. @@ -927,13 +970,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2018_08_01_preview.models.ManagedCluster :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2018-08-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] request = build_get_request( @@ -942,11 +988,13 @@ def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -971,17 +1019,20 @@ def _create_or_update_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2018-08-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'ManagedCluster') @@ -993,11 +1044,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1027,9 +1080,9 @@ def begin_create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> LROPoller["_models.ManagedCluster"]: + ) -> LROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. Creates or updates a managed cluster with the specified configuration for agents and Kubernetes @@ -1055,37 +1108,47 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2018_08_01_preview.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2018-08-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1102,17 +1165,20 @@ def _update_tags_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2018-08-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'TagsObject') @@ -1124,11 +1190,13 @@ def _update_tags_initial( content_type=content_type, json=_json, template_url=self._update_tags_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1154,9 +1222,9 @@ def begin_update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> LROPoller["_models.ManagedCluster"]: + ) -> LROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates a managed cluster with the specified tags. @@ -1181,37 +1249,47 @@ def begin_update_tags( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2018_08_01_preview.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2018-08-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._update_tags_initial( + raw_result = self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1230,13 +1308,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2018-08-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -1245,11 +1326,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1293,20 +1376,25 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2018-08-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_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) @@ -1316,8 +1404,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1334,17 +1428,20 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2018-08-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') @@ -1356,11 +1453,13 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re content_type=content_type, json=_json, template_url=self._reset_service_principal_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1382,7 +1481,7 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> LROPoller[None]: """Reset Service Principal Profile of a managed cluster. @@ -1409,23 +1508,28 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2018-08-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._reset_service_principal_profile_initial( + raw_result = self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1435,8 +1539,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1453,17 +1563,20 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2018-08-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') @@ -1475,11 +1588,13 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement content_type=content_type, json=_json, template_url=self._reset_aad_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1501,7 +1616,7 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> LROPoller[None]: """Reset AAD Profile of a managed cluster. @@ -1528,23 +1643,28 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2018-08-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._reset_aad_profile_initial( + raw_result = self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1554,8 +1674,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/operations/_operations.py index ece0f9286c46..e89dac78f552 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/operations/_operations.py @@ -16,6 +16,7 @@ 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 @@ -29,55 +30,54 @@ def build_list_request( **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2018-08-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.ContainerService/operations") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class Operations(object): - """Operations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2018_08_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2018_08_01_preview.ContainerServiceClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> Iterable["_models.OperationListResult"]: + ) -> Iterable[_models.OperationListResult]: """Gets a list of compute operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -86,31 +86,38 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2018_08_01_preview.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2018-08-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-08-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_08_01_preview/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/__init__.py index 53c675bd95e2..37a5f9e02e6f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._container_service_client import ContainerServiceClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['ContainerServiceClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/_container_service_client.py index 6bb9a87c53ee..f5ad4edbd724 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/_container_service_client.py @@ -56,7 +56,9 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.open_shift_managed_clusters = OpenShiftManagedClustersOperations(self._client, self._config, self._serialize, self._deserialize) + self.open_shift_managed_clusters = OpenShiftManagedClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/aio/__init__.py index 53c675bd95e2..37a5f9e02e6f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/aio/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/aio/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._container_service_client import ContainerServiceClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['ContainerServiceClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/aio/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/aio/_container_service_client.py index b1cdc25a9bdc..a71c11f3d010 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/aio/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/aio/_container_service_client.py @@ -56,7 +56,9 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.open_shift_managed_clusters = OpenShiftManagedClustersOperations(self._client, self._config, self._serialize, self._deserialize) + self.open_shift_managed_clusters = OpenShiftManagedClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/aio/operations/__init__.py index 45d890441cd5..211a87879804 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/aio/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/aio/operations/__init__.py @@ -8,6 +8,11 @@ from ._open_shift_managed_clusters_operations import OpenShiftManagedClustersOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'OpenShiftManagedClustersOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/aio/operations/_open_shift_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/aio/operations/_open_shift_managed_clusters_operations.py index 57f7accb83d2..9504f0d209a4 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/aio/operations/_open_shift_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/aio/operations/_open_shift_managed_clusters_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. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ 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 @@ -26,32 +27,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class OpenShiftManagedClustersOperations: - """OpenShiftManagedClustersOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2018_09_30_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2018_09_30_preview.aio.ContainerServiceClient`'s + :attr:`open_shift_managed_clusters` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.OpenShiftManagedClusterListResult"]: + ) -> AsyncIterable[_models.OpenShiftManagedClusterListResult]: """Gets a list of OpenShift managed clusters in the specified subscription. Gets a list of OpenShift managed clusters in the specified subscription. The operation returns @@ -64,13 +63,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2018_09_30_preview.models.OpenShiftManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2018-09-30-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-09-30-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OpenShiftManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -78,9 +80,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -88,9 +92,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -128,7 +134,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.OpenShiftManagedClusterListResult"]: + ) -> AsyncIterable[_models.OpenShiftManagedClusterListResult]: """Lists OpenShift managed clusters in the specified subscription and resource group. Lists OpenShift managed clusters in the specified subscription and resource group. The @@ -143,13 +149,16 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2018_09_30_preview.models.OpenShiftManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2018-09-30-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-09-30-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OpenShiftManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -158,9 +167,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -169,9 +180,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -210,7 +223,7 @@ async def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.OpenShiftManagedCluster": + ) -> _models.OpenShiftManagedCluster: """Gets a OpenShift managed cluster. Gets the details of the managed OpenShift cluster with a specified resource group and name. @@ -224,13 +237,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2018_09_30_preview.models.OpenShiftManagedCluster :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OpenShiftManagedCluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2018-09-30-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-09-30-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedCluster] request = build_get_request( @@ -239,11 +255,13 @@ async def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -268,17 +286,20 @@ async def _create_or_update_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.OpenShiftManagedCluster", + parameters: _models.OpenShiftManagedCluster, **kwargs: Any - ) -> "_models.OpenShiftManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.OpenShiftManagedCluster"] + ) -> _models.OpenShiftManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2018-09-30-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-09-30-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedCluster] _json = self._serialize.body(parameters, 'OpenShiftManagedCluster') @@ -290,11 +311,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -324,9 +347,9 @@ async def begin_create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.OpenShiftManagedCluster", + parameters: _models.OpenShiftManagedCluster, **kwargs: Any - ) -> AsyncLROPoller["_models.OpenShiftManagedCluster"]: + ) -> AsyncLROPoller[_models.OpenShiftManagedCluster]: """Creates or updates an OpenShift managed cluster. Creates or updates a OpenShift managed cluster with the specified configuration for agents and @@ -354,37 +377,47 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2018_09_30_preview.models.OpenShiftManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2018-09-30-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-09-30-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OpenShiftManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('OpenShiftManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -401,17 +434,20 @@ async def _update_tags_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.OpenShiftManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.OpenShiftManagedCluster"] + ) -> _models.OpenShiftManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2018-09-30-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-09-30-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedCluster] _json = self._serialize.body(parameters, 'TagsObject') @@ -423,11 +459,13 @@ async def _update_tags_initial( content_type=content_type, json=_json, template_url=self._update_tags_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -453,9 +491,9 @@ async def begin_update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> AsyncLROPoller["_models.OpenShiftManagedCluster"]: + ) -> AsyncLROPoller[_models.OpenShiftManagedCluster]: """Updates tags on an OpenShift managed cluster. Updates an OpenShift managed cluster with the specified tags. @@ -480,37 +518,47 @@ async def begin_update_tags( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2018_09_30_preview.models.OpenShiftManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2018-09-30-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-09-30-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OpenShiftManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._update_tags_initial( + raw_result = await self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('OpenShiftManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -529,13 +577,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2018-09-30-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-09-30-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -544,11 +595,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -592,20 +645,25 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2018-09-30-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-09-30-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_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) @@ -615,8 +673,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/aio/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/aio/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/models/__init__.py index 35292467d6d1..421ce777c259 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/models/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/models/__init__.py @@ -27,7 +27,9 @@ OpenShiftAgentPoolProfileRole, OpenShiftContainerServiceVMSize, ) - +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'CloudErrorBody', 'NetworkProfile', @@ -47,3 +49,5 @@ 'OpenShiftAgentPoolProfileRole', 'OpenShiftContainerServiceVMSize', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/models/_container_service_client_enums.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/models/_container_service_client_enums.py index 9cff02877c35..6c64f62d0661 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/models/_container_service_client_enums.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/models/_container_service_client_enums.py @@ -7,18 +7,17 @@ # -------------------------------------------------------------------------- from enum import Enum -from six import with_metaclass from azure.core import CaseInsensitiveEnumMeta -class OpenShiftAgentPoolProfileRole(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OpenShiftAgentPoolProfileRole(str, Enum, metaclass=CaseInsensitiveEnumMeta): """OpenShiftAgentPoolProfileRole represents the role of the AgentPoolProfile. """ COMPUTE = "compute" INFRA = "infra" -class OpenShiftContainerServiceVMSize(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OpenShiftContainerServiceVMSize(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Size of OpenShift VMs. """ @@ -56,7 +55,7 @@ class OpenShiftContainerServiceVMSize(with_metaclass(CaseInsensitiveEnumMeta, st STANDARD_L16_S = "Standard_L16s" STANDARD_L32_S = "Standard_L32s" -class OSType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux. """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/models/_models_py3.py index 3fe2805c341a..d12307412946 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/models/_models_py3.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/models/_models_py3.py @@ -6,11 +6,13 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Dict, List, Optional, Union +from typing import Dict, List, Optional, TYPE_CHECKING, Union import msrest.serialization -from ._container_service_client_enums import * +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + import __init__ as _models class CloudErrorBody(msrest.serialization.Model): @@ -42,7 +44,7 @@ def __init__( code: Optional[str] = None, message: Optional[str] = None, target: Optional[str] = None, - details: Optional[List["CloudErrorBody"]] = None, + details: Optional[List["_models.CloudErrorBody"]] = None, **kwargs ): """ @@ -229,15 +231,15 @@ def __init__( *, location: str, tags: Optional[Dict[str, str]] = None, - plan: Optional["PurchasePlan"] = None, + plan: Optional["_models.PurchasePlan"] = None, open_shift_version: Optional[str] = None, public_hostname: Optional[str] = None, fqdn: Optional[str] = None, - network_profile: Optional["NetworkProfile"] = None, - router_profiles: Optional[List["OpenShiftRouterProfile"]] = None, - master_pool_profile: Optional["OpenShiftManagedClusterMasterPoolProfile"] = None, - agent_pool_profiles: Optional[List["OpenShiftManagedClusterAgentPoolProfile"]] = None, - auth_profile: Optional["OpenShiftManagedClusterAuthProfile"] = None, + network_profile: Optional["_models.NetworkProfile"] = None, + router_profiles: Optional[List["_models.OpenShiftRouterProfile"]] = None, + master_pool_profile: Optional["_models.OpenShiftManagedClusterMasterPoolProfile"] = None, + agent_pool_profiles: Optional[List["_models.OpenShiftManagedClusterAgentPoolProfile"]] = None, + auth_profile: Optional["_models.OpenShiftManagedClusterAuthProfile"] = None, **kwargs ): """ @@ -382,7 +384,7 @@ class OpenShiftManagedClusterAgentPoolProfile(msrest.serialization.Model): :vartype name: str :ivar count: Required. Number of agents (VMs) to host docker containers. :vartype count: int - :ivar vm_size: Required. Size of agent VMs. Possible values include: "Standard_D2s_v3", + :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_D2s_v3", "Standard_D4s_v3", "Standard_D8s_v3", "Standard_D16s_v3", "Standard_D32s_v3", "Standard_D64s_v3", "Standard_DS4_v2", "Standard_DS5_v2", "Standard_F8s_v2", "Standard_F16s_v2", "Standard_F32s_v2", "Standard_F64s_v2", "Standard_F72s_v2", "Standard_F8s", @@ -395,10 +397,9 @@ class OpenShiftManagedClusterAgentPoolProfile(msrest.serialization.Model): :ivar subnet_cidr: Subnet CIDR for the peering. :vartype subnet_cidr: str :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2018_09_30_preview.models.OSType - :ivar role: Define the role of the AgentPoolProfile. Possible values include: "compute", - "infra". + :ivar role: Define the role of the AgentPoolProfile. Known values are: "compute", "infra". :vartype role: str or ~azure.mgmt.containerservice.v2018_09_30_preview.models.OpenShiftAgentPoolProfileRole """ @@ -423,10 +424,10 @@ def __init__( *, name: str, count: int, - vm_size: Union[str, "OpenShiftContainerServiceVMSize"], + vm_size: Union[str, "_models.OpenShiftContainerServiceVMSize"], subnet_cidr: Optional[str] = "10.0.0.0/24", - os_type: Optional[Union[str, "OSType"]] = "Linux", - role: Optional[Union[str, "OpenShiftAgentPoolProfileRole"]] = None, + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + role: Optional[Union[str, "_models.OpenShiftAgentPoolProfileRole"]] = None, **kwargs ): """ @@ -435,7 +436,7 @@ def __init__( :paramtype name: str :keyword count: Required. Number of agents (VMs) to host docker containers. :paramtype count: int - :keyword vm_size: Required. Size of agent VMs. Possible values include: "Standard_D2s_v3", + :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_D2s_v3", "Standard_D4s_v3", "Standard_D8s_v3", "Standard_D16s_v3", "Standard_D32s_v3", "Standard_D64s_v3", "Standard_DS4_v2", "Standard_DS5_v2", "Standard_F8s_v2", "Standard_F16s_v2", "Standard_F32s_v2", "Standard_F64s_v2", "Standard_F72s_v2", "Standard_F8s", @@ -448,10 +449,9 @@ def __init__( :keyword subnet_cidr: Subnet CIDR for the peering. :paramtype subnet_cidr: str :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2018_09_30_preview.models.OSType - :keyword role: Define the role of the AgentPoolProfile. Possible values include: "compute", - "infra". + :keyword role: Define the role of the AgentPoolProfile. Known values are: "compute", "infra". :paramtype role: str or ~azure.mgmt.containerservice.v2018_09_30_preview.models.OpenShiftAgentPoolProfileRole """ @@ -479,7 +479,7 @@ class OpenShiftManagedClusterAuthProfile(msrest.serialization.Model): def __init__( self, *, - identity_providers: Optional[List["OpenShiftManagedClusterIdentityProvider"]] = None, + identity_providers: Optional[List["_models.OpenShiftManagedClusterIdentityProvider"]] = None, **kwargs ): """ @@ -510,7 +510,7 @@ def __init__( self, *, name: Optional[str] = None, - provider: Optional["OpenShiftManagedClusterBaseIdentityProvider"] = None, + provider: Optional["_models.OpenShiftManagedClusterBaseIdentityProvider"] = None, **kwargs ): """ @@ -549,7 +549,7 @@ class OpenShiftManagedClusterListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["OpenShiftManagedCluster"]] = None, + value: Optional[List["_models.OpenShiftManagedCluster"]] = None, **kwargs ): """ @@ -573,7 +573,7 @@ class OpenShiftManagedClusterMasterPoolProfile(msrest.serialization.Model): :ivar count: Required. Number of masters (VMs) to host docker containers. The default value is 3. :vartype count: int - :ivar vm_size: Required. Size of agent VMs. Possible values include: "Standard_D2s_v3", + :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_D2s_v3", "Standard_D4s_v3", "Standard_D8s_v3", "Standard_D16s_v3", "Standard_D32s_v3", "Standard_D64s_v3", "Standard_DS4_v2", "Standard_DS5_v2", "Standard_F8s_v2", "Standard_F16s_v2", "Standard_F32s_v2", "Standard_F64s_v2", "Standard_F72s_v2", "Standard_F8s", @@ -586,7 +586,7 @@ class OpenShiftManagedClusterMasterPoolProfile(msrest.serialization.Model): :ivar subnet_cidr: Subnet CIDR for the peering. :vartype subnet_cidr: str :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2018_09_30_preview.models.OSType """ @@ -607,10 +607,10 @@ def __init__( self, *, count: int, - vm_size: Union[str, "OpenShiftContainerServiceVMSize"], + vm_size: Union[str, "_models.OpenShiftContainerServiceVMSize"], name: Optional[str] = None, subnet_cidr: Optional[str] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", **kwargs ): """ @@ -620,7 +620,7 @@ def __init__( :keyword count: Required. Number of masters (VMs) to host docker containers. The default value is 3. :paramtype count: int - :keyword vm_size: Required. Size of agent VMs. Possible values include: "Standard_D2s_v3", + :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_D2s_v3", "Standard_D4s_v3", "Standard_D8s_v3", "Standard_D16s_v3", "Standard_D32s_v3", "Standard_D64s_v3", "Standard_DS4_v2", "Standard_DS5_v2", "Standard_F8s_v2", "Standard_F16s_v2", "Standard_F32s_v2", "Standard_F64s_v2", "Standard_F72s_v2", "Standard_F8s", @@ -633,7 +633,7 @@ def __init__( :keyword subnet_cidr: Subnet CIDR for the peering. :paramtype subnet_cidr: str :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2018_09_30_preview.models.OSType """ super(OpenShiftManagedClusterMasterPoolProfile, self).__init__(**kwargs) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/models/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/models/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/operations/__init__.py index 45d890441cd5..211a87879804 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/operations/__init__.py @@ -8,6 +8,11 @@ from ._open_shift_managed_clusters_operations import OpenShiftManagedClustersOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'OpenShiftManagedClustersOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/operations/_open_shift_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/operations/_open_shift_managed_clusters_operations.py index c67e3fe4873a..ed6e6e435ab6 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/operations/_open_shift_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/operations/_open_shift_managed_clusters_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -33,9 +33,12 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2018-09-30-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-09-30-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/openShiftManagedClusters") # pylint: disable=line-too-long path_format_arguments = { @@ -45,18 +48,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -66,9 +67,12 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2018-09-30-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-09-30-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters") # pylint: disable=line-too-long path_format_arguments = { @@ -79,18 +83,16 @@ def build_list_by_resource_group_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -101,9 +103,12 @@ def build_get_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2018-09-30-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-09-30-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -115,18 +120,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -136,14 +139,17 @@ def build_create_or_update_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.OpenShiftManagedCluster] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2018-09-30-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-09-30-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -155,20 +161,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -180,14 +184,17 @@ def build_update_tags_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.TagsObject] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2018-09-30-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-09-30-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -199,20 +206,18 @@ def build_update_tags_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -225,9 +230,12 @@ def build_delete_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2018-09-30-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-09-30-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -239,48 +247,44 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class OpenShiftManagedClustersOperations(object): - """OpenShiftManagedClustersOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class OpenShiftManagedClustersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2018_09_30_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2018_09_30_preview.ContainerServiceClient`'s + :attr:`open_shift_managed_clusters` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> Iterable["_models.OpenShiftManagedClusterListResult"]: + ) -> Iterable[_models.OpenShiftManagedClusterListResult]: """Gets a list of OpenShift managed clusters in the specified subscription. Gets a list of OpenShift managed clusters in the specified subscription. The operation returns @@ -293,13 +297,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2018_09_30_preview.models.OpenShiftManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2018-09-30-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-09-30-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OpenShiftManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -307,9 +314,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -317,9 +326,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -357,7 +368,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.OpenShiftManagedClusterListResult"]: + ) -> Iterable[_models.OpenShiftManagedClusterListResult]: """Lists OpenShift managed clusters in the specified subscription and resource group. Lists OpenShift managed clusters in the specified subscription and resource group. The @@ -372,13 +383,16 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2018_09_30_preview.models.OpenShiftManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2018-09-30-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-09-30-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OpenShiftManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -387,9 +401,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -398,9 +414,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -439,7 +457,7 @@ def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.OpenShiftManagedCluster": + ) -> _models.OpenShiftManagedCluster: """Gets a OpenShift managed cluster. Gets the details of the managed OpenShift cluster with a specified resource group and name. @@ -453,13 +471,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2018_09_30_preview.models.OpenShiftManagedCluster :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OpenShiftManagedCluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2018-09-30-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-09-30-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedCluster] request = build_get_request( @@ -468,11 +489,13 @@ def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -497,17 +520,20 @@ def _create_or_update_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.OpenShiftManagedCluster", + parameters: _models.OpenShiftManagedCluster, **kwargs: Any - ) -> "_models.OpenShiftManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.OpenShiftManagedCluster"] + ) -> _models.OpenShiftManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2018-09-30-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-09-30-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedCluster] _json = self._serialize.body(parameters, 'OpenShiftManagedCluster') @@ -519,11 +545,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -553,9 +581,9 @@ def begin_create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.OpenShiftManagedCluster", + parameters: _models.OpenShiftManagedCluster, **kwargs: Any - ) -> LROPoller["_models.OpenShiftManagedCluster"]: + ) -> LROPoller[_models.OpenShiftManagedCluster]: """Creates or updates an OpenShift managed cluster. Creates or updates a OpenShift managed cluster with the specified configuration for agents and @@ -583,37 +611,47 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2018_09_30_preview.models.OpenShiftManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2018-09-30-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-09-30-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OpenShiftManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('OpenShiftManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -630,17 +668,20 @@ def _update_tags_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.OpenShiftManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.OpenShiftManagedCluster"] + ) -> _models.OpenShiftManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2018-09-30-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-09-30-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedCluster] _json = self._serialize.body(parameters, 'TagsObject') @@ -652,11 +693,13 @@ def _update_tags_initial( content_type=content_type, json=_json, template_url=self._update_tags_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -682,9 +725,9 @@ def begin_update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> LROPoller["_models.OpenShiftManagedCluster"]: + ) -> LROPoller[_models.OpenShiftManagedCluster]: """Updates tags on an OpenShift managed cluster. Updates an OpenShift managed cluster with the specified tags. @@ -709,37 +752,47 @@ def begin_update_tags( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2018_09_30_preview.models.OpenShiftManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2018-09-30-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-09-30-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OpenShiftManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._update_tags_initial( + raw_result = self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('OpenShiftManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -758,13 +811,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2018-09-30-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-09-30-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -773,11 +829,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -821,20 +879,25 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2018-09-30-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-09-30-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_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) @@ -844,8 +907,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2018_09_30_preview/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/__init__.py index 53c675bd95e2..37a5f9e02e6f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._container_service_client import ContainerServiceClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['ContainerServiceClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/_container_service_client.py index 39a0402fe123..f5c7b03bc284 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/_container_service_client.py @@ -60,9 +60,15 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.managed_clusters = ManagedClustersOperations(self._client, self._config, self._serialize, self._deserialize) - self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_clusters = ManagedClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.agent_pools = AgentPoolsOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/aio/__init__.py index 53c675bd95e2..37a5f9e02e6f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/aio/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/aio/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._container_service_client import ContainerServiceClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['ContainerServiceClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/aio/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/aio/_container_service_client.py index bdca43019bbf..dc20a61d1d5e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/aio/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/aio/_container_service_client.py @@ -61,9 +61,15 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.managed_clusters = ManagedClustersOperations(self._client, self._config, self._serialize, self._deserialize) - self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_clusters = ManagedClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.agent_pools = AgentPoolsOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/aio/operations/__init__.py index 5aac40228eec..403c0174f052 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/aio/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/aio/operations/__init__.py @@ -10,8 +10,13 @@ from ._managed_clusters_operations import ManagedClustersOperations from ._agent_pools_operations import AgentPoolsOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'Operations', 'ManagedClustersOperations', 'AgentPoolsOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/aio/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/aio/operations/_agent_pools_operations.py index 8fb4d4e191c1..bd0017dc9f1f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/aio/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/aio/operations/_agent_pools_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. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ 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 @@ -26,26 +27,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class AgentPoolsOperations: - """AgentPoolsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2019_02_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2019_02_01.aio.ContainerServiceClient`'s + :attr:`agent_pools` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -53,7 +52,7 @@ def list( resource_group_name: str, managed_cluster_name: str, **kwargs: Any - ) -> AsyncIterable["_models.AgentPoolListResult"]: + ) -> AsyncIterable[_models.AgentPoolListResult]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. The operation returns properties @@ -69,13 +68,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2019_02_01.models.AgentPoolListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -85,9 +87,11 @@ def prepare_request(next_link=None): managed_cluster_name=managed_cluster_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -97,9 +101,11 @@ def prepare_request(next_link=None): managed_cluster_name=managed_cluster_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -139,7 +145,7 @@ async def get( managed_cluster_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPool": + ) -> _models.AgentPool: """Gets the agent pool. Gets the details of the agent pool by managed cluster and resource group. @@ -155,13 +161,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2019_02_01.models.AgentPool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-02-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] request = build_get_request( @@ -171,11 +180,13 @@ async def get( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -201,17 +212,20 @@ async def _create_or_update_initial( resource_group_name: str, managed_cluster_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> "_models.AgentPool": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] + ) -> _models.AgentPool: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2019-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] _json = self._serialize.body(parameters, 'AgentPool') @@ -224,11 +238,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -259,9 +275,9 @@ async def begin_create_or_update( resource_group_name: str, managed_cluster_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> AsyncLROPoller["_models.AgentPool"]: + ) -> AsyncLROPoller[_models.AgentPool]: """Creates or updates an agent pool. Creates or updates an agent pool in the specified managed cluster. @@ -288,17 +304,20 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_02_01.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, managed_cluster_name=managed_cluster_name, agent_pool_name=agent_pool_name, @@ -306,20 +325,27 @@ async def begin_create_or_update( 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): - response = pipeline_response.http_response deserialized = self._deserialize('AgentPool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -339,13 +365,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements agent_pool_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2019-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -355,11 +384,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -406,21 +437,26 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-02-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, managed_cluster_name=managed_cluster_name, 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) @@ -430,8 +466,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/aio/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/aio/operations/_managed_clusters_operations.py index 04533adca394..97ebd3ac6231 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/aio/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/aio/operations/_managed_clusters_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. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ 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 @@ -26,32 +27,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ManagedClustersOperations: - """ManagedClustersOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2019_02_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2019_02_01.aio.ContainerServiceClient`'s + :attr:`managed_clusters` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.ManagedClusterListResult"]: + ) -> AsyncIterable[_models.ManagedClusterListResult]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. The operation returns properties @@ -64,13 +63,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2019_02_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -78,9 +80,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -88,9 +92,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -128,7 +134,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ManagedClusterListResult"]: + ) -> AsyncIterable[_models.ManagedClusterListResult]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. The operation returns @@ -143,13 +149,16 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2019_02_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -158,9 +167,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -169,9 +180,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -210,7 +223,7 @@ async def get_upgrade_profile( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedClusterUpgradeProfile": + ) -> _models.ManagedClusterUpgradeProfile: """Gets upgrade profile for a managed cluster. Gets the details of the upgrade profile for a managed cluster with a specified resource group @@ -225,13 +238,16 @@ async def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2019_02_01.models.ManagedClusterUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-02-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] request = build_get_upgrade_profile_request( @@ -240,11 +256,13 @@ async def get_upgrade_profile( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -272,7 +290,7 @@ async def get_access_profile( resource_name: str, role_name: str, **kwargs: Any - ) -> "_models.ManagedClusterAccessProfile": + ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. Gets the accessProfile for the specified role name of the managed cluster with a specified @@ -289,13 +307,16 @@ async def get_access_profile( :rtype: ~azure.mgmt.containerservice.v2019_02_01.models.ManagedClusterAccessProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterAccessProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-02-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] request = build_get_access_profile_request( @@ -305,11 +326,13 @@ async def get_access_profile( role_name=role_name, api_version=api_version, template_url=self.get_access_profile.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -336,7 +359,7 @@ async def list_cluster_admin_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster admin credential of a managed cluster. Gets cluster admin credential of the managed cluster with a specified resource group and name. @@ -350,13 +373,16 @@ async def list_cluster_admin_credentials( :rtype: ~azure.mgmt.containerservice.v2019_02_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2019-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_admin_credentials_request( @@ -365,11 +391,13 @@ async def list_cluster_admin_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_admin_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -396,7 +424,7 @@ async def list_cluster_user_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster user credential of a managed cluster. Gets cluster user credential of the managed cluster with a specified resource group and name. @@ -410,13 +438,16 @@ async def list_cluster_user_credentials( :rtype: ~azure.mgmt.containerservice.v2019_02_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-02-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_user_credentials_request( @@ -425,11 +456,13 @@ async def list_cluster_user_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -456,7 +489,7 @@ async def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedCluster": + ) -> _models.ManagedCluster: """Gets a managed cluster. Gets the details of the managed cluster with a specified resource group and name. @@ -470,13 +503,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2019_02_01.models.ManagedCluster :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-02-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] request = build_get_request( @@ -485,11 +521,13 @@ async def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -514,17 +552,20 @@ async def _create_or_update_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2019-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'ManagedCluster') @@ -536,11 +577,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -570,9 +613,9 @@ async def begin_create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> AsyncLROPoller["_models.ManagedCluster"]: + ) -> AsyncLROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. Creates or updates a managed cluster with the specified configuration for agents and Kubernetes @@ -598,37 +641,47 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_02_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -645,17 +698,20 @@ async def _update_tags_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2019-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'TagsObject') @@ -667,11 +723,13 @@ async def _update_tags_initial( content_type=content_type, json=_json, template_url=self._update_tags_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -697,9 +755,9 @@ async def begin_update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> AsyncLROPoller["_models.ManagedCluster"]: + ) -> AsyncLROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates a managed cluster with the specified tags. @@ -724,37 +782,47 @@ async def begin_update_tags( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_02_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._update_tags_initial( + raw_result = await self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -773,13 +841,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-02-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -788,11 +859,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -836,20 +909,25 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-02-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_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) @@ -859,8 +937,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -877,17 +961,20 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2019-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') @@ -899,11 +986,13 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist content_type=content_type, json=_json, template_url=self._reset_service_principal_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -925,7 +1014,7 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> AsyncLROPoller[None]: """Reset Service Principal Profile of a managed cluster. @@ -952,23 +1041,28 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._reset_service_principal_profile_initial( + raw_result = await self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -978,8 +1072,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -996,17 +1096,20 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2019-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') @@ -1018,11 +1121,13 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta content_type=content_type, json=_json, template_url=self._reset_aad_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1044,7 +1149,7 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> AsyncLROPoller[None]: """Reset AAD Profile of a managed cluster. @@ -1070,23 +1175,28 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._reset_aad_profile_initial( + raw_result = await self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1096,8 +1206,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/aio/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/aio/operations/_operations.py index c9408d7a4c13..33ab55379820 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/aio/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/aio/operations/_operations.py @@ -14,6 +14,7 @@ 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 @@ -23,32 +24,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class Operations: - """Operations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2019_02_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2019_02_01.aio.ContainerServiceClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.OperationListResult"]: + ) -> AsyncIterable[_models.OperationListResult]: """Gets a list of compute operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -57,31 +56,38 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2019_02_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/aio/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/aio/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/models/__init__.py index 438187c21681..5ff60eebf8ec 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/models/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/models/__init__.py @@ -46,7 +46,9 @@ NetworkPolicy, OSType, ) - +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'AgentPool', 'AgentPoolListResult', @@ -85,3 +87,5 @@ 'NetworkPolicy', 'OSType', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/models/_container_service_client_enums.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/models/_container_service_client_enums.py index 1791a5baa2a6..2fec0b6f593f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/models/_container_service_client_enums.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/models/_container_service_client_enums.py @@ -7,11 +7,10 @@ # -------------------------------------------------------------------------- from enum import Enum -from six import with_metaclass from azure.core import CaseInsensitiveEnumMeta -class AgentPoolType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class AgentPoolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """AgentPoolType represents types of an agent pool. VirtualMachineScaleSets type is still in PREVIEW. """ @@ -19,7 +18,7 @@ class AgentPoolType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): VIRTUAL_MACHINE_SCALE_SETS = "VirtualMachineScaleSets" AVAILABILITY_SET = "AvailabilitySet" -class ContainerServiceStorageProfileTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the orchestrator choice. """ @@ -27,7 +26,7 @@ class ContainerServiceStorageProfileTypes(with_metaclass(CaseInsensitiveEnumMeta STORAGE_ACCOUNT = "StorageAccount" MANAGED_DISKS = "ManagedDisks" -class ContainerServiceVMSizeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Size of agent VMs. """ @@ -206,7 +205,7 @@ class ContainerServiceVMSizeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, E STANDARD_NV24 = "Standard_NV24" STANDARD_NV6 = "Standard_NV6" -class Count(with_metaclass(CaseInsensitiveEnumMeta, int, Enum)): +class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): """Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, and 5. The default value is 1. """ @@ -215,21 +214,21 @@ class Count(with_metaclass(CaseInsensitiveEnumMeta, int, Enum)): THREE = 3 FIVE = 5 -class NetworkPlugin(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkPlugin(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Network plugin used for building Kubernetes network. """ AZURE = "azure" KUBENET = "kubenet" -class NetworkPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Network policy used for building Kubernetes network. """ CALICO = "calico" AZURE = "azure" -class OSType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux. """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/models/_models_py3.py index ed2f6d738f38..da614ecc9d39 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/models/_models_py3.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/models/_models_py3.py @@ -6,11 +6,13 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Dict, List, Optional, Union +from typing import Dict, List, Optional, TYPE_CHECKING, Union import msrest.serialization -from ._container_service_client_enums import * +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + import __init__ as _models class SubResource(msrest.serialization.Model): @@ -66,7 +68,7 @@ class AgentPool(SubResource): :ivar count: Number of agents (VMs) 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: Size of agent VMs. Possible values include: "Standard_A1", "Standard_A10", + :ivar vm_size: Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -115,7 +117,7 @@ class AgentPool(SubResource): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2019_02_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -123,8 +125,8 @@ class AgentPool(SubResource): :vartype min_count: int :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool - :ivar type_properties_type: AgentPoolType represents types of an agent pool. Possible values - include: "VirtualMachineScaleSets", "AvailabilitySet". + :ivar type_properties_type: AgentPoolType represents types of an agent pool. Known values are: + "VirtualMachineScaleSets", "AvailabilitySet". :vartype type_properties_type: str or ~azure.mgmt.containerservice.v2019_02_01.models.AgentPoolType :ivar orchestrator_version: Version of orchestrator specified when creating the managed @@ -170,15 +172,15 @@ def __init__( self, *, count: Optional[int] = 1, - vm_size: Optional[Union[str, "ContainerServiceVMSizeTypes"]] = None, + vm_size: Optional[Union[str, "_models.ContainerServiceVMSizeTypes"]] = None, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - type_properties_type: Optional[Union[str, "AgentPoolType"]] = None, + type_properties_type: Optional[Union[str, "_models.AgentPoolType"]] = None, orchestrator_version: Optional[str] = None, availability_zones: Optional[List[str]] = None, **kwargs @@ -187,7 +189,7 @@ def __init__( :keyword count: Number of agents (VMs) 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: Size of agent VMs. Possible values include: "Standard_A1", "Standard_A10", + :keyword vm_size: Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -236,7 +238,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2019_02_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -244,8 +246,8 @@ def __init__( :paramtype min_count: int :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool - :keyword type_properties_type: AgentPoolType represents types of an agent pool. Possible values - include: "VirtualMachineScaleSets", "AvailabilitySet". + :keyword type_properties_type: AgentPoolType represents types of an agent pool. Known values + are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type_properties_type: str or ~azure.mgmt.containerservice.v2019_02_01.models.AgentPoolType :keyword orchestrator_version: Version of orchestrator specified when creating the managed @@ -294,7 +296,7 @@ class AgentPoolListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["AgentPool"]] = None, + value: Optional[List["_models.AgentPool"]] = None, **kwargs ): """ @@ -335,7 +337,7 @@ def __init__( code: Optional[str] = None, message: Optional[str] = None, target: Optional[str] = None, - details: Optional[List["CloudErrorBody"]] = None, + details: Optional[List["_models.CloudErrorBody"]] = None, **kwargs ): """ @@ -379,7 +381,7 @@ class ContainerServiceDiagnosticsProfile(msrest.serialization.Model): def __init__( self, *, - vm_diagnostics: "ContainerServiceVMDiagnostics", + vm_diagnostics: "_models.ContainerServiceVMDiagnostics", **kwargs ): """ @@ -416,7 +418,7 @@ def __init__( self, *, admin_username: str, - ssh: "ContainerServiceSshConfiguration", + ssh: "_models.ContainerServiceSshConfiguration", **kwargs ): """ @@ -439,17 +441,17 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar count: Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, - and 5. The default value is 1. Possible values include: 1, 3, 5. Default value: "1". + and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". :vartype count: int or ~azure.mgmt.containerservice.v2019_02_01.models.Count :ivar dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. :vartype dns_prefix: str - :ivar vm_size: Required. Size of agent VMs. Possible values include: "Standard_A1", - "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", - "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", - "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", - "Standard_A8m_v2", "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", - "Standard_B8ms", "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", - "Standard_D12", "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", + :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", + "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", + "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", + "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", "Standard_B8ms", + "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", "Standard_D12", + "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", "Standard_D13_v2_Promo", "Standard_D14", "Standard_D14_v2", "Standard_D14_v2_Promo", "Standard_D15_v2", "Standard_D16_v3", "Standard_D16s_v3", "Standard_D1_v2", "Standard_D2", "Standard_D2_v2", "Standard_D2_v2_Promo", "Standard_D2_v3", "Standard_D2s_v3", "Standard_D3", @@ -494,7 +496,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): :vartype first_consecutive_static_ip: str :ivar storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Possible values include: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". :vartype storage_profile: str or ~azure.mgmt.containerservice.v2019_02_01.models.ContainerServiceStorageProfileTypes :ivar fqdn: FQDN for the master pool. @@ -523,27 +525,27 @@ def __init__( self, *, dns_prefix: str, - vm_size: Union[str, "ContainerServiceVMSizeTypes"], - count: Optional[Union[int, "Count"]] = 1, + vm_size: Union[str, "_models.ContainerServiceVMSizeTypes"], + count: Optional[Union[int, "_models.Count"]] = 1, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, first_consecutive_static_ip: Optional[str] = "10.240.255.5", - storage_profile: Optional[Union[str, "ContainerServiceStorageProfileTypes"]] = None, + storage_profile: Optional[Union[str, "_models.ContainerServiceStorageProfileTypes"]] = None, **kwargs ): """ :keyword count: Number of masters (VMs) in the container service cluster. Allowed values are 1, - 3, and 5. The default value is 1. Possible values include: 1, 3, 5. Default value: "1". + 3, and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". :paramtype count: int or ~azure.mgmt.containerservice.v2019_02_01.models.Count :keyword dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. :paramtype dns_prefix: str - :keyword vm_size: Required. Size of agent VMs. Possible values include: "Standard_A1", - "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", - "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", - "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", - "Standard_A8m_v2", "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", - "Standard_B8ms", "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", - "Standard_D12", "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", + :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", + "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", + "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", + "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", "Standard_B8ms", + "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", "Standard_D12", + "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", "Standard_D13_v2_Promo", "Standard_D14", "Standard_D14_v2", "Standard_D14_v2_Promo", "Standard_D15_v2", "Standard_D16_v3", "Standard_D16s_v3", "Standard_D1_v2", "Standard_D2", "Standard_D2_v2", "Standard_D2_v2_Promo", "Standard_D2_v3", "Standard_D2s_v3", "Standard_D3", @@ -588,7 +590,7 @@ def __init__( :paramtype first_consecutive_static_ip: str :keyword storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Possible values include: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". :paramtype storage_profile: str or ~azure.mgmt.containerservice.v2019_02_01.models.ContainerServiceStorageProfileTypes """ @@ -606,11 +608,11 @@ def __init__( class ContainerServiceNetworkProfile(msrest.serialization.Model): """Profile of network configuration. - :ivar network_plugin: Network plugin used for building Kubernetes network. Possible values - include: "azure", "kubenet". Default value: "kubenet". + :ivar network_plugin: Network plugin used for building Kubernetes network. Known values are: + "azure", "kubenet". Default value: "kubenet". :vartype network_plugin: str or ~azure.mgmt.containerservice.v2019_02_01.models.NetworkPlugin - :ivar network_policy: Network policy used for building Kubernetes network. Possible values - include: "calico", "azure". + :ivar network_policy: Network policy used for building Kubernetes network. Known values are: + "calico", "azure". :vartype network_policy: str or ~azure.mgmt.containerservice.v2019_02_01.models.NetworkPolicy :ivar pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :vartype pod_cidr: str @@ -644,8 +646,8 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): def __init__( self, *, - network_plugin: Optional[Union[str, "NetworkPlugin"]] = "kubenet", - network_policy: Optional[Union[str, "NetworkPolicy"]] = None, + network_plugin: Optional[Union[str, "_models.NetworkPlugin"]] = "kubenet", + network_policy: Optional[Union[str, "_models.NetworkPolicy"]] = None, pod_cidr: Optional[str] = "10.244.0.0/16", service_cidr: Optional[str] = "10.0.0.0/16", dns_service_ip: Optional[str] = "10.0.0.10", @@ -653,11 +655,11 @@ def __init__( **kwargs ): """ - :keyword network_plugin: Network plugin used for building Kubernetes network. Possible values - include: "azure", "kubenet". Default value: "kubenet". + :keyword network_plugin: Network plugin used for building Kubernetes network. Known values are: + "azure", "kubenet". Default value: "kubenet". :paramtype network_plugin: str or ~azure.mgmt.containerservice.v2019_02_01.models.NetworkPlugin - :keyword network_policy: Network policy used for building Kubernetes network. Possible values - include: "calico", "azure". + :keyword network_policy: Network policy used for building Kubernetes network. Known values are: + "calico", "azure". :paramtype network_policy: str or ~azure.mgmt.containerservice.v2019_02_01.models.NetworkPolicy :keyword pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :paramtype pod_cidr: str @@ -702,7 +704,7 @@ class ContainerServiceSshConfiguration(msrest.serialization.Model): def __init__( self, *, - public_keys: List["ContainerServiceSshPublicKey"], + public_keys: List["_models.ContainerServiceSshPublicKey"], **kwargs ): """ @@ -1034,14 +1036,14 @@ def __init__( tags: Optional[Dict[str, str]] = None, kubernetes_version: Optional[str] = None, dns_prefix: Optional[str] = None, - agent_pool_profiles: Optional[List["ManagedClusterAgentPoolProfile"]] = None, - linux_profile: Optional["ContainerServiceLinuxProfile"] = None, - service_principal_profile: Optional["ManagedClusterServicePrincipalProfile"] = None, - addon_profiles: Optional[Dict[str, "ManagedClusterAddonProfile"]] = None, + agent_pool_profiles: Optional[List["_models.ManagedClusterAgentPoolProfile"]] = None, + linux_profile: Optional["_models.ContainerServiceLinuxProfile"] = None, + service_principal_profile: Optional["_models.ManagedClusterServicePrincipalProfile"] = None, + addon_profiles: Optional[Dict[str, "_models.ManagedClusterAddonProfile"]] = None, enable_rbac: Optional[bool] = None, enable_pod_security_policy: Optional[bool] = None, - network_profile: Optional["ContainerServiceNetworkProfile"] = None, - aad_profile: Optional["ManagedClusterAADProfile"] = None, + network_profile: Optional["_models.ContainerServiceNetworkProfile"] = None, + aad_profile: Optional["_models.ManagedClusterAADProfile"] = None, api_server_authorized_ip_ranges: Optional[List[str]] = None, **kwargs ): @@ -1260,13 +1262,13 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar count: Required. Number of agents (VMs) 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: Required. Size of agent VMs. Possible values include: "Standard_A1", - "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", - "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", - "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", - "Standard_A8m_v2", "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", - "Standard_B8ms", "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", - "Standard_D12", "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", + :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", + "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", + "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", + "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", "Standard_B8ms", + "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", "Standard_D12", + "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", "Standard_D13_v2_Promo", "Standard_D14", "Standard_D14_v2", "Standard_D14_v2_Promo", "Standard_D15_v2", "Standard_D16_v3", "Standard_D16s_v3", "Standard_D1_v2", "Standard_D2", "Standard_D2_v2", "Standard_D2_v2_Promo", "Standard_D2_v3", "Standard_D2s_v3", "Standard_D3", @@ -1309,7 +1311,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2019_02_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -1317,7 +1319,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :vartype min_count: int :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool - :ivar type: AgentPoolType represents types of an agent pool. Possible values include: + :ivar type: AgentPoolType represents types of an agent pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2019_02_01.models.AgentPoolType :ivar orchestrator_version: Version of orchestrator specified when creating the managed @@ -1358,15 +1360,15 @@ def __init__( self, *, count: int = 1, - vm_size: Union[str, "ContainerServiceVMSizeTypes"], + vm_size: Union[str, "_models.ContainerServiceVMSizeTypes"], os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - type: Optional[Union[str, "AgentPoolType"]] = None, + type: Optional[Union[str, "_models.AgentPoolType"]] = None, orchestrator_version: Optional[str] = None, availability_zones: Optional[List[str]] = None, **kwargs @@ -1375,13 +1377,13 @@ def __init__( :keyword count: Required. Number of agents (VMs) 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: Required. Size of agent VMs. Possible values include: "Standard_A1", - "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", - "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", - "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", - "Standard_A8m_v2", "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", - "Standard_B8ms", "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", - "Standard_D12", "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", + :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", + "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", + "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", + "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", "Standard_B8ms", + "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", "Standard_D12", + "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", "Standard_D13_v2_Promo", "Standard_D14", "Standard_D14_v2", "Standard_D14_v2_Promo", "Standard_D15_v2", "Standard_D16_v3", "Standard_D16s_v3", "Standard_D1_v2", "Standard_D2", "Standard_D2_v2", "Standard_D2_v2_Promo", "Standard_D2_v3", "Standard_D2s_v3", "Standard_D3", @@ -1424,7 +1426,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2019_02_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -1432,7 +1434,7 @@ def __init__( :paramtype min_count: int :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool - :keyword type: AgentPoolType represents types of an agent pool. Possible values include: + :keyword type: AgentPoolType represents types of an agent pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2019_02_01.models.AgentPoolType :keyword orchestrator_version: Version of orchestrator specified when creating the managed @@ -1468,13 +1470,13 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar count: Required. Number of agents (VMs) 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: Required. Size of agent VMs. Possible values include: "Standard_A1", - "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", - "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", - "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", - "Standard_A8m_v2", "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", - "Standard_B8ms", "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", - "Standard_D12", "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", + :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", + "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", + "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", + "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", "Standard_B8ms", + "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", "Standard_D12", + "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", "Standard_D13_v2_Promo", "Standard_D14", "Standard_D14_v2", "Standard_D14_v2_Promo", "Standard_D15_v2", "Standard_D16_v3", "Standard_D16s_v3", "Standard_D1_v2", "Standard_D2", "Standard_D2_v2", "Standard_D2_v2_Promo", "Standard_D2_v3", "Standard_D2s_v3", "Standard_D3", @@ -1517,7 +1519,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2019_02_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -1525,7 +1527,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :vartype min_count: int :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool - :ivar type: AgentPoolType represents types of an agent pool. Possible values include: + :ivar type: AgentPoolType represents types of an agent pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2019_02_01.models.AgentPoolType :ivar orchestrator_version: Version of orchestrator specified when creating the managed @@ -1571,16 +1573,16 @@ def __init__( self, *, count: int = 1, - vm_size: Union[str, "ContainerServiceVMSizeTypes"], + vm_size: Union[str, "_models.ContainerServiceVMSizeTypes"], name: str, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - type: Optional[Union[str, "AgentPoolType"]] = None, + type: Optional[Union[str, "_models.AgentPoolType"]] = None, orchestrator_version: Optional[str] = None, availability_zones: Optional[List[str]] = None, **kwargs @@ -1589,13 +1591,13 @@ def __init__( :keyword count: Required. Number of agents (VMs) 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: Required. Size of agent VMs. Possible values include: "Standard_A1", - "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", - "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", - "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", - "Standard_A8m_v2", "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", - "Standard_B8ms", "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", - "Standard_D12", "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", + :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", + "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", + "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", + "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", "Standard_B8ms", + "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", "Standard_D12", + "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", "Standard_D13_v2_Promo", "Standard_D14", "Standard_D14_v2", "Standard_D14_v2_Promo", "Standard_D15_v2", "Standard_D16_v3", "Standard_D16s_v3", "Standard_D1_v2", "Standard_D2", "Standard_D2_v2", "Standard_D2_v2_Promo", "Standard_D2_v3", "Standard_D2s_v3", "Standard_D3", @@ -1638,7 +1640,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2019_02_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -1646,7 +1648,7 @@ def __init__( :paramtype min_count: int :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool - :keyword type: AgentPoolType represents types of an agent pool. Possible values include: + :keyword type: AgentPoolType represents types of an agent pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2019_02_01.models.AgentPoolType :keyword orchestrator_version: Version of orchestrator specified when creating the managed @@ -1686,7 +1688,7 @@ class ManagedClusterListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["ManagedCluster"]] = None, + value: Optional[List["_models.ManagedCluster"]] = None, **kwargs ): """ @@ -1708,7 +1710,7 @@ class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): :ivar name: Pool name. :vartype name: str :ivar os_type: Required. OsType to be used to specify os type. Choose from Linux and Windows. - Default to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2019_02_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: list[str] @@ -1730,7 +1732,7 @@ def __init__( self, *, kubernetes_version: str, - os_type: Union[str, "OSType"] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", name: Optional[str] = None, upgrades: Optional[List[str]] = None, **kwargs @@ -1741,7 +1743,7 @@ def __init__( :keyword name: Pool name. :paramtype name: str :keyword os_type: Required. OsType to be used to specify os type. Choose from Linux and - Windows. Default to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Windows. Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2019_02_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: list[str] @@ -1832,8 +1834,8 @@ class ManagedClusterUpgradeProfile(msrest.serialization.Model): def __init__( self, *, - control_plane_profile: "ManagedClusterPoolUpgradeProfile", - agent_pool_profiles: List["ManagedClusterPoolUpgradeProfile"], + control_plane_profile: "_models.ManagedClusterPoolUpgradeProfile", + agent_pool_profiles: List["_models.ManagedClusterPoolUpgradeProfile"], **kwargs ): """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/models/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/models/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/operations/__init__.py index 5aac40228eec..403c0174f052 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/operations/__init__.py @@ -10,8 +10,13 @@ from ._managed_clusters_operations import ManagedClustersOperations from ._agent_pools_operations import AgentPoolsOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'Operations', 'ManagedClustersOperations', 'AgentPoolsOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/operations/_agent_pools_operations.py index 35989f81ecd3..afd7a6264cee 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/operations/_agent_pools_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -35,9 +35,12 @@ def build_list_request( managed_cluster_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{managedClusterName}/agentPools") # pylint: disable=line-too-long path_format_arguments = { @@ -49,18 +52,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -72,9 +73,12 @@ def build_get_request( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{managedClusterName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -87,18 +91,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -109,14 +111,17 @@ def build_create_or_update_request_initial( managed_cluster_name: str, agent_pool_name: str, *, - json: JSONType = None, + json: Optional[_models.AgentPool] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-02-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{managedClusterName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -129,20 +134,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -156,9 +159,12 @@ def build_delete_request_initial( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{managedClusterName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -171,42 +177,38 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class AgentPoolsOperations(object): - """AgentPoolsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class AgentPoolsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2019_02_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2019_02_01.ContainerServiceClient`'s + :attr:`agent_pools` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -214,7 +216,7 @@ def list( resource_group_name: str, managed_cluster_name: str, **kwargs: Any - ) -> Iterable["_models.AgentPoolListResult"]: + ) -> Iterable[_models.AgentPoolListResult]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. The operation returns properties @@ -230,13 +232,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2019_02_01.models.AgentPoolListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -246,9 +251,11 @@ def prepare_request(next_link=None): managed_cluster_name=managed_cluster_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -258,9 +265,11 @@ def prepare_request(next_link=None): managed_cluster_name=managed_cluster_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -300,7 +309,7 @@ def get( managed_cluster_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPool": + ) -> _models.AgentPool: """Gets the agent pool. Gets the details of the agent pool by managed cluster and resource group. @@ -316,13 +325,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2019_02_01.models.AgentPool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-02-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] request = build_get_request( @@ -332,11 +344,13 @@ def get( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -362,17 +376,20 @@ def _create_or_update_initial( resource_group_name: str, managed_cluster_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> "_models.AgentPool": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] + ) -> _models.AgentPool: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2019-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] _json = self._serialize.body(parameters, 'AgentPool') @@ -385,11 +402,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -420,9 +439,9 @@ def begin_create_or_update( resource_group_name: str, managed_cluster_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> LROPoller["_models.AgentPool"]: + ) -> LROPoller[_models.AgentPool]: """Creates or updates an agent pool. Creates or updates an agent pool in the specified managed cluster. @@ -448,17 +467,20 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_02_01.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, managed_cluster_name=managed_cluster_name, agent_pool_name=agent_pool_name, @@ -466,20 +488,27 @@ def begin_create_or_update( 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): - response = pipeline_response.http_response deserialized = self._deserialize('AgentPool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -499,13 +528,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements agent_pool_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-02-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -515,11 +547,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -566,21 +600,26 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-02-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, managed_cluster_name=managed_cluster_name, 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) @@ -590,8 +629,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/operations/_managed_clusters_operations.py index 071e179f81c2..47dd44a44974 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/operations/_managed_clusters_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -33,9 +33,12 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters") path_format_arguments = { @@ -45,18 +48,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -66,9 +67,12 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters") # pylint: disable=line-too-long path_format_arguments = { @@ -79,18 +83,16 @@ def build_list_by_resource_group_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -101,9 +103,12 @@ def build_get_upgrade_profile_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default") # pylint: disable=line-too-long path_format_arguments = { @@ -115,18 +120,16 @@ def build_get_upgrade_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -138,9 +141,12 @@ def build_get_access_profile_request( role_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -153,18 +159,16 @@ def build_get_access_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -175,9 +179,12 @@ def build_list_cluster_admin_credentials_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -189,18 +196,16 @@ def build_list_cluster_admin_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -211,9 +216,12 @@ def build_list_cluster_user_credentials_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -225,18 +233,16 @@ def build_list_cluster_user_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -247,9 +253,12 @@ def build_get_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -261,18 +270,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -282,14 +289,17 @@ def build_create_or_update_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedCluster] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-02-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -301,20 +311,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -326,14 +334,17 @@ def build_update_tags_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.TagsObject] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-02-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -345,20 +356,18 @@ def build_update_tags_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -371,9 +380,12 @@ def build_delete_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -385,18 +397,16 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -406,14 +416,17 @@ def build_reset_service_principal_profile_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedClusterServicePrincipalProfile] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-02-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile") # pylint: disable=line-too-long path_format_arguments = { @@ -425,20 +438,18 @@ def build_reset_service_principal_profile_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -450,14 +461,17 @@ def build_reset_aad_profile_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedClusterAADProfile] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-02-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile") # pylint: disable=line-too-long path_format_arguments = { @@ -469,52 +483,48 @@ def build_reset_aad_profile_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs ) -class ManagedClustersOperations(object): - """ManagedClustersOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ManagedClustersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2019_02_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2019_02_01.ContainerServiceClient`'s + :attr:`managed_clusters` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> Iterable["_models.ManagedClusterListResult"]: + ) -> Iterable[_models.ManagedClusterListResult]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. The operation returns properties @@ -527,13 +537,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2019_02_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -541,9 +554,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -551,9 +566,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -591,7 +608,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.ManagedClusterListResult"]: + ) -> Iterable[_models.ManagedClusterListResult]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. The operation returns @@ -606,13 +623,16 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2019_02_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -621,9 +641,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -632,9 +654,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -673,7 +697,7 @@ def get_upgrade_profile( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedClusterUpgradeProfile": + ) -> _models.ManagedClusterUpgradeProfile: """Gets upgrade profile for a managed cluster. Gets the details of the upgrade profile for a managed cluster with a specified resource group @@ -688,13 +712,16 @@ def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2019_02_01.models.ManagedClusterUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-02-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] request = build_get_upgrade_profile_request( @@ -703,11 +730,13 @@ def get_upgrade_profile( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -735,7 +764,7 @@ def get_access_profile( resource_name: str, role_name: str, **kwargs: Any - ) -> "_models.ManagedClusterAccessProfile": + ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. Gets the accessProfile for the specified role name of the managed cluster with a specified @@ -752,13 +781,16 @@ def get_access_profile( :rtype: ~azure.mgmt.containerservice.v2019_02_01.models.ManagedClusterAccessProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterAccessProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2019-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] request = build_get_access_profile_request( @@ -768,11 +800,13 @@ def get_access_profile( role_name=role_name, api_version=api_version, template_url=self.get_access_profile.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -799,7 +833,7 @@ def list_cluster_admin_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster admin credential of a managed cluster. Gets cluster admin credential of the managed cluster with a specified resource group and name. @@ -813,13 +847,16 @@ def list_cluster_admin_credentials( :rtype: ~azure.mgmt.containerservice.v2019_02_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-02-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_admin_credentials_request( @@ -828,11 +865,13 @@ def list_cluster_admin_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_admin_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -859,7 +898,7 @@ def list_cluster_user_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster user credential of a managed cluster. Gets cluster user credential of the managed cluster with a specified resource group and name. @@ -873,13 +912,16 @@ def list_cluster_user_credentials( :rtype: ~azure.mgmt.containerservice.v2019_02_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2019-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_user_credentials_request( @@ -888,11 +930,13 @@ def list_cluster_user_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -919,7 +963,7 @@ def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedCluster": + ) -> _models.ManagedCluster: """Gets a managed cluster. Gets the details of the managed cluster with a specified resource group and name. @@ -933,13 +977,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2019_02_01.models.ManagedCluster :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-02-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] request = build_get_request( @@ -948,11 +995,13 @@ def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -977,17 +1026,20 @@ def _create_or_update_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2019-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'ManagedCluster') @@ -999,11 +1051,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1033,9 +1087,9 @@ def begin_create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> LROPoller["_models.ManagedCluster"]: + ) -> LROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. Creates or updates a managed cluster with the specified configuration for agents and Kubernetes @@ -1061,37 +1115,47 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_02_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1108,17 +1172,20 @@ def _update_tags_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2019-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'TagsObject') @@ -1130,11 +1197,13 @@ def _update_tags_initial( content_type=content_type, json=_json, template_url=self._update_tags_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1160,9 +1229,9 @@ def begin_update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> LROPoller["_models.ManagedCluster"]: + ) -> LROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates a managed cluster with the specified tags. @@ -1187,37 +1256,47 @@ def begin_update_tags( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_02_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._update_tags_initial( + raw_result = self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1236,13 +1315,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2019-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -1251,11 +1333,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1299,20 +1383,25 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-02-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_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) @@ -1322,8 +1411,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1340,17 +1435,20 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2019-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') @@ -1362,11 +1460,13 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re content_type=content_type, json=_json, template_url=self._reset_service_principal_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1388,7 +1488,7 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> LROPoller[None]: """Reset Service Principal Profile of a managed cluster. @@ -1415,23 +1515,28 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._reset_service_principal_profile_initial( + raw_result = self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1441,8 +1546,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1459,17 +1570,20 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2019-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') @@ -1481,11 +1595,13 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement content_type=content_type, json=_json, template_url=self._reset_aad_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1507,7 +1623,7 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> LROPoller[None]: """Reset AAD Profile of a managed cluster. @@ -1533,23 +1649,28 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._reset_aad_profile_initial( + raw_result = self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1559,8 +1680,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/operations/_operations.py index bbada23db5b5..e39e3d0c3338 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/operations/_operations.py @@ -16,6 +16,7 @@ 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 @@ -29,55 +30,54 @@ def build_list_request( **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.ContainerService/operations") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class Operations(object): - """Operations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2019_02_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2019_02_01.ContainerServiceClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> Iterable["_models.OperationListResult"]: + ) -> Iterable[_models.OperationListResult]: """Gets a list of compute operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -86,31 +86,38 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2019_02_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_02_01/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/__init__.py index 53c675bd95e2..37a5f9e02e6f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._container_service_client import ContainerServiceClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['ContainerServiceClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/_container_service_client.py index 90532a7c5b65..01844ee0d562 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/_container_service_client.py @@ -60,9 +60,15 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.managed_clusters = ManagedClustersOperations(self._client, self._config, self._serialize, self._deserialize) - self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_clusters = ManagedClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.agent_pools = AgentPoolsOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/aio/__init__.py index 53c675bd95e2..37a5f9e02e6f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/aio/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/aio/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._container_service_client import ContainerServiceClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['ContainerServiceClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/aio/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/aio/_container_service_client.py index 6410da9a8784..fcff601fd1aa 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/aio/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/aio/_container_service_client.py @@ -61,9 +61,15 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.managed_clusters = ManagedClustersOperations(self._client, self._config, self._serialize, self._deserialize) - self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_clusters = ManagedClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.agent_pools = AgentPoolsOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/aio/operations/__init__.py index 5aac40228eec..403c0174f052 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/aio/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/aio/operations/__init__.py @@ -10,8 +10,13 @@ from ._managed_clusters_operations import ManagedClustersOperations from ._agent_pools_operations import AgentPoolsOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'Operations', 'ManagedClustersOperations', 'AgentPoolsOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/aio/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/aio/operations/_agent_pools_operations.py index f5d1c1630d6b..013a2731f890 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/aio/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/aio/operations/_agent_pools_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. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ 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 @@ -26,26 +27,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class AgentPoolsOperations: - """AgentPoolsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2019_04_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2019_04_01.aio.ContainerServiceClient`'s + :attr:`agent_pools` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -53,7 +52,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> AsyncIterable["_models.AgentPoolListResult"]: + ) -> AsyncIterable[_models.AgentPoolListResult]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. The operation returns properties @@ -69,13 +68,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2019_04_01.models.AgentPoolListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-04-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -85,9 +87,11 @@ def prepare_request(next_link=None): resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -97,9 +101,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -139,7 +145,7 @@ async def get( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPool": + ) -> _models.AgentPool: """Gets the agent pool. Gets the details of the agent pool by managed cluster and resource group. @@ -155,13 +161,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2019_04_01.models.AgentPool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-04-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] request = build_get_request( @@ -171,11 +180,13 @@ async def get( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -201,17 +212,20 @@ async def _create_or_update_initial( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> "_models.AgentPool": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] + ) -> _models.AgentPool: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2019-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] _json = self._serialize.body(parameters, 'AgentPool') @@ -224,11 +238,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -259,9 +275,9 @@ async def begin_create_or_update( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> AsyncLROPoller["_models.AgentPool"]: + ) -> AsyncLROPoller[_models.AgentPool]: """Creates or updates an agent pool. Creates or updates an agent pool in the specified managed cluster. @@ -288,17 +304,20 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_04_01.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, @@ -306,20 +325,27 @@ async def begin_create_or_update( 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): - response = pipeline_response.http_response deserialized = self._deserialize('AgentPool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -339,13 +365,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements agent_pool_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2019-04-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -355,11 +384,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -406,21 +437,26 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-04-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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) @@ -430,8 +466,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/aio/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/aio/operations/_managed_clusters_operations.py index 67e532feaaf4..58979d33fc14 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/aio/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/aio/operations/_managed_clusters_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. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ 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 @@ -26,32 +27,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ManagedClustersOperations: - """ManagedClustersOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2019_04_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2019_04_01.aio.ContainerServiceClient`'s + :attr:`managed_clusters` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.ManagedClusterListResult"]: + ) -> AsyncIterable[_models.ManagedClusterListResult]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. The operation returns properties @@ -64,13 +63,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2019_04_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-04-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -78,9 +80,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -88,9 +92,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -128,7 +134,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ManagedClusterListResult"]: + ) -> AsyncIterable[_models.ManagedClusterListResult]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. The operation returns @@ -143,13 +149,16 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2019_04_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-04-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -158,9 +167,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -169,9 +180,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -210,7 +223,7 @@ async def get_upgrade_profile( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedClusterUpgradeProfile": + ) -> _models.ManagedClusterUpgradeProfile: """Gets upgrade profile for a managed cluster. Gets the details of the upgrade profile for a managed cluster with a specified resource group @@ -225,13 +238,16 @@ async def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2019_04_01.models.ManagedClusterUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-04-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] request = build_get_upgrade_profile_request( @@ -240,11 +256,13 @@ async def get_upgrade_profile( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -272,7 +290,7 @@ async def get_access_profile( resource_name: str, role_name: str, **kwargs: Any - ) -> "_models.ManagedClusterAccessProfile": + ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. Gets the accessProfile for the specified role name of the managed cluster with a specified @@ -289,13 +307,16 @@ async def get_access_profile( :rtype: ~azure.mgmt.containerservice.v2019_04_01.models.ManagedClusterAccessProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterAccessProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-04-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] request = build_get_access_profile_request( @@ -305,11 +326,13 @@ async def get_access_profile( role_name=role_name, api_version=api_version, template_url=self.get_access_profile.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -336,7 +359,7 @@ async def list_cluster_admin_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster admin credential of a managed cluster. Gets cluster admin credential of the managed cluster with a specified resource group and name. @@ -350,13 +373,16 @@ async def list_cluster_admin_credentials( :rtype: ~azure.mgmt.containerservice.v2019_04_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2019-04-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_admin_credentials_request( @@ -365,11 +391,13 @@ async def list_cluster_admin_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_admin_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -396,7 +424,7 @@ async def list_cluster_user_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster user credential of a managed cluster. Gets cluster user credential of the managed cluster with a specified resource group and name. @@ -410,13 +438,16 @@ async def list_cluster_user_credentials( :rtype: ~azure.mgmt.containerservice.v2019_04_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-04-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_user_credentials_request( @@ -425,11 +456,13 @@ async def list_cluster_user_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -456,7 +489,7 @@ async def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedCluster": + ) -> _models.ManagedCluster: """Gets a managed cluster. Gets the details of the managed cluster with a specified resource group and name. @@ -470,13 +503,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2019_04_01.models.ManagedCluster :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-04-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] request = build_get_request( @@ -485,11 +521,13 @@ async def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -514,17 +552,20 @@ async def _create_or_update_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2019-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'ManagedCluster') @@ -536,11 +577,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -570,9 +613,9 @@ async def begin_create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> AsyncLROPoller["_models.ManagedCluster"]: + ) -> AsyncLROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. Creates or updates a managed cluster with the specified configuration for agents and Kubernetes @@ -598,37 +641,47 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_04_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -645,17 +698,20 @@ async def _update_tags_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2019-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'TagsObject') @@ -667,11 +723,13 @@ async def _update_tags_initial( content_type=content_type, json=_json, template_url=self._update_tags_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -697,9 +755,9 @@ async def begin_update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> AsyncLROPoller["_models.ManagedCluster"]: + ) -> AsyncLROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates a managed cluster with the specified tags. @@ -724,37 +782,47 @@ async def begin_update_tags( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_04_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._update_tags_initial( + raw_result = await self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -773,13 +841,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-04-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -788,11 +859,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -836,20 +909,25 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-04-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_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) @@ -859,8 +937,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -877,17 +961,20 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2019-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') @@ -899,11 +986,13 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist content_type=content_type, json=_json, template_url=self._reset_service_principal_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -925,7 +1014,7 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> AsyncLROPoller[None]: """Reset Service Principal Profile of a managed cluster. @@ -952,23 +1041,28 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._reset_service_principal_profile_initial( + raw_result = await self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -978,8 +1072,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -996,17 +1096,20 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2019-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') @@ -1018,11 +1121,13 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta content_type=content_type, json=_json, template_url=self._reset_aad_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1044,7 +1149,7 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> AsyncLROPoller[None]: """Reset AAD Profile of a managed cluster. @@ -1070,23 +1175,28 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._reset_aad_profile_initial( + raw_result = await self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1096,8 +1206,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/aio/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/aio/operations/_operations.py index 14d566cb830f..f76846b4a72a 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/aio/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/aio/operations/_operations.py @@ -14,6 +14,7 @@ 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 @@ -23,32 +24,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class Operations: - """Operations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2019_04_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2019_04_01.aio.ContainerServiceClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.OperationListResult"]: + ) -> AsyncIterable[_models.OperationListResult]: """Gets a list of compute operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -57,31 +56,38 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2019_04_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-04-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/aio/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/aio/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/models/__init__.py index c690fe9d4ec5..182b437fa9da 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/models/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/models/__init__.py @@ -49,7 +49,9 @@ OSType, ResourceIdentityType, ) - +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'AgentPool', 'AgentPoolListResult', @@ -91,3 +93,5 @@ 'OSType', 'ResourceIdentityType', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/models/_container_service_client_enums.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/models/_container_service_client_enums.py index f6c3f83be327..0c1e2a74caef 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/models/_container_service_client_enums.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/models/_container_service_client_enums.py @@ -7,11 +7,10 @@ # -------------------------------------------------------------------------- from enum import Enum -from six import with_metaclass from azure.core import CaseInsensitiveEnumMeta -class AgentPoolType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class AgentPoolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """AgentPoolType represents types of an agent pool. VirtualMachineScaleSets type is still in PREVIEW. """ @@ -19,7 +18,7 @@ class AgentPoolType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): VIRTUAL_MACHINE_SCALE_SETS = "VirtualMachineScaleSets" AVAILABILITY_SET = "AvailabilitySet" -class ContainerServiceStorageProfileTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the orchestrator choice. """ @@ -27,7 +26,7 @@ class ContainerServiceStorageProfileTypes(with_metaclass(CaseInsensitiveEnumMeta STORAGE_ACCOUNT = "StorageAccount" MANAGED_DISKS = "ManagedDisks" -class ContainerServiceVMSizeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Size of agent VMs. """ @@ -206,7 +205,7 @@ class ContainerServiceVMSizeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, E STANDARD_NV24 = "Standard_NV24" STANDARD_NV6 = "Standard_NV6" -class Count(with_metaclass(CaseInsensitiveEnumMeta, int, Enum)): +class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): """Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, and 5. The default value is 1. """ @@ -215,35 +214,35 @@ class Count(with_metaclass(CaseInsensitiveEnumMeta, int, Enum)): THREE = 3 FIVE = 5 -class LoadBalancerSku(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class LoadBalancerSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The load balancer sku for the managed cluster. """ STANDARD = "standard" BASIC = "basic" -class NetworkPlugin(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkPlugin(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Network plugin used for building Kubernetes network. """ AZURE = "azure" KUBENET = "kubenet" -class NetworkPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Network policy used for building Kubernetes network. """ CALICO = "calico" AZURE = "azure" -class OSType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux. """ LINUX = "Linux" WINDOWS = "Windows" -class ResourceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ resource group in agent nodes. Type 'None' will not use MSI for the managed cluster, service diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/models/_models_py3.py index 42ce0f45c59b..1ae97789a100 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/models/_models_py3.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/models/_models_py3.py @@ -6,11 +6,13 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Dict, List, Optional, Union +from typing import Dict, List, Optional, TYPE_CHECKING, Union import msrest.serialization -from ._container_service_client_enums import * +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + import __init__ as _models class SubResource(msrest.serialization.Model): @@ -66,7 +68,7 @@ class AgentPool(SubResource): :ivar count: Number of agents (VMs) 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: Size of agent VMs. Possible values include: "Standard_A1", "Standard_A10", + :ivar vm_size: Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -115,7 +117,7 @@ class AgentPool(SubResource): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2019_04_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -123,8 +125,8 @@ class AgentPool(SubResource): :vartype min_count: int :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool - :ivar type_properties_type: AgentPoolType represents types of an agent pool. Possible values - include: "VirtualMachineScaleSets", "AvailabilitySet". + :ivar type_properties_type: AgentPoolType represents types of an agent pool. Known values are: + "VirtualMachineScaleSets", "AvailabilitySet". :vartype type_properties_type: str or ~azure.mgmt.containerservice.v2019_04_01.models.AgentPoolType :ivar orchestrator_version: Version of orchestrator specified when creating the managed @@ -170,15 +172,15 @@ def __init__( self, *, count: Optional[int] = 1, - vm_size: Optional[Union[str, "ContainerServiceVMSizeTypes"]] = None, + vm_size: Optional[Union[str, "_models.ContainerServiceVMSizeTypes"]] = None, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - type_properties_type: Optional[Union[str, "AgentPoolType"]] = None, + type_properties_type: Optional[Union[str, "_models.AgentPoolType"]] = None, orchestrator_version: Optional[str] = None, availability_zones: Optional[List[str]] = None, **kwargs @@ -187,7 +189,7 @@ def __init__( :keyword count: Number of agents (VMs) 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: Size of agent VMs. Possible values include: "Standard_A1", "Standard_A10", + :keyword vm_size: Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -236,7 +238,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2019_04_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -244,8 +246,8 @@ def __init__( :paramtype min_count: int :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool - :keyword type_properties_type: AgentPoolType represents types of an agent pool. Possible values - include: "VirtualMachineScaleSets", "AvailabilitySet". + :keyword type_properties_type: AgentPoolType represents types of an agent pool. Known values + are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type_properties_type: str or ~azure.mgmt.containerservice.v2019_04_01.models.AgentPoolType :keyword orchestrator_version: Version of orchestrator specified when creating the managed @@ -294,7 +296,7 @@ class AgentPoolListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["AgentPool"]] = None, + value: Optional[List["_models.AgentPool"]] = None, **kwargs ): """ @@ -335,7 +337,7 @@ def __init__( code: Optional[str] = None, message: Optional[str] = None, target: Optional[str] = None, - details: Optional[List["CloudErrorBody"]] = None, + details: Optional[List["_models.CloudErrorBody"]] = None, **kwargs ): """ @@ -379,7 +381,7 @@ class ContainerServiceDiagnosticsProfile(msrest.serialization.Model): def __init__( self, *, - vm_diagnostics: "ContainerServiceVMDiagnostics", + vm_diagnostics: "_models.ContainerServiceVMDiagnostics", **kwargs ): """ @@ -416,7 +418,7 @@ def __init__( self, *, admin_username: str, - ssh: "ContainerServiceSshConfiguration", + ssh: "_models.ContainerServiceSshConfiguration", **kwargs ): """ @@ -439,17 +441,17 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar count: Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, - and 5. The default value is 1. Possible values include: 1, 3, 5. Default value: "1". + and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". :vartype count: int or ~azure.mgmt.containerservice.v2019_04_01.models.Count :ivar dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. :vartype dns_prefix: str - :ivar vm_size: Required. Size of agent VMs. Possible values include: "Standard_A1", - "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", - "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", - "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", - "Standard_A8m_v2", "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", - "Standard_B8ms", "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", - "Standard_D12", "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", + :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", + "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", + "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", + "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", "Standard_B8ms", + "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", "Standard_D12", + "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", "Standard_D13_v2_Promo", "Standard_D14", "Standard_D14_v2", "Standard_D14_v2_Promo", "Standard_D15_v2", "Standard_D16_v3", "Standard_D16s_v3", "Standard_D1_v2", "Standard_D2", "Standard_D2_v2", "Standard_D2_v2_Promo", "Standard_D2_v3", "Standard_D2s_v3", "Standard_D3", @@ -494,7 +496,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): :vartype first_consecutive_static_ip: str :ivar storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Possible values include: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". :vartype storage_profile: str or ~azure.mgmt.containerservice.v2019_04_01.models.ContainerServiceStorageProfileTypes :ivar fqdn: FQDN for the master pool. @@ -523,27 +525,27 @@ def __init__( self, *, dns_prefix: str, - vm_size: Union[str, "ContainerServiceVMSizeTypes"], - count: Optional[Union[int, "Count"]] = 1, + vm_size: Union[str, "_models.ContainerServiceVMSizeTypes"], + count: Optional[Union[int, "_models.Count"]] = 1, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, first_consecutive_static_ip: Optional[str] = "10.240.255.5", - storage_profile: Optional[Union[str, "ContainerServiceStorageProfileTypes"]] = None, + storage_profile: Optional[Union[str, "_models.ContainerServiceStorageProfileTypes"]] = None, **kwargs ): """ :keyword count: Number of masters (VMs) in the container service cluster. Allowed values are 1, - 3, and 5. The default value is 1. Possible values include: 1, 3, 5. Default value: "1". + 3, and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". :paramtype count: int or ~azure.mgmt.containerservice.v2019_04_01.models.Count :keyword dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. :paramtype dns_prefix: str - :keyword vm_size: Required. Size of agent VMs. Possible values include: "Standard_A1", - "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", - "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", - "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", - "Standard_A8m_v2", "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", - "Standard_B8ms", "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", - "Standard_D12", "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", + :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", + "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", + "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", + "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", "Standard_B8ms", + "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", "Standard_D12", + "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", "Standard_D13_v2_Promo", "Standard_D14", "Standard_D14_v2", "Standard_D14_v2_Promo", "Standard_D15_v2", "Standard_D16_v3", "Standard_D16s_v3", "Standard_D1_v2", "Standard_D2", "Standard_D2_v2", "Standard_D2_v2_Promo", "Standard_D2_v3", "Standard_D2s_v3", "Standard_D3", @@ -588,7 +590,7 @@ def __init__( :paramtype first_consecutive_static_ip: str :keyword storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Possible values include: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". :paramtype storage_profile: str or ~azure.mgmt.containerservice.v2019_04_01.models.ContainerServiceStorageProfileTypes """ @@ -606,11 +608,11 @@ def __init__( class ContainerServiceNetworkProfile(msrest.serialization.Model): """Profile of network configuration. - :ivar network_plugin: Network plugin used for building Kubernetes network. Possible values - include: "azure", "kubenet". Default value: "kubenet". + :ivar network_plugin: Network plugin used for building Kubernetes network. Known values are: + "azure", "kubenet". Default value: "kubenet". :vartype network_plugin: str or ~azure.mgmt.containerservice.v2019_04_01.models.NetworkPlugin - :ivar network_policy: Network policy used for building Kubernetes network. Possible values - include: "calico", "azure". + :ivar network_policy: Network policy used for building Kubernetes network. Known values are: + "calico", "azure". :vartype network_policy: str or ~azure.mgmt.containerservice.v2019_04_01.models.NetworkPolicy :ivar pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :vartype pod_cidr: str @@ -623,8 +625,8 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): :ivar docker_bridge_cidr: A CIDR notation IP range assigned to the Docker bridge network. It must not overlap with any Subnet IP ranges or the Kubernetes service address range. :vartype docker_bridge_cidr: str - :ivar load_balancer_sku: The load balancer sku for the managed cluster. Possible values - include: "standard", "basic". + :ivar load_balancer_sku: The load balancer sku for the managed cluster. Known values are: + "standard", "basic". :vartype load_balancer_sku: str or ~azure.mgmt.containerservice.v2019_04_01.models.LoadBalancerSku """ @@ -649,21 +651,21 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): def __init__( self, *, - network_plugin: Optional[Union[str, "NetworkPlugin"]] = "kubenet", - network_policy: Optional[Union[str, "NetworkPolicy"]] = None, + network_plugin: Optional[Union[str, "_models.NetworkPlugin"]] = "kubenet", + network_policy: Optional[Union[str, "_models.NetworkPolicy"]] = None, pod_cidr: Optional[str] = "10.244.0.0/16", service_cidr: Optional[str] = "10.0.0.0/16", dns_service_ip: Optional[str] = "10.0.0.10", docker_bridge_cidr: Optional[str] = "172.17.0.1/16", - load_balancer_sku: Optional[Union[str, "LoadBalancerSku"]] = None, + load_balancer_sku: Optional[Union[str, "_models.LoadBalancerSku"]] = None, **kwargs ): """ - :keyword network_plugin: Network plugin used for building Kubernetes network. Possible values - include: "azure", "kubenet". Default value: "kubenet". + :keyword network_plugin: Network plugin used for building Kubernetes network. Known values are: + "azure", "kubenet". Default value: "kubenet". :paramtype network_plugin: str or ~azure.mgmt.containerservice.v2019_04_01.models.NetworkPlugin - :keyword network_policy: Network policy used for building Kubernetes network. Possible values - include: "calico", "azure". + :keyword network_policy: Network policy used for building Kubernetes network. Known values are: + "calico", "azure". :paramtype network_policy: str or ~azure.mgmt.containerservice.v2019_04_01.models.NetworkPolicy :keyword pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :paramtype pod_cidr: str @@ -676,8 +678,8 @@ def __init__( :keyword docker_bridge_cidr: A CIDR notation IP range assigned to the Docker bridge network. It must not overlap with any Subnet IP ranges or the Kubernetes service address range. :paramtype docker_bridge_cidr: str - :keyword load_balancer_sku: The load balancer sku for the managed cluster. Possible values - include: "standard", "basic". + :keyword load_balancer_sku: The load balancer sku for the managed cluster. Known values are: + "standard", "basic". :paramtype load_balancer_sku: str or ~azure.mgmt.containerservice.v2019_04_01.models.LoadBalancerSku """ @@ -713,7 +715,7 @@ class ContainerServiceSshConfiguration(msrest.serialization.Model): def __init__( self, *, - public_keys: List["ContainerServiceSshPublicKey"], + public_keys: List["_models.ContainerServiceSshPublicKey"], **kwargs ): """ @@ -1014,19 +1016,19 @@ def __init__( *, location: str, tags: Optional[Dict[str, str]] = None, - identity: Optional["ManagedClusterIdentity"] = None, + identity: Optional["_models.ManagedClusterIdentity"] = None, kubernetes_version: Optional[str] = None, dns_prefix: Optional[str] = None, - agent_pool_profiles: Optional[List["ManagedClusterAgentPoolProfile"]] = None, - linux_profile: Optional["ContainerServiceLinuxProfile"] = None, - windows_profile: Optional["ManagedClusterWindowsProfile"] = None, - service_principal_profile: Optional["ManagedClusterServicePrincipalProfile"] = None, - addon_profiles: Optional[Dict[str, "ManagedClusterAddonProfile"]] = None, + agent_pool_profiles: Optional[List["_models.ManagedClusterAgentPoolProfile"]] = None, + linux_profile: Optional["_models.ContainerServiceLinuxProfile"] = None, + windows_profile: Optional["_models.ManagedClusterWindowsProfile"] = None, + service_principal_profile: Optional["_models.ManagedClusterServicePrincipalProfile"] = None, + addon_profiles: Optional[Dict[str, "_models.ManagedClusterAddonProfile"]] = None, node_resource_group: Optional[str] = None, enable_rbac: Optional[bool] = None, enable_pod_security_policy: Optional[bool] = None, - network_profile: Optional["ContainerServiceNetworkProfile"] = None, - aad_profile: Optional["ManagedClusterAADProfile"] = None, + network_profile: Optional["_models.ContainerServiceNetworkProfile"] = None, + aad_profile: Optional["_models.ManagedClusterAADProfile"] = None, api_server_authorized_ip_ranges: Optional[List[str]] = None, **kwargs ): @@ -1255,13 +1257,13 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar count: Required. Number of agents (VMs) 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: Required. Size of agent VMs. Possible values include: "Standard_A1", - "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", - "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", - "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", - "Standard_A8m_v2", "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", - "Standard_B8ms", "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", - "Standard_D12", "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", + :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", + "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", + "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", + "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", "Standard_B8ms", + "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", "Standard_D12", + "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", "Standard_D13_v2_Promo", "Standard_D14", "Standard_D14_v2", "Standard_D14_v2_Promo", "Standard_D15_v2", "Standard_D16_v3", "Standard_D16s_v3", "Standard_D1_v2", "Standard_D2", "Standard_D2_v2", "Standard_D2_v2_Promo", "Standard_D2_v3", "Standard_D2s_v3", "Standard_D3", @@ -1304,7 +1306,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2019_04_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -1312,7 +1314,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :vartype min_count: int :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool - :ivar type: AgentPoolType represents types of an agent pool. Possible values include: + :ivar type: AgentPoolType represents types of an agent pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2019_04_01.models.AgentPoolType :ivar orchestrator_version: Version of orchestrator specified when creating the managed @@ -1353,15 +1355,15 @@ def __init__( self, *, count: int = 1, - vm_size: Union[str, "ContainerServiceVMSizeTypes"], + vm_size: Union[str, "_models.ContainerServiceVMSizeTypes"], os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - type: Optional[Union[str, "AgentPoolType"]] = None, + type: Optional[Union[str, "_models.AgentPoolType"]] = None, orchestrator_version: Optional[str] = None, availability_zones: Optional[List[str]] = None, **kwargs @@ -1370,13 +1372,13 @@ def __init__( :keyword count: Required. Number of agents (VMs) 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: Required. Size of agent VMs. Possible values include: "Standard_A1", - "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", - "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", - "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", - "Standard_A8m_v2", "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", - "Standard_B8ms", "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", - "Standard_D12", "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", + :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", + "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", + "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", + "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", "Standard_B8ms", + "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", "Standard_D12", + "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", "Standard_D13_v2_Promo", "Standard_D14", "Standard_D14_v2", "Standard_D14_v2_Promo", "Standard_D15_v2", "Standard_D16_v3", "Standard_D16s_v3", "Standard_D1_v2", "Standard_D2", "Standard_D2_v2", "Standard_D2_v2_Promo", "Standard_D2_v3", "Standard_D2s_v3", "Standard_D3", @@ -1419,7 +1421,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2019_04_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -1427,7 +1429,7 @@ def __init__( :paramtype min_count: int :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool - :keyword type: AgentPoolType represents types of an agent pool. Possible values include: + :keyword type: AgentPoolType represents types of an agent pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2019_04_01.models.AgentPoolType :keyword orchestrator_version: Version of orchestrator specified when creating the managed @@ -1463,13 +1465,13 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar count: Required. Number of agents (VMs) 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: Required. Size of agent VMs. Possible values include: "Standard_A1", - "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", - "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", - "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", - "Standard_A8m_v2", "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", - "Standard_B8ms", "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", - "Standard_D12", "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", + :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", + "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", + "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", + "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", "Standard_B8ms", + "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", "Standard_D12", + "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", "Standard_D13_v2_Promo", "Standard_D14", "Standard_D14_v2", "Standard_D14_v2_Promo", "Standard_D15_v2", "Standard_D16_v3", "Standard_D16s_v3", "Standard_D1_v2", "Standard_D2", "Standard_D2_v2", "Standard_D2_v2_Promo", "Standard_D2_v3", "Standard_D2s_v3", "Standard_D3", @@ -1512,7 +1514,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2019_04_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -1520,7 +1522,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :vartype min_count: int :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool - :ivar type: AgentPoolType represents types of an agent pool. Possible values include: + :ivar type: AgentPoolType represents types of an agent pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2019_04_01.models.AgentPoolType :ivar orchestrator_version: Version of orchestrator specified when creating the managed @@ -1566,16 +1568,16 @@ def __init__( self, *, count: int = 1, - vm_size: Union[str, "ContainerServiceVMSizeTypes"], + vm_size: Union[str, "_models.ContainerServiceVMSizeTypes"], name: str, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - type: Optional[Union[str, "AgentPoolType"]] = None, + type: Optional[Union[str, "_models.AgentPoolType"]] = None, orchestrator_version: Optional[str] = None, availability_zones: Optional[List[str]] = None, **kwargs @@ -1584,13 +1586,13 @@ def __init__( :keyword count: Required. Number of agents (VMs) 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: Required. Size of agent VMs. Possible values include: "Standard_A1", - "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", - "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", - "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", - "Standard_A8m_v2", "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", - "Standard_B8ms", "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", - "Standard_D12", "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", + :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", + "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", + "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", + "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", "Standard_B8ms", + "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", "Standard_D12", + "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", "Standard_D13_v2_Promo", "Standard_D14", "Standard_D14_v2", "Standard_D14_v2_Promo", "Standard_D15_v2", "Standard_D16_v3", "Standard_D16s_v3", "Standard_D1_v2", "Standard_D2", "Standard_D2_v2", "Standard_D2_v2_Promo", "Standard_D2_v3", "Standard_D2s_v3", "Standard_D3", @@ -1633,7 +1635,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2019_04_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -1641,7 +1643,7 @@ def __init__( :paramtype min_count: int :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool - :keyword type: AgentPoolType represents types of an agent pool. Possible values include: + :keyword type: AgentPoolType represents types of an agent pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2019_04_01.models.AgentPoolType :keyword orchestrator_version: Version of orchestrator specified when creating the managed @@ -1672,7 +1674,7 @@ class ManagedClusterIdentity(msrest.serialization.Model): :ivar type: The type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ resource group in agent nodes. Type 'None' will not use MSI for the managed cluster, - service principal will be used instead. Possible values include: "SystemAssigned", "None". + service principal will be used instead. Known values are: "SystemAssigned", "None". :vartype type: str or ~azure.mgmt.containerservice.v2019_04_01.models.ResourceIdentityType """ @@ -1690,15 +1692,14 @@ class ManagedClusterIdentity(msrest.serialization.Model): def __init__( self, *, - type: Optional[Union[str, "ResourceIdentityType"]] = None, + type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, **kwargs ): """ :keyword type: The type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ resource group in agent nodes. Type 'None' will not use MSI for the managed - cluster, service principal will be used instead. Possible values include: "SystemAssigned", - "None". + cluster, service principal will be used instead. Known values are: "SystemAssigned", "None". :paramtype type: str or ~azure.mgmt.containerservice.v2019_04_01.models.ResourceIdentityType """ super(ManagedClusterIdentity, self).__init__(**kwargs) @@ -1730,7 +1731,7 @@ class ManagedClusterListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["ManagedCluster"]] = None, + value: Optional[List["_models.ManagedCluster"]] = None, **kwargs ): """ @@ -1752,7 +1753,7 @@ class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): :ivar name: Pool name. :vartype name: str :ivar os_type: Required. OsType to be used to specify os type. Choose from Linux and Windows. - Default to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2019_04_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -1775,9 +1776,9 @@ def __init__( self, *, kubernetes_version: str, - os_type: Union[str, "OSType"] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", name: Optional[str] = None, - upgrades: Optional[List["ManagedClusterPoolUpgradeProfileUpgradesItem"]] = None, + upgrades: Optional[List["_models.ManagedClusterPoolUpgradeProfileUpgradesItem"]] = None, **kwargs ): """ @@ -1786,7 +1787,7 @@ def __init__( :keyword name: Pool name. :paramtype name: str :keyword os_type: Required. OsType to be used to specify os type. Choose from Linux and - Windows. Default to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Windows. Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2019_04_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: @@ -1910,8 +1911,8 @@ class ManagedClusterUpgradeProfile(msrest.serialization.Model): def __init__( self, *, - control_plane_profile: "ManagedClusterPoolUpgradeProfile", - agent_pool_profiles: List["ManagedClusterPoolUpgradeProfile"], + control_plane_profile: "_models.ManagedClusterPoolUpgradeProfile", + agent_pool_profiles: List["_models.ManagedClusterPoolUpgradeProfile"], **kwargs ): """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/models/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/models/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/operations/__init__.py index 5aac40228eec..403c0174f052 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/operations/__init__.py @@ -10,8 +10,13 @@ from ._managed_clusters_operations import ManagedClustersOperations from ._agent_pools_operations import AgentPoolsOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'Operations', 'ManagedClustersOperations', 'AgentPoolsOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/operations/_agent_pools_operations.py index 8e2bb37022ec..27ac6d600e9b 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/operations/_agent_pools_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -35,9 +35,12 @@ def build_list_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-04-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools") # pylint: disable=line-too-long path_format_arguments = { @@ -49,18 +52,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -72,9 +73,12 @@ def build_get_request( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-04-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -87,18 +91,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -109,14 +111,17 @@ def build_create_or_update_request_initial( resource_name: str, agent_pool_name: str, *, - json: JSONType = None, + json: Optional[_models.AgentPool] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-04-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -129,20 +134,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -156,9 +159,12 @@ def build_delete_request_initial( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-04-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -171,42 +177,38 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class AgentPoolsOperations(object): - """AgentPoolsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class AgentPoolsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2019_04_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2019_04_01.ContainerServiceClient`'s + :attr:`agent_pools` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -214,7 +216,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Iterable["_models.AgentPoolListResult"]: + ) -> Iterable[_models.AgentPoolListResult]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. The operation returns properties @@ -230,13 +232,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2019_04_01.models.AgentPoolListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-04-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -246,9 +251,11 @@ def prepare_request(next_link=None): resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -258,9 +265,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -300,7 +309,7 @@ def get( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPool": + ) -> _models.AgentPool: """Gets the agent pool. Gets the details of the agent pool by managed cluster and resource group. @@ -316,13 +325,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2019_04_01.models.AgentPool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-04-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] request = build_get_request( @@ -332,11 +344,13 @@ def get( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -362,17 +376,20 @@ def _create_or_update_initial( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> "_models.AgentPool": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] + ) -> _models.AgentPool: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2019-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] _json = self._serialize.body(parameters, 'AgentPool') @@ -385,11 +402,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -420,9 +439,9 @@ def begin_create_or_update( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> LROPoller["_models.AgentPool"]: + ) -> LROPoller[_models.AgentPool]: """Creates or updates an agent pool. Creates or updates an agent pool in the specified managed cluster. @@ -448,17 +467,20 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_04_01.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, @@ -466,20 +488,27 @@ def begin_create_or_update( 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): - response = pipeline_response.http_response deserialized = self._deserialize('AgentPool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -499,13 +528,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements agent_pool_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-04-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -515,11 +547,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -566,21 +600,26 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-04-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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) @@ -590,8 +629,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/operations/_managed_clusters_operations.py index 76af59b03a7d..5ce275d52716 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/operations/_managed_clusters_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -33,9 +33,12 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-04-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters") path_format_arguments = { @@ -45,18 +48,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -66,9 +67,12 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-04-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters") # pylint: disable=line-too-long path_format_arguments = { @@ -79,18 +83,16 @@ def build_list_by_resource_group_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -101,9 +103,12 @@ def build_get_upgrade_profile_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-04-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default") # pylint: disable=line-too-long path_format_arguments = { @@ -115,18 +120,16 @@ def build_get_upgrade_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -138,9 +141,12 @@ def build_get_access_profile_request( role_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-04-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -153,18 +159,16 @@ def build_get_access_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -175,9 +179,12 @@ def build_list_cluster_admin_credentials_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-04-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -189,18 +196,16 @@ def build_list_cluster_admin_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -211,9 +216,12 @@ def build_list_cluster_user_credentials_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-04-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -225,18 +233,16 @@ def build_list_cluster_user_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -247,9 +253,12 @@ def build_get_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-04-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -261,18 +270,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -282,14 +289,17 @@ def build_create_or_update_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedCluster] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-04-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -301,20 +311,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -326,14 +334,17 @@ def build_update_tags_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.TagsObject] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-04-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -345,20 +356,18 @@ def build_update_tags_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -371,9 +380,12 @@ def build_delete_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-04-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -385,18 +397,16 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -406,14 +416,17 @@ def build_reset_service_principal_profile_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedClusterServicePrincipalProfile] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-04-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile") # pylint: disable=line-too-long path_format_arguments = { @@ -425,20 +438,18 @@ def build_reset_service_principal_profile_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -450,14 +461,17 @@ def build_reset_aad_profile_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedClusterAADProfile] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-04-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile") # pylint: disable=line-too-long path_format_arguments = { @@ -469,52 +483,48 @@ def build_reset_aad_profile_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs ) -class ManagedClustersOperations(object): - """ManagedClustersOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ManagedClustersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2019_04_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2019_04_01.ContainerServiceClient`'s + :attr:`managed_clusters` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> Iterable["_models.ManagedClusterListResult"]: + ) -> Iterable[_models.ManagedClusterListResult]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. The operation returns properties @@ -527,13 +537,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2019_04_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-04-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -541,9 +554,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -551,9 +566,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -591,7 +608,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.ManagedClusterListResult"]: + ) -> Iterable[_models.ManagedClusterListResult]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. The operation returns @@ -606,13 +623,16 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2019_04_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-04-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -621,9 +641,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -632,9 +654,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -673,7 +697,7 @@ def get_upgrade_profile( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedClusterUpgradeProfile": + ) -> _models.ManagedClusterUpgradeProfile: """Gets upgrade profile for a managed cluster. Gets the details of the upgrade profile for a managed cluster with a specified resource group @@ -688,13 +712,16 @@ def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2019_04_01.models.ManagedClusterUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-04-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] request = build_get_upgrade_profile_request( @@ -703,11 +730,13 @@ def get_upgrade_profile( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -735,7 +764,7 @@ def get_access_profile( resource_name: str, role_name: str, **kwargs: Any - ) -> "_models.ManagedClusterAccessProfile": + ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. Gets the accessProfile for the specified role name of the managed cluster with a specified @@ -752,13 +781,16 @@ def get_access_profile( :rtype: ~azure.mgmt.containerservice.v2019_04_01.models.ManagedClusterAccessProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterAccessProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2019-04-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] request = build_get_access_profile_request( @@ -768,11 +800,13 @@ def get_access_profile( role_name=role_name, api_version=api_version, template_url=self.get_access_profile.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -799,7 +833,7 @@ def list_cluster_admin_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster admin credential of a managed cluster. Gets cluster admin credential of the managed cluster with a specified resource group and name. @@ -813,13 +847,16 @@ def list_cluster_admin_credentials( :rtype: ~azure.mgmt.containerservice.v2019_04_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-04-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_admin_credentials_request( @@ -828,11 +865,13 @@ def list_cluster_admin_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_admin_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -859,7 +898,7 @@ def list_cluster_user_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster user credential of a managed cluster. Gets cluster user credential of the managed cluster with a specified resource group and name. @@ -873,13 +912,16 @@ def list_cluster_user_credentials( :rtype: ~azure.mgmt.containerservice.v2019_04_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2019-04-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_user_credentials_request( @@ -888,11 +930,13 @@ def list_cluster_user_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -919,7 +963,7 @@ def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedCluster": + ) -> _models.ManagedCluster: """Gets a managed cluster. Gets the details of the managed cluster with a specified resource group and name. @@ -933,13 +977,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2019_04_01.models.ManagedCluster :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-04-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] request = build_get_request( @@ -948,11 +995,13 @@ def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -977,17 +1026,20 @@ def _create_or_update_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2019-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'ManagedCluster') @@ -999,11 +1051,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1033,9 +1087,9 @@ def begin_create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> LROPoller["_models.ManagedCluster"]: + ) -> LROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. Creates or updates a managed cluster with the specified configuration for agents and Kubernetes @@ -1061,37 +1115,47 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_04_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1108,17 +1172,20 @@ def _update_tags_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2019-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'TagsObject') @@ -1130,11 +1197,13 @@ def _update_tags_initial( content_type=content_type, json=_json, template_url=self._update_tags_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1160,9 +1229,9 @@ def begin_update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> LROPoller["_models.ManagedCluster"]: + ) -> LROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates a managed cluster with the specified tags. @@ -1187,37 +1256,47 @@ def begin_update_tags( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_04_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._update_tags_initial( + raw_result = self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1236,13 +1315,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2019-04-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -1251,11 +1333,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1299,20 +1383,25 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-04-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_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) @@ -1322,8 +1411,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1340,17 +1435,20 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2019-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') @@ -1362,11 +1460,13 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re content_type=content_type, json=_json, template_url=self._reset_service_principal_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1388,7 +1488,7 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> LROPoller[None]: """Reset Service Principal Profile of a managed cluster. @@ -1415,23 +1515,28 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._reset_service_principal_profile_initial( + raw_result = self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1441,8 +1546,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1459,17 +1570,20 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2019-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') @@ -1481,11 +1595,13 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement content_type=content_type, json=_json, template_url=self._reset_aad_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1507,7 +1623,7 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> LROPoller[None]: """Reset AAD Profile of a managed cluster. @@ -1533,23 +1649,28 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._reset_aad_profile_initial( + raw_result = self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1559,8 +1680,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/operations/_operations.py index 589d3b195af1..e70363671387 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/operations/_operations.py @@ -16,6 +16,7 @@ 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 @@ -29,55 +30,54 @@ def build_list_request( **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-04-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.ContainerService/operations") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class Operations(object): - """Operations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2019_04_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2019_04_01.ContainerServiceClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> Iterable["_models.OperationListResult"]: + ) -> Iterable[_models.OperationListResult]: """Gets a list of compute operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -86,31 +86,38 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2019_04_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-04-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_01/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/__init__.py index 53c675bd95e2..37a5f9e02e6f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._container_service_client import ContainerServiceClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['ContainerServiceClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/_container_service_client.py index 7ceadade7909..ec8f09f2259e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/_container_service_client.py @@ -56,7 +56,9 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.open_shift_managed_clusters = OpenShiftManagedClustersOperations(self._client, self._config, self._serialize, self._deserialize) + self.open_shift_managed_clusters = OpenShiftManagedClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/aio/__init__.py index 53c675bd95e2..37a5f9e02e6f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/aio/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/aio/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._container_service_client import ContainerServiceClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['ContainerServiceClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/aio/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/aio/_container_service_client.py index 894614460d5e..518b6b89f5cd 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/aio/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/aio/_container_service_client.py @@ -56,7 +56,9 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.open_shift_managed_clusters = OpenShiftManagedClustersOperations(self._client, self._config, self._serialize, self._deserialize) + self.open_shift_managed_clusters = OpenShiftManagedClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/aio/operations/__init__.py index 45d890441cd5..211a87879804 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/aio/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/aio/operations/__init__.py @@ -8,6 +8,11 @@ from ._open_shift_managed_clusters_operations import OpenShiftManagedClustersOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'OpenShiftManagedClustersOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/aio/operations/_open_shift_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/aio/operations/_open_shift_managed_clusters_operations.py index d45a894e1d69..f675bb3916d1 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/aio/operations/_open_shift_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/aio/operations/_open_shift_managed_clusters_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. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ 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 @@ -26,32 +27,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class OpenShiftManagedClustersOperations: - """OpenShiftManagedClustersOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2019_04_30.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2019_04_30.aio.ContainerServiceClient`'s + :attr:`open_shift_managed_clusters` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.OpenShiftManagedClusterListResult"]: + ) -> AsyncIterable[_models.OpenShiftManagedClusterListResult]: """Gets a list of OpenShift managed clusters in the specified subscription. Gets a list of OpenShift managed clusters in the specified subscription. The operation returns @@ -64,13 +63,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2019_04_30.models.OpenShiftManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-04-30") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-30")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OpenShiftManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -78,9 +80,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -88,9 +92,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -128,7 +134,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.OpenShiftManagedClusterListResult"]: + ) -> AsyncIterable[_models.OpenShiftManagedClusterListResult]: """Lists OpenShift managed clusters in the specified subscription and resource group. Lists OpenShift managed clusters in the specified subscription and resource group. The @@ -143,13 +149,16 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2019_04_30.models.OpenShiftManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-04-30") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-30")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OpenShiftManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -158,9 +167,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -169,9 +180,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -210,7 +223,7 @@ async def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.OpenShiftManagedCluster": + ) -> _models.OpenShiftManagedCluster: """Gets a OpenShift managed cluster. Gets the details of the managed OpenShift cluster with a specified resource group and name. @@ -224,13 +237,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2019_04_30.models.OpenShiftManagedCluster :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OpenShiftManagedCluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-04-30") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-30")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedCluster] request = build_get_request( @@ -239,11 +255,13 @@ async def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -268,17 +286,20 @@ async def _create_or_update_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.OpenShiftManagedCluster", + parameters: _models.OpenShiftManagedCluster, **kwargs: Any - ) -> "_models.OpenShiftManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.OpenShiftManagedCluster"] + ) -> _models.OpenShiftManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2019-04-30") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-30")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedCluster] _json = self._serialize.body(parameters, 'OpenShiftManagedCluster') @@ -290,11 +311,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -324,9 +347,9 @@ async def begin_create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.OpenShiftManagedCluster", + parameters: _models.OpenShiftManagedCluster, **kwargs: Any - ) -> AsyncLROPoller["_models.OpenShiftManagedCluster"]: + ) -> AsyncLROPoller[_models.OpenShiftManagedCluster]: """Creates or updates an OpenShift managed cluster. Creates or updates a OpenShift managed cluster with the specified configuration for agents and @@ -353,37 +376,47 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_04_30.models.OpenShiftManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-04-30") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-30")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OpenShiftManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('OpenShiftManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -400,17 +433,20 @@ async def _update_tags_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.OpenShiftManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.OpenShiftManagedCluster"] + ) -> _models.OpenShiftManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2019-04-30") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-30")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedCluster] _json = self._serialize.body(parameters, 'TagsObject') @@ -422,11 +458,13 @@ async def _update_tags_initial( content_type=content_type, json=_json, template_url=self._update_tags_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -452,9 +490,9 @@ async def begin_update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> AsyncLROPoller["_models.OpenShiftManagedCluster"]: + ) -> AsyncLROPoller[_models.OpenShiftManagedCluster]: """Updates tags on an OpenShift managed cluster. Updates an OpenShift managed cluster with the specified tags. @@ -479,37 +517,47 @@ async def begin_update_tags( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_04_30.models.OpenShiftManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-04-30") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-30")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OpenShiftManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._update_tags_initial( + raw_result = await self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('OpenShiftManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -528,13 +576,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-04-30") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-30")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -543,11 +594,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -591,20 +644,25 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-04-30") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-30")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_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) @@ -614,8 +672,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/aio/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/aio/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/models/__init__.py index 35292467d6d1..421ce777c259 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/models/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/models/__init__.py @@ -27,7 +27,9 @@ OpenShiftAgentPoolProfileRole, OpenShiftContainerServiceVMSize, ) - +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'CloudErrorBody', 'NetworkProfile', @@ -47,3 +49,5 @@ 'OpenShiftAgentPoolProfileRole', 'OpenShiftContainerServiceVMSize', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/models/_container_service_client_enums.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/models/_container_service_client_enums.py index 9cff02877c35..6c64f62d0661 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/models/_container_service_client_enums.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/models/_container_service_client_enums.py @@ -7,18 +7,17 @@ # -------------------------------------------------------------------------- from enum import Enum -from six import with_metaclass from azure.core import CaseInsensitiveEnumMeta -class OpenShiftAgentPoolProfileRole(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OpenShiftAgentPoolProfileRole(str, Enum, metaclass=CaseInsensitiveEnumMeta): """OpenShiftAgentPoolProfileRole represents the role of the AgentPoolProfile. """ COMPUTE = "compute" INFRA = "infra" -class OpenShiftContainerServiceVMSize(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OpenShiftContainerServiceVMSize(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Size of OpenShift VMs. """ @@ -56,7 +55,7 @@ class OpenShiftContainerServiceVMSize(with_metaclass(CaseInsensitiveEnumMeta, st STANDARD_L16_S = "Standard_L16s" STANDARD_L32_S = "Standard_L32s" -class OSType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux. """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/models/_models_py3.py index 11b32dca9a0f..47a7d05afb37 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/models/_models_py3.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/models/_models_py3.py @@ -6,11 +6,13 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Dict, List, Optional, Union +from typing import Dict, List, Optional, TYPE_CHECKING, Union import msrest.serialization -from ._container_service_client_enums import * +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + import __init__ as _models class CloudErrorBody(msrest.serialization.Model): @@ -42,7 +44,7 @@ def __init__( code: Optional[str] = None, message: Optional[str] = None, target: Optional[str] = None, - details: Optional[List["CloudErrorBody"]] = None, + details: Optional[List["_models.CloudErrorBody"]] = None, **kwargs ): """ @@ -240,13 +242,13 @@ def __init__( *, location: str, tags: Optional[Dict[str, str]] = None, - plan: Optional["PurchasePlan"] = None, + plan: Optional["_models.PurchasePlan"] = None, open_shift_version: Optional[str] = None, - network_profile: Optional["NetworkProfile"] = None, - router_profiles: Optional[List["OpenShiftRouterProfile"]] = None, - master_pool_profile: Optional["OpenShiftManagedClusterMasterPoolProfile"] = None, - agent_pool_profiles: Optional[List["OpenShiftManagedClusterAgentPoolProfile"]] = None, - auth_profile: Optional["OpenShiftManagedClusterAuthProfile"] = None, + network_profile: Optional["_models.NetworkProfile"] = None, + router_profiles: Optional[List["_models.OpenShiftRouterProfile"]] = None, + master_pool_profile: Optional["_models.OpenShiftManagedClusterMasterPoolProfile"] = None, + agent_pool_profiles: Optional[List["_models.OpenShiftManagedClusterAgentPoolProfile"]] = None, + auth_profile: Optional["_models.OpenShiftManagedClusterAuthProfile"] = None, **kwargs ): """ @@ -387,7 +389,7 @@ class OpenShiftManagedClusterAgentPoolProfile(msrest.serialization.Model): :vartype name: str :ivar count: Required. Number of agents (VMs) to host docker containers. :vartype count: int - :ivar vm_size: Required. Size of agent VMs. Possible values include: "Standard_D2s_v3", + :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_D2s_v3", "Standard_D4s_v3", "Standard_D8s_v3", "Standard_D16s_v3", "Standard_D32s_v3", "Standard_D64s_v3", "Standard_DS4_v2", "Standard_DS5_v2", "Standard_F8s_v2", "Standard_F16s_v2", "Standard_F32s_v2", "Standard_F64s_v2", "Standard_F72s_v2", "Standard_F8s", @@ -400,10 +402,9 @@ class OpenShiftManagedClusterAgentPoolProfile(msrest.serialization.Model): :ivar subnet_cidr: Subnet CIDR for the peering. :vartype subnet_cidr: str :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2019_04_30.models.OSType - :ivar role: Define the role of the AgentPoolProfile. Possible values include: "compute", - "infra". + :ivar role: Define the role of the AgentPoolProfile. Known values are: "compute", "infra". :vartype role: str or ~azure.mgmt.containerservice.v2019_04_30.models.OpenShiftAgentPoolProfileRole """ @@ -428,10 +429,10 @@ def __init__( *, name: str, count: int, - vm_size: Union[str, "OpenShiftContainerServiceVMSize"], + vm_size: Union[str, "_models.OpenShiftContainerServiceVMSize"], subnet_cidr: Optional[str] = "10.0.0.0/24", - os_type: Optional[Union[str, "OSType"]] = "Linux", - role: Optional[Union[str, "OpenShiftAgentPoolProfileRole"]] = None, + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + role: Optional[Union[str, "_models.OpenShiftAgentPoolProfileRole"]] = None, **kwargs ): """ @@ -440,7 +441,7 @@ def __init__( :paramtype name: str :keyword count: Required. Number of agents (VMs) to host docker containers. :paramtype count: int - :keyword vm_size: Required. Size of agent VMs. Possible values include: "Standard_D2s_v3", + :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_D2s_v3", "Standard_D4s_v3", "Standard_D8s_v3", "Standard_D16s_v3", "Standard_D32s_v3", "Standard_D64s_v3", "Standard_DS4_v2", "Standard_DS5_v2", "Standard_F8s_v2", "Standard_F16s_v2", "Standard_F32s_v2", "Standard_F64s_v2", "Standard_F72s_v2", "Standard_F8s", @@ -453,10 +454,9 @@ def __init__( :keyword subnet_cidr: Subnet CIDR for the peering. :paramtype subnet_cidr: str :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2019_04_30.models.OSType - :keyword role: Define the role of the AgentPoolProfile. Possible values include: "compute", - "infra". + :keyword role: Define the role of the AgentPoolProfile. Known values are: "compute", "infra". :paramtype role: str or ~azure.mgmt.containerservice.v2019_04_30.models.OpenShiftAgentPoolProfileRole """ @@ -484,7 +484,7 @@ class OpenShiftManagedClusterAuthProfile(msrest.serialization.Model): def __init__( self, *, - identity_providers: Optional[List["OpenShiftManagedClusterIdentityProvider"]] = None, + identity_providers: Optional[List["_models.OpenShiftManagedClusterIdentityProvider"]] = None, **kwargs ): """ @@ -515,7 +515,7 @@ def __init__( self, *, name: Optional[str] = None, - provider: Optional["OpenShiftManagedClusterBaseIdentityProvider"] = None, + provider: Optional["_models.OpenShiftManagedClusterBaseIdentityProvider"] = None, **kwargs ): """ @@ -553,7 +553,7 @@ class OpenShiftManagedClusterListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["OpenShiftManagedCluster"]] = None, + value: Optional[List["_models.OpenShiftManagedCluster"]] = None, **kwargs ): """ @@ -576,7 +576,7 @@ class OpenShiftManagedClusterMasterPoolProfile(msrest.serialization.Model): :ivar count: Required. Number of masters (VMs) to host docker containers. The default value is 3. :vartype count: int - :ivar vm_size: Required. Size of agent VMs. Possible values include: "Standard_D2s_v3", + :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_D2s_v3", "Standard_D4s_v3", "Standard_D8s_v3", "Standard_D16s_v3", "Standard_D32s_v3", "Standard_D64s_v3", "Standard_DS4_v2", "Standard_DS5_v2", "Standard_F8s_v2", "Standard_F16s_v2", "Standard_F32s_v2", "Standard_F64s_v2", "Standard_F72s_v2", "Standard_F8s", @@ -589,7 +589,7 @@ class OpenShiftManagedClusterMasterPoolProfile(msrest.serialization.Model): :ivar subnet_cidr: Subnet CIDR for the peering. :vartype subnet_cidr: str :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2019_04_30.models.OSType """ @@ -610,10 +610,10 @@ def __init__( self, *, count: int, - vm_size: Union[str, "OpenShiftContainerServiceVMSize"], + vm_size: Union[str, "_models.OpenShiftContainerServiceVMSize"], name: Optional[str] = None, subnet_cidr: Optional[str] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", **kwargs ): """ @@ -623,7 +623,7 @@ def __init__( :keyword count: Required. Number of masters (VMs) to host docker containers. The default value is 3. :paramtype count: int - :keyword vm_size: Required. Size of agent VMs. Possible values include: "Standard_D2s_v3", + :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_D2s_v3", "Standard_D4s_v3", "Standard_D8s_v3", "Standard_D16s_v3", "Standard_D32s_v3", "Standard_D64s_v3", "Standard_DS4_v2", "Standard_DS5_v2", "Standard_F8s_v2", "Standard_F16s_v2", "Standard_F32s_v2", "Standard_F64s_v2", "Standard_F72s_v2", "Standard_F8s", @@ -636,7 +636,7 @@ def __init__( :keyword subnet_cidr: Subnet CIDR for the peering. :paramtype subnet_cidr: str :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2019_04_30.models.OSType """ super(OpenShiftManagedClusterMasterPoolProfile, self).__init__(**kwargs) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/models/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/models/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/operations/__init__.py index 45d890441cd5..211a87879804 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/operations/__init__.py @@ -8,6 +8,11 @@ from ._open_shift_managed_clusters_operations import OpenShiftManagedClustersOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'OpenShiftManagedClustersOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/operations/_open_shift_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/operations/_open_shift_managed_clusters_operations.py index f424a36729a6..97238bf99515 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/operations/_open_shift_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/operations/_open_shift_managed_clusters_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -33,9 +33,12 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-04-30") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-30")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/openShiftManagedClusters") # pylint: disable=line-too-long path_format_arguments = { @@ -45,18 +48,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -66,9 +67,12 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-04-30") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-30")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters") # pylint: disable=line-too-long path_format_arguments = { @@ -79,18 +83,16 @@ def build_list_by_resource_group_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -101,9 +103,12 @@ def build_get_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-04-30") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-30")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -115,18 +120,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -136,14 +139,17 @@ def build_create_or_update_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.OpenShiftManagedCluster] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-04-30") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-30")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -155,20 +161,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -180,14 +184,17 @@ def build_update_tags_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.TagsObject] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-04-30") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-30")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -199,20 +206,18 @@ def build_update_tags_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -225,9 +230,12 @@ def build_delete_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-04-30") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-30")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -239,48 +247,44 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class OpenShiftManagedClustersOperations(object): - """OpenShiftManagedClustersOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class OpenShiftManagedClustersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2019_04_30.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2019_04_30.ContainerServiceClient`'s + :attr:`open_shift_managed_clusters` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> Iterable["_models.OpenShiftManagedClusterListResult"]: + ) -> Iterable[_models.OpenShiftManagedClusterListResult]: """Gets a list of OpenShift managed clusters in the specified subscription. Gets a list of OpenShift managed clusters in the specified subscription. The operation returns @@ -293,13 +297,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2019_04_30.models.OpenShiftManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-04-30") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-30")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OpenShiftManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -307,9 +314,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -317,9 +326,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -357,7 +368,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.OpenShiftManagedClusterListResult"]: + ) -> Iterable[_models.OpenShiftManagedClusterListResult]: """Lists OpenShift managed clusters in the specified subscription and resource group. Lists OpenShift managed clusters in the specified subscription and resource group. The @@ -372,13 +383,16 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2019_04_30.models.OpenShiftManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-04-30") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-30")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OpenShiftManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -387,9 +401,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -398,9 +414,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -439,7 +457,7 @@ def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.OpenShiftManagedCluster": + ) -> _models.OpenShiftManagedCluster: """Gets a OpenShift managed cluster. Gets the details of the managed OpenShift cluster with a specified resource group and name. @@ -453,13 +471,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2019_04_30.models.OpenShiftManagedCluster :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OpenShiftManagedCluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2019-04-30") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-30")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedCluster] request = build_get_request( @@ -468,11 +489,13 @@ def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -497,17 +520,20 @@ def _create_or_update_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.OpenShiftManagedCluster", + parameters: _models.OpenShiftManagedCluster, **kwargs: Any - ) -> "_models.OpenShiftManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.OpenShiftManagedCluster"] + ) -> _models.OpenShiftManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2019-04-30") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-30")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedCluster] _json = self._serialize.body(parameters, 'OpenShiftManagedCluster') @@ -519,11 +545,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -553,9 +581,9 @@ def begin_create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.OpenShiftManagedCluster", + parameters: _models.OpenShiftManagedCluster, **kwargs: Any - ) -> LROPoller["_models.OpenShiftManagedCluster"]: + ) -> LROPoller[_models.OpenShiftManagedCluster]: """Creates or updates an OpenShift managed cluster. Creates or updates a OpenShift managed cluster with the specified configuration for agents and @@ -582,37 +610,47 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_04_30.models.OpenShiftManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-04-30") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-30")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OpenShiftManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('OpenShiftManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -629,17 +667,20 @@ def _update_tags_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.OpenShiftManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.OpenShiftManagedCluster"] + ) -> _models.OpenShiftManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2019-04-30") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-30")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedCluster] _json = self._serialize.body(parameters, 'TagsObject') @@ -651,11 +692,13 @@ def _update_tags_initial( content_type=content_type, json=_json, template_url=self._update_tags_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -681,9 +724,9 @@ def begin_update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> LROPoller["_models.OpenShiftManagedCluster"]: + ) -> LROPoller[_models.OpenShiftManagedCluster]: """Updates tags on an OpenShift managed cluster. Updates an OpenShift managed cluster with the specified tags. @@ -708,37 +751,47 @@ def begin_update_tags( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_04_30.models.OpenShiftManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-04-30") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-30")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OpenShiftManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._update_tags_initial( + raw_result = self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('OpenShiftManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -757,13 +810,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2019-04-30") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-30")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -772,11 +828,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -820,20 +878,25 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-04-30") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-04-30")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_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) @@ -843,8 +906,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_04_30/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/__init__.py index 53c675bd95e2..37a5f9e02e6f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._container_service_client import ContainerServiceClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['ContainerServiceClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/_container_service_client.py index 8f433dbb7820..d8a6d42b601a 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/_container_service_client.py @@ -60,9 +60,15 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.managed_clusters = ManagedClustersOperations(self._client, self._config, self._serialize, self._deserialize) - self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_clusters = ManagedClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.agent_pools = AgentPoolsOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/aio/__init__.py index 53c675bd95e2..37a5f9e02e6f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/aio/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/aio/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._container_service_client import ContainerServiceClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['ContainerServiceClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/aio/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/aio/_container_service_client.py index f316472b9ac3..8f2a9c6ac6e6 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/aio/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/aio/_container_service_client.py @@ -61,9 +61,15 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.managed_clusters = ManagedClustersOperations(self._client, self._config, self._serialize, self._deserialize) - self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_clusters = ManagedClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.agent_pools = AgentPoolsOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/aio/operations/__init__.py index 5aac40228eec..403c0174f052 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/aio/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/aio/operations/__init__.py @@ -10,8 +10,13 @@ from ._managed_clusters_operations import ManagedClustersOperations from ._agent_pools_operations import AgentPoolsOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'Operations', 'ManagedClustersOperations', 'AgentPoolsOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/aio/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/aio/operations/_agent_pools_operations.py index c10c573d5283..3b525f9ca9b7 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/aio/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/aio/operations/_agent_pools_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. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ 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 @@ -26,26 +27,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class AgentPoolsOperations: - """AgentPoolsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2019_06_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2019_06_01.aio.ContainerServiceClient`'s + :attr:`agent_pools` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -53,7 +52,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> AsyncIterable["_models.AgentPoolListResult"]: + ) -> AsyncIterable[_models.AgentPoolListResult]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. The operation returns properties @@ -69,13 +68,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2019_06_01.models.AgentPoolListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-06-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -85,9 +87,11 @@ def prepare_request(next_link=None): resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -97,9 +101,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -139,7 +145,7 @@ async def get( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPool": + ) -> _models.AgentPool: """Gets the agent pool. Gets the details of the agent pool by managed cluster and resource group. @@ -155,13 +161,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2019_06_01.models.AgentPool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-06-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] request = build_get_request( @@ -171,11 +180,13 @@ async def get( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -201,17 +212,20 @@ async def _create_or_update_initial( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> "_models.AgentPool": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] + ) -> _models.AgentPool: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2019-06-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] _json = self._serialize.body(parameters, 'AgentPool') @@ -224,11 +238,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -259,9 +275,9 @@ async def begin_create_or_update( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> AsyncLROPoller["_models.AgentPool"]: + ) -> AsyncLROPoller[_models.AgentPool]: """Creates or updates an agent pool. Creates or updates an agent pool in the specified managed cluster. @@ -288,17 +304,20 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_06_01.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-06-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, @@ -306,20 +325,27 @@ async def begin_create_or_update( 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): - response = pipeline_response.http_response deserialized = self._deserialize('AgentPool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -339,13 +365,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements agent_pool_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-06-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -355,11 +384,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -406,21 +437,26 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-06-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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) @@ -430,8 +466,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -451,7 +493,7 @@ async def get_upgrade_profile( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPoolUpgradeProfile": + ) -> _models.AgentPoolUpgradeProfile: """Gets upgrade profile for an agent pool. Gets the details of the upgrade profile for an agent pool with a specified resource group and @@ -468,13 +510,16 @@ async def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2019_06_01.models.AgentPoolUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2019-06-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] request = build_get_upgrade_profile_request( @@ -484,11 +529,13 @@ async def get_upgrade_profile( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -515,7 +562,7 @@ async def get_available_agent_pool_versions( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.AgentPoolAvailableVersions": + ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported versions for the specified agent pool. Gets a list of supported versions for the specified agent pool. @@ -529,13 +576,16 @@ async def get_available_agent_pool_versions( :rtype: ~azure.mgmt.containerservice.v2019_06_01.models.AgentPoolAvailableVersions :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolAvailableVersions"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-06-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] request = build_get_available_agent_pool_versions_request( @@ -544,11 +594,13 @@ async def get_available_agent_pool_versions( resource_name=resource_name, api_version=api_version, template_url=self.get_available_agent_pool_versions.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/aio/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/aio/operations/_managed_clusters_operations.py index 14beff5015b8..76f6f0097da1 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/aio/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/aio/operations/_managed_clusters_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. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ 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 @@ -26,32 +27,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ManagedClustersOperations: - """ManagedClustersOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2019_06_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2019_06_01.aio.ContainerServiceClient`'s + :attr:`managed_clusters` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.ManagedClusterListResult"]: + ) -> AsyncIterable[_models.ManagedClusterListResult]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. The operation returns properties @@ -64,13 +63,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2019_06_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-06-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -78,9 +80,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -88,9 +92,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -128,7 +134,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ManagedClusterListResult"]: + ) -> AsyncIterable[_models.ManagedClusterListResult]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. The operation returns @@ -143,13 +149,16 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2019_06_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-06-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -158,9 +167,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -169,9 +180,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -210,7 +223,7 @@ async def get_upgrade_profile( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedClusterUpgradeProfile": + ) -> _models.ManagedClusterUpgradeProfile: """Gets upgrade profile for a managed cluster. Gets the details of the upgrade profile for a managed cluster with a specified resource group @@ -225,13 +238,16 @@ async def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2019_06_01.models.ManagedClusterUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-06-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] request = build_get_upgrade_profile_request( @@ -240,11 +256,13 @@ async def get_upgrade_profile( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -272,7 +290,7 @@ async def get_access_profile( resource_name: str, role_name: str, **kwargs: Any - ) -> "_models.ManagedClusterAccessProfile": + ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. Gets the accessProfile for the specified role name of the managed cluster with a specified @@ -289,13 +307,16 @@ async def get_access_profile( :rtype: ~azure.mgmt.containerservice.v2019_06_01.models.ManagedClusterAccessProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterAccessProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-06-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] request = build_get_access_profile_request( @@ -305,11 +326,13 @@ async def get_access_profile( role_name=role_name, api_version=api_version, template_url=self.get_access_profile.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -336,7 +359,7 @@ async def list_cluster_admin_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster admin credential of a managed cluster. Gets cluster admin credential of the managed cluster with a specified resource group and name. @@ -350,13 +373,16 @@ async def list_cluster_admin_credentials( :rtype: ~azure.mgmt.containerservice.v2019_06_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2019-06-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_admin_credentials_request( @@ -365,11 +391,13 @@ async def list_cluster_admin_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_admin_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -396,7 +424,7 @@ async def list_cluster_user_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster user credential of a managed cluster. Gets cluster user credential of the managed cluster with a specified resource group and name. @@ -410,13 +438,16 @@ async def list_cluster_user_credentials( :rtype: ~azure.mgmt.containerservice.v2019_06_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-06-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_user_credentials_request( @@ -425,11 +456,13 @@ async def list_cluster_user_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -456,7 +489,7 @@ async def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedCluster": + ) -> _models.ManagedCluster: """Gets a managed cluster. Gets the details of the managed cluster with a specified resource group and name. @@ -470,13 +503,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2019_06_01.models.ManagedCluster :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-06-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] request = build_get_request( @@ -485,11 +521,13 @@ async def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -514,17 +552,20 @@ async def _create_or_update_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2019-06-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'ManagedCluster') @@ -536,11 +577,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -570,9 +613,9 @@ async def begin_create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> AsyncLROPoller["_models.ManagedCluster"]: + ) -> AsyncLROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. Creates or updates a managed cluster with the specified configuration for agents and Kubernetes @@ -598,37 +641,47 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_06_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-06-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -645,17 +698,20 @@ async def _update_tags_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2019-06-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'TagsObject') @@ -667,11 +723,13 @@ async def _update_tags_initial( content_type=content_type, json=_json, template_url=self._update_tags_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -697,9 +755,9 @@ async def begin_update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> AsyncLROPoller["_models.ManagedCluster"]: + ) -> AsyncLROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates a managed cluster with the specified tags. @@ -724,37 +782,47 @@ async def begin_update_tags( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_06_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-06-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._update_tags_initial( + raw_result = await self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -773,13 +841,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-06-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -788,11 +859,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -836,20 +909,25 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-06-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_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) @@ -859,8 +937,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -877,17 +961,20 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2019-06-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') @@ -899,11 +986,13 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist content_type=content_type, json=_json, template_url=self._reset_service_principal_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -925,7 +1014,7 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> AsyncLROPoller[None]: """Reset Service Principal Profile of a managed cluster. @@ -952,23 +1041,28 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-06-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._reset_service_principal_profile_initial( + raw_result = await self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -978,8 +1072,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -996,17 +1096,20 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2019-06-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') @@ -1018,11 +1121,13 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta content_type=content_type, json=_json, template_url=self._reset_aad_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1044,7 +1149,7 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> AsyncLROPoller[None]: """Reset AAD Profile of a managed cluster. @@ -1070,23 +1175,28 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-06-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._reset_aad_profile_initial( + raw_result = await self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1096,8 +1206,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/aio/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/aio/operations/_operations.py index 69e58599f1bf..9310766c942b 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/aio/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/aio/operations/_operations.py @@ -14,6 +14,7 @@ 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 @@ -23,32 +24,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class Operations: - """Operations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2019_06_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2019_06_01.aio.ContainerServiceClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.OperationListResult"]: + ) -> AsyncIterable[_models.OperationListResult]: """Gets a list of compute operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -57,31 +56,38 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2019_06_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-06-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/aio/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/aio/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/models/__init__.py index 8e3cc7d17959..9f2008f20441 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/models/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/models/__init__.py @@ -55,7 +55,9 @@ ScaleSetEvictionPolicy, ScaleSetPriority, ) - +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'AgentPool', 'AgentPoolAvailableVersions', @@ -103,3 +105,5 @@ 'ScaleSetEvictionPolicy', 'ScaleSetPriority', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/models/_container_service_client_enums.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/models/_container_service_client_enums.py index 18f038fe5f80..f2a8ca90fcb1 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/models/_container_service_client_enums.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/models/_container_service_client_enums.py @@ -7,11 +7,10 @@ # -------------------------------------------------------------------------- from enum import Enum -from six import with_metaclass from azure.core import CaseInsensitiveEnumMeta -class AgentPoolType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class AgentPoolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """AgentPoolType represents types of an agent pool. VirtualMachineScaleSets type is still in PREVIEW. """ @@ -19,7 +18,7 @@ class AgentPoolType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): VIRTUAL_MACHINE_SCALE_SETS = "VirtualMachineScaleSets" AVAILABILITY_SET = "AvailabilitySet" -class ContainerServiceStorageProfileTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the orchestrator choice. """ @@ -27,7 +26,7 @@ class ContainerServiceStorageProfileTypes(with_metaclass(CaseInsensitiveEnumMeta STORAGE_ACCOUNT = "StorageAccount" MANAGED_DISKS = "ManagedDisks" -class ContainerServiceVMSizeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Size of agent VMs. """ @@ -206,7 +205,7 @@ class ContainerServiceVMSizeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, E STANDARD_NV24 = "Standard_NV24" STANDARD_NV6 = "Standard_NV6" -class Count(with_metaclass(CaseInsensitiveEnumMeta, int, Enum)): +class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): """Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, and 5. The default value is 1. """ @@ -215,35 +214,35 @@ class Count(with_metaclass(CaseInsensitiveEnumMeta, int, Enum)): THREE = 3 FIVE = 5 -class LoadBalancerSku(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class LoadBalancerSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The load balancer sku for the managed cluster. """ STANDARD = "standard" BASIC = "basic" -class NetworkPlugin(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkPlugin(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Network plugin used for building Kubernetes network. """ AZURE = "azure" KUBENET = "kubenet" -class NetworkPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Network policy used for building Kubernetes network. """ CALICO = "calico" AZURE = "azure" -class OSType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux. """ LINUX = "Linux" WINDOWS = "Windows" -class ResourceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ resource group in agent nodes. Type 'None' will not use MSI for the managed cluster, service @@ -253,7 +252,7 @@ class ResourceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): SYSTEM_ASSIGNED = "SystemAssigned" NONE = "None" -class ScaleSetEvictionPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ScaleSetEvictionPolicy to be used to specify eviction policy for low priority virtual machine scale set. Default to Delete. """ @@ -261,7 +260,7 @@ class ScaleSetEvictionPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)) DELETE = "Delete" DEALLOCATE = "Deallocate" -class ScaleSetPriority(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ScaleSetPriority(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ScaleSetPriority to be used to specify virtual machine scale set priority. Default to regular. """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/models/_models_py3.py index 9f01e52b14f4..5c0100772ebd 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/models/_models_py3.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/models/_models_py3.py @@ -6,11 +6,13 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Dict, List, Optional, Union +from typing import Dict, List, Optional, TYPE_CHECKING, Union import msrest.serialization -from ._container_service_client_enums import * +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + import __init__ as _models class SubResource(msrest.serialization.Model): @@ -66,7 +68,7 @@ class AgentPool(SubResource): :ivar count: Number of agents (VMs) 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: Size of agent VMs. Possible values include: "Standard_A1", "Standard_A10", + :ivar vm_size: Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -115,7 +117,7 @@ class AgentPool(SubResource): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2019_06_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -123,8 +125,8 @@ class AgentPool(SubResource): :vartype min_count: int :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool - :ivar type_properties_type: AgentPoolType represents types of an agent pool. Possible values - include: "VirtualMachineScaleSets", "AvailabilitySet". + :ivar type_properties_type: AgentPoolType represents types of an agent pool. Known values are: + "VirtualMachineScaleSets", "AvailabilitySet". :vartype type_properties_type: str or ~azure.mgmt.containerservice.v2019_06_01.models.AgentPoolType :ivar orchestrator_version: Version of orchestrator specified when creating the managed @@ -139,13 +141,12 @@ class AgentPool(SubResource): :ivar enable_node_public_ip: Enable public IP for nodes. :vartype enable_node_public_ip: bool :ivar scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Possible values include: "Low", "Regular". Default value: - "Regular". + priority. Default to regular. Known values are: "Low", "Regular". Default value: "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2019_06_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy - for low priority virtual machine scale set. Default to Delete. Possible values include: - "Delete", "Deallocate". Default value: "Delete". + for low priority virtual machine scale set. Default to Delete. Known values are: "Delete", + "Deallocate". Default value: "Delete". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2019_06_01.models.ScaleSetEvictionPolicy :ivar node_taints: Taints added to new nodes during node pool create and scale. For example, @@ -188,20 +189,20 @@ def __init__( self, *, count: Optional[int] = None, - vm_size: Optional[Union[str, "ContainerServiceVMSizeTypes"]] = None, + vm_size: Optional[Union[str, "_models.ContainerServiceVMSizeTypes"]] = None, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - type_properties_type: Optional[Union[str, "AgentPoolType"]] = None, + type_properties_type: Optional[Union[str, "_models.AgentPoolType"]] = None, orchestrator_version: Optional[str] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, - scale_set_priority: Optional[Union[str, "ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", node_taints: Optional[List[str]] = None, **kwargs ): @@ -209,7 +210,7 @@ def __init__( :keyword count: Number of agents (VMs) 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: Size of agent VMs. Possible values include: "Standard_A1", "Standard_A10", + :keyword vm_size: Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -258,7 +259,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2019_06_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -266,8 +267,8 @@ def __init__( :paramtype min_count: int :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool - :keyword type_properties_type: AgentPoolType represents types of an agent pool. Possible values - include: "VirtualMachineScaleSets", "AvailabilitySet". + :keyword type_properties_type: AgentPoolType represents types of an agent pool. Known values + are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type_properties_type: str or ~azure.mgmt.containerservice.v2019_06_01.models.AgentPoolType :keyword orchestrator_version: Version of orchestrator specified when creating the managed @@ -279,12 +280,11 @@ def __init__( :keyword enable_node_public_ip: Enable public IP for nodes. :paramtype enable_node_public_ip: bool :keyword scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Possible values include: "Low", "Regular". Default value: - "Regular". + priority. Default to regular. Known values are: "Low", "Regular". Default value: "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2019_06_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction - policy for low priority virtual machine scale set. Default to Delete. Possible values include: + policy for low priority virtual machine scale set. Default to Delete. Known values are: "Delete", "Deallocate". Default value: "Delete". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2019_06_01.models.ScaleSetEvictionPolicy @@ -344,7 +344,7 @@ class AgentPoolAvailableVersions(msrest.serialization.Model): def __init__( self, *, - agent_pool_versions: Optional[List["AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem"]] = None, + agent_pool_versions: Optional[List["_models.AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem"]] = None, **kwargs ): """ @@ -421,7 +421,7 @@ class AgentPoolListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["AgentPool"]] = None, + value: Optional[List["_models.AgentPool"]] = None, **kwargs ): """ @@ -449,7 +449,7 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): :ivar kubernetes_version: Required. Kubernetes version (major, minor, patch). :vartype kubernetes_version: str :ivar os_type: Required. OsType to be used to specify os type. Choose from Linux and Windows. - Default to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2019_06_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -477,15 +477,15 @@ def __init__( self, *, kubernetes_version: str, - os_type: Union[str, "OSType"] = "Linux", - upgrades: Optional[List["AgentPoolUpgradeProfilePropertiesUpgradesItem"]] = None, + os_type: Union[str, "_models.OSType"] = "Linux", + upgrades: Optional[List["_models.AgentPoolUpgradeProfilePropertiesUpgradesItem"]] = None, **kwargs ): """ :keyword kubernetes_version: Required. Kubernetes version (major, minor, patch). :paramtype kubernetes_version: str :keyword os_type: Required. OsType to be used to specify os type. Choose from Linux and - Windows. Default to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Windows. Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2019_06_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: @@ -561,7 +561,7 @@ def __init__( code: Optional[str] = None, message: Optional[str] = None, target: Optional[str] = None, - details: Optional[List["CloudErrorBody"]] = None, + details: Optional[List["_models.CloudErrorBody"]] = None, **kwargs ): """ @@ -605,7 +605,7 @@ class ContainerServiceDiagnosticsProfile(msrest.serialization.Model): def __init__( self, *, - vm_diagnostics: "ContainerServiceVMDiagnostics", + vm_diagnostics: "_models.ContainerServiceVMDiagnostics", **kwargs ): """ @@ -642,7 +642,7 @@ def __init__( self, *, admin_username: str, - ssh: "ContainerServiceSshConfiguration", + ssh: "_models.ContainerServiceSshConfiguration", **kwargs ): """ @@ -665,17 +665,17 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar count: Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, - and 5. The default value is 1. Possible values include: 1, 3, 5. Default value: "1". + and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". :vartype count: int or ~azure.mgmt.containerservice.v2019_06_01.models.Count :ivar dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. :vartype dns_prefix: str - :ivar vm_size: Required. Size of agent VMs. Possible values include: "Standard_A1", - "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", - "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", - "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", - "Standard_A8m_v2", "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", - "Standard_B8ms", "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", - "Standard_D12", "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", + :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", + "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", + "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", + "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", "Standard_B8ms", + "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", "Standard_D12", + "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", "Standard_D13_v2_Promo", "Standard_D14", "Standard_D14_v2", "Standard_D14_v2_Promo", "Standard_D15_v2", "Standard_D16_v3", "Standard_D16s_v3", "Standard_D1_v2", "Standard_D2", "Standard_D2_v2", "Standard_D2_v2_Promo", "Standard_D2_v3", "Standard_D2s_v3", "Standard_D3", @@ -720,7 +720,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): :vartype first_consecutive_static_ip: str :ivar storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Possible values include: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". :vartype storage_profile: str or ~azure.mgmt.containerservice.v2019_06_01.models.ContainerServiceStorageProfileTypes :ivar fqdn: FQDN for the master pool. @@ -749,27 +749,27 @@ def __init__( self, *, dns_prefix: str, - vm_size: Union[str, "ContainerServiceVMSizeTypes"], - count: Optional[Union[int, "Count"]] = 1, + vm_size: Union[str, "_models.ContainerServiceVMSizeTypes"], + count: Optional[Union[int, "_models.Count"]] = 1, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, first_consecutive_static_ip: Optional[str] = "10.240.255.5", - storage_profile: Optional[Union[str, "ContainerServiceStorageProfileTypes"]] = None, + storage_profile: Optional[Union[str, "_models.ContainerServiceStorageProfileTypes"]] = None, **kwargs ): """ :keyword count: Number of masters (VMs) in the container service cluster. Allowed values are 1, - 3, and 5. The default value is 1. Possible values include: 1, 3, 5. Default value: "1". + 3, and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". :paramtype count: int or ~azure.mgmt.containerservice.v2019_06_01.models.Count :keyword dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. :paramtype dns_prefix: str - :keyword vm_size: Required. Size of agent VMs. Possible values include: "Standard_A1", - "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", - "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", - "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", - "Standard_A8m_v2", "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", - "Standard_B8ms", "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", - "Standard_D12", "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", + :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", + "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", + "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", + "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", "Standard_B8ms", + "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", "Standard_D12", + "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", "Standard_D13_v2_Promo", "Standard_D14", "Standard_D14_v2", "Standard_D14_v2_Promo", "Standard_D15_v2", "Standard_D16_v3", "Standard_D16s_v3", "Standard_D1_v2", "Standard_D2", "Standard_D2_v2", "Standard_D2_v2_Promo", "Standard_D2_v3", "Standard_D2s_v3", "Standard_D3", @@ -814,7 +814,7 @@ def __init__( :paramtype first_consecutive_static_ip: str :keyword storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Possible values include: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". :paramtype storage_profile: str or ~azure.mgmt.containerservice.v2019_06_01.models.ContainerServiceStorageProfileTypes """ @@ -832,11 +832,11 @@ def __init__( class ContainerServiceNetworkProfile(msrest.serialization.Model): """Profile of network configuration. - :ivar network_plugin: Network plugin used for building Kubernetes network. Possible values - include: "azure", "kubenet". Default value: "kubenet". + :ivar network_plugin: Network plugin used for building Kubernetes network. Known values are: + "azure", "kubenet". Default value: "kubenet". :vartype network_plugin: str or ~azure.mgmt.containerservice.v2019_06_01.models.NetworkPlugin - :ivar network_policy: Network policy used for building Kubernetes network. Possible values - include: "calico", "azure". + :ivar network_policy: Network policy used for building Kubernetes network. Known values are: + "calico", "azure". :vartype network_policy: str or ~azure.mgmt.containerservice.v2019_06_01.models.NetworkPolicy :ivar pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :vartype pod_cidr: str @@ -849,8 +849,8 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): :ivar docker_bridge_cidr: A CIDR notation IP range assigned to the Docker bridge network. It must not overlap with any Subnet IP ranges or the Kubernetes service address range. :vartype docker_bridge_cidr: str - :ivar load_balancer_sku: The load balancer sku for the managed cluster. Possible values - include: "standard", "basic". + :ivar load_balancer_sku: The load balancer sku for the managed cluster. Known values are: + "standard", "basic". :vartype load_balancer_sku: str or ~azure.mgmt.containerservice.v2019_06_01.models.LoadBalancerSku """ @@ -875,21 +875,21 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): def __init__( self, *, - network_plugin: Optional[Union[str, "NetworkPlugin"]] = "kubenet", - network_policy: Optional[Union[str, "NetworkPolicy"]] = None, + network_plugin: Optional[Union[str, "_models.NetworkPlugin"]] = "kubenet", + network_policy: Optional[Union[str, "_models.NetworkPolicy"]] = None, pod_cidr: Optional[str] = "10.244.0.0/16", service_cidr: Optional[str] = "10.0.0.0/16", dns_service_ip: Optional[str] = "10.0.0.10", docker_bridge_cidr: Optional[str] = "172.17.0.1/16", - load_balancer_sku: Optional[Union[str, "LoadBalancerSku"]] = None, + load_balancer_sku: Optional[Union[str, "_models.LoadBalancerSku"]] = None, **kwargs ): """ - :keyword network_plugin: Network plugin used for building Kubernetes network. Possible values - include: "azure", "kubenet". Default value: "kubenet". + :keyword network_plugin: Network plugin used for building Kubernetes network. Known values are: + "azure", "kubenet". Default value: "kubenet". :paramtype network_plugin: str or ~azure.mgmt.containerservice.v2019_06_01.models.NetworkPlugin - :keyword network_policy: Network policy used for building Kubernetes network. Possible values - include: "calico", "azure". + :keyword network_policy: Network policy used for building Kubernetes network. Known values are: + "calico", "azure". :paramtype network_policy: str or ~azure.mgmt.containerservice.v2019_06_01.models.NetworkPolicy :keyword pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :paramtype pod_cidr: str @@ -902,8 +902,8 @@ def __init__( :keyword docker_bridge_cidr: A CIDR notation IP range assigned to the Docker bridge network. It must not overlap with any Subnet IP ranges or the Kubernetes service address range. :paramtype docker_bridge_cidr: str - :keyword load_balancer_sku: The load balancer sku for the managed cluster. Possible values - include: "standard", "basic". + :keyword load_balancer_sku: The load balancer sku for the managed cluster. Known values are: + "standard", "basic". :paramtype load_balancer_sku: str or ~azure.mgmt.containerservice.v2019_06_01.models.LoadBalancerSku """ @@ -939,7 +939,7 @@ class ContainerServiceSshConfiguration(msrest.serialization.Model): def __init__( self, *, - public_keys: List["ContainerServiceSshPublicKey"], + public_keys: List["_models.ContainerServiceSshPublicKey"], **kwargs ): """ @@ -1240,19 +1240,19 @@ def __init__( *, location: str, tags: Optional[Dict[str, str]] = None, - identity: Optional["ManagedClusterIdentity"] = None, + identity: Optional["_models.ManagedClusterIdentity"] = None, kubernetes_version: Optional[str] = None, dns_prefix: Optional[str] = None, - agent_pool_profiles: Optional[List["ManagedClusterAgentPoolProfile"]] = None, - linux_profile: Optional["ContainerServiceLinuxProfile"] = None, - windows_profile: Optional["ManagedClusterWindowsProfile"] = None, - service_principal_profile: Optional["ManagedClusterServicePrincipalProfile"] = None, - addon_profiles: Optional[Dict[str, "ManagedClusterAddonProfile"]] = None, + agent_pool_profiles: Optional[List["_models.ManagedClusterAgentPoolProfile"]] = None, + linux_profile: Optional["_models.ContainerServiceLinuxProfile"] = None, + windows_profile: Optional["_models.ManagedClusterWindowsProfile"] = None, + service_principal_profile: Optional["_models.ManagedClusterServicePrincipalProfile"] = None, + addon_profiles: Optional[Dict[str, "_models.ManagedClusterAddonProfile"]] = None, node_resource_group: Optional[str] = None, enable_rbac: Optional[bool] = None, enable_pod_security_policy: Optional[bool] = None, - network_profile: Optional["ContainerServiceNetworkProfile"] = None, - aad_profile: Optional["ManagedClusterAADProfile"] = None, + network_profile: Optional["_models.ContainerServiceNetworkProfile"] = None, + aad_profile: Optional["_models.ManagedClusterAADProfile"] = None, api_server_authorized_ip_ranges: Optional[List[str]] = None, **kwargs ): @@ -1479,7 +1479,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar count: Number of agents (VMs) 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: Size of agent VMs. Possible values include: "Standard_A1", "Standard_A10", + :ivar vm_size: Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -1528,7 +1528,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2019_06_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -1536,7 +1536,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :vartype min_count: int :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool - :ivar type: AgentPoolType represents types of an agent pool. Possible values include: + :ivar type: AgentPoolType represents types of an agent pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2019_06_01.models.AgentPoolType :ivar orchestrator_version: Version of orchestrator specified when creating the managed @@ -1551,13 +1551,12 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar enable_node_public_ip: Enable public IP for nodes. :vartype enable_node_public_ip: bool :ivar scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Possible values include: "Low", "Regular". Default value: - "Regular". + priority. Default to regular. Known values are: "Low", "Regular". Default value: "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2019_06_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy - for low priority virtual machine scale set. Default to Delete. Possible values include: - "Delete", "Deallocate". Default value: "Delete". + for low priority virtual machine scale set. Default to Delete. Known values are: "Delete", + "Deallocate". Default value: "Delete". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2019_06_01.models.ScaleSetEvictionPolicy :ivar node_taints: Taints added to new nodes during node pool create and scale. For example, @@ -1594,20 +1593,20 @@ def __init__( self, *, count: Optional[int] = None, - vm_size: Optional[Union[str, "ContainerServiceVMSizeTypes"]] = None, + vm_size: Optional[Union[str, "_models.ContainerServiceVMSizeTypes"]] = None, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - type: Optional[Union[str, "AgentPoolType"]] = None, + type: Optional[Union[str, "_models.AgentPoolType"]] = None, orchestrator_version: Optional[str] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, - scale_set_priority: Optional[Union[str, "ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", node_taints: Optional[List[str]] = None, **kwargs ): @@ -1615,7 +1614,7 @@ def __init__( :keyword count: Number of agents (VMs) 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: Size of agent VMs. Possible values include: "Standard_A1", "Standard_A10", + :keyword vm_size: Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -1664,7 +1663,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2019_06_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -1672,7 +1671,7 @@ def __init__( :paramtype min_count: int :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool - :keyword type: AgentPoolType represents types of an agent pool. Possible values include: + :keyword type: AgentPoolType represents types of an agent pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2019_06_01.models.AgentPoolType :keyword orchestrator_version: Version of orchestrator specified when creating the managed @@ -1684,12 +1683,11 @@ def __init__( :keyword enable_node_public_ip: Enable public IP for nodes. :paramtype enable_node_public_ip: bool :keyword scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Possible values include: "Low", "Regular". Default value: - "Regular". + priority. Default to regular. Known values are: "Low", "Regular". Default value: "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2019_06_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction - policy for low priority virtual machine scale set. Default to Delete. Possible values include: + policy for low priority virtual machine scale set. Default to Delete. Known values are: "Delete", "Deallocate". Default value: "Delete". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2019_06_01.models.ScaleSetEvictionPolicy @@ -1727,7 +1725,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar count: Number of agents (VMs) 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: Size of agent VMs. Possible values include: "Standard_A1", "Standard_A10", + :ivar vm_size: Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -1776,7 +1774,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2019_06_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -1784,7 +1782,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :vartype min_count: int :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool - :ivar type: AgentPoolType represents types of an agent pool. Possible values include: + :ivar type: AgentPoolType represents types of an agent pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2019_06_01.models.AgentPoolType :ivar orchestrator_version: Version of orchestrator specified when creating the managed @@ -1799,13 +1797,12 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar enable_node_public_ip: Enable public IP for nodes. :vartype enable_node_public_ip: bool :ivar scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Possible values include: "Low", "Regular". Default value: - "Regular". + priority. Default to regular. Known values are: "Low", "Regular". Default value: "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2019_06_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy - for low priority virtual machine scale set. Default to Delete. Possible values include: - "Delete", "Deallocate". Default value: "Delete". + for low priority virtual machine scale set. Default to Delete. Known values are: "Delete", + "Deallocate". Default value: "Delete". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2019_06_01.models.ScaleSetEvictionPolicy :ivar node_taints: Taints added to new nodes during node pool create and scale. For example, @@ -1848,20 +1845,20 @@ def __init__( *, name: str, count: Optional[int] = None, - vm_size: Optional[Union[str, "ContainerServiceVMSizeTypes"]] = None, + vm_size: Optional[Union[str, "_models.ContainerServiceVMSizeTypes"]] = None, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - type: Optional[Union[str, "AgentPoolType"]] = None, + type: Optional[Union[str, "_models.AgentPoolType"]] = None, orchestrator_version: Optional[str] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, - scale_set_priority: Optional[Union[str, "ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", node_taints: Optional[List[str]] = None, **kwargs ): @@ -1869,7 +1866,7 @@ def __init__( :keyword count: Number of agents (VMs) 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: Size of agent VMs. Possible values include: "Standard_A1", "Standard_A10", + :keyword vm_size: Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -1918,7 +1915,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2019_06_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -1926,7 +1923,7 @@ def __init__( :paramtype min_count: int :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool - :keyword type: AgentPoolType represents types of an agent pool. Possible values include: + :keyword type: AgentPoolType represents types of an agent pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2019_06_01.models.AgentPoolType :keyword orchestrator_version: Version of orchestrator specified when creating the managed @@ -1938,12 +1935,11 @@ def __init__( :keyword enable_node_public_ip: Enable public IP for nodes. :paramtype enable_node_public_ip: bool :keyword scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Possible values include: "Low", "Regular". Default value: - "Regular". + priority. Default to regular. Known values are: "Low", "Regular". Default value: "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2019_06_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction - policy for low priority virtual machine scale set. Default to Delete. Possible values include: + policy for low priority virtual machine scale set. Default to Delete. Known values are: "Delete", "Deallocate". Default value: "Delete". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2019_06_01.models.ScaleSetEvictionPolicy @@ -1972,7 +1968,7 @@ class ManagedClusterIdentity(msrest.serialization.Model): :ivar type: The type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ resource group in agent nodes. Type 'None' will not use MSI for the managed cluster, - service principal will be used instead. Possible values include: "SystemAssigned", "None". + service principal will be used instead. Known values are: "SystemAssigned", "None". :vartype type: str or ~azure.mgmt.containerservice.v2019_06_01.models.ResourceIdentityType """ @@ -1990,15 +1986,14 @@ class ManagedClusterIdentity(msrest.serialization.Model): def __init__( self, *, - type: Optional[Union[str, "ResourceIdentityType"]] = None, + type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, **kwargs ): """ :keyword type: The type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ resource group in agent nodes. Type 'None' will not use MSI for the managed - cluster, service principal will be used instead. Possible values include: "SystemAssigned", - "None". + cluster, service principal will be used instead. Known values are: "SystemAssigned", "None". :paramtype type: str or ~azure.mgmt.containerservice.v2019_06_01.models.ResourceIdentityType """ super(ManagedClusterIdentity, self).__init__(**kwargs) @@ -2030,7 +2025,7 @@ class ManagedClusterListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["ManagedCluster"]] = None, + value: Optional[List["_models.ManagedCluster"]] = None, **kwargs ): """ @@ -2052,7 +2047,7 @@ class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): :ivar name: Pool name. :vartype name: str :ivar os_type: Required. OsType to be used to specify os type. Choose from Linux and Windows. - Default to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2019_06_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -2075,9 +2070,9 @@ def __init__( self, *, kubernetes_version: str, - os_type: Union[str, "OSType"] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", name: Optional[str] = None, - upgrades: Optional[List["ManagedClusterPoolUpgradeProfileUpgradesItem"]] = None, + upgrades: Optional[List["_models.ManagedClusterPoolUpgradeProfileUpgradesItem"]] = None, **kwargs ): """ @@ -2086,7 +2081,7 @@ def __init__( :keyword name: Pool name. :paramtype name: str :keyword os_type: Required. OsType to be used to specify os type. Choose from Linux and - Windows. Default to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Windows. Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2019_06_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: @@ -2210,8 +2205,8 @@ class ManagedClusterUpgradeProfile(msrest.serialization.Model): def __init__( self, *, - control_plane_profile: "ManagedClusterPoolUpgradeProfile", - agent_pool_profiles: List["ManagedClusterPoolUpgradeProfile"], + control_plane_profile: "_models.ManagedClusterPoolUpgradeProfile", + agent_pool_profiles: List["_models.ManagedClusterPoolUpgradeProfile"], **kwargs ): """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/models/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/models/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/operations/__init__.py index 5aac40228eec..403c0174f052 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/operations/__init__.py @@ -10,8 +10,13 @@ from ._managed_clusters_operations import ManagedClustersOperations from ._agent_pools_operations import AgentPoolsOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'Operations', 'ManagedClustersOperations', 'AgentPoolsOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/operations/_agent_pools_operations.py index acb50e3fff60..67e5b285cf7b 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/operations/_agent_pools_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -35,9 +35,12 @@ def build_list_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-06-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools") # pylint: disable=line-too-long path_format_arguments = { @@ -49,18 +52,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -72,9 +73,12 @@ def build_get_request( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-06-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -87,18 +91,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -109,14 +111,17 @@ def build_create_or_update_request_initial( resource_name: str, agent_pool_name: str, *, - json: JSONType = None, + json: Optional[_models.AgentPool] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-06-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -129,20 +134,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -156,9 +159,12 @@ def build_delete_request_initial( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-06-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -171,18 +177,16 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -194,9 +198,12 @@ def build_get_upgrade_profile_request( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-06-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default") # pylint: disable=line-too-long path_format_arguments = { @@ -209,18 +216,16 @@ def build_get_upgrade_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -231,9 +236,12 @@ def build_get_available_agent_pool_versions_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-06-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions") # pylint: disable=line-too-long path_format_arguments = { @@ -245,42 +253,38 @@ def build_get_available_agent_pool_versions_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class AgentPoolsOperations(object): - """AgentPoolsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class AgentPoolsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2019_06_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2019_06_01.ContainerServiceClient`'s + :attr:`agent_pools` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -288,7 +292,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Iterable["_models.AgentPoolListResult"]: + ) -> Iterable[_models.AgentPoolListResult]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. The operation returns properties @@ -304,13 +308,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2019_06_01.models.AgentPoolListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-06-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -320,9 +327,11 @@ def prepare_request(next_link=None): resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -332,9 +341,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -374,7 +385,7 @@ def get( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPool": + ) -> _models.AgentPool: """Gets the agent pool. Gets the details of the agent pool by managed cluster and resource group. @@ -390,13 +401,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2019_06_01.models.AgentPool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-06-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] request = build_get_request( @@ -406,11 +420,13 @@ def get( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -436,17 +452,20 @@ def _create_or_update_initial( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> "_models.AgentPool": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] + ) -> _models.AgentPool: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2019-06-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] _json = self._serialize.body(parameters, 'AgentPool') @@ -459,11 +478,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -494,9 +515,9 @@ def begin_create_or_update( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> LROPoller["_models.AgentPool"]: + ) -> LROPoller[_models.AgentPool]: """Creates or updates an agent pool. Creates or updates an agent pool in the specified managed cluster. @@ -522,17 +543,20 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_06_01.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-06-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, @@ -540,20 +564,27 @@ def begin_create_or_update( 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): - response = pipeline_response.http_response deserialized = self._deserialize('AgentPool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -573,13 +604,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements agent_pool_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2019-06-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -589,11 +623,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -640,21 +676,26 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-06-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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) @@ -664,8 +705,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -685,7 +732,7 @@ def get_upgrade_profile( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPoolUpgradeProfile": + ) -> _models.AgentPoolUpgradeProfile: """Gets upgrade profile for an agent pool. Gets the details of the upgrade profile for an agent pool with a specified resource group and @@ -702,13 +749,16 @@ def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2019_06_01.models.AgentPoolUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-06-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] request = build_get_upgrade_profile_request( @@ -718,11 +768,13 @@ def get_upgrade_profile( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -749,7 +801,7 @@ def get_available_agent_pool_versions( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.AgentPoolAvailableVersions": + ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported versions for the specified agent pool. Gets a list of supported versions for the specified agent pool. @@ -763,13 +815,16 @@ def get_available_agent_pool_versions( :rtype: ~azure.mgmt.containerservice.v2019_06_01.models.AgentPoolAvailableVersions :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolAvailableVersions"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-06-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] request = build_get_available_agent_pool_versions_request( @@ -778,11 +833,13 @@ def get_available_agent_pool_versions( resource_name=resource_name, api_version=api_version, template_url=self.get_available_agent_pool_versions.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/operations/_managed_clusters_operations.py index 649e09708545..ed084edeb284 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/operations/_managed_clusters_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -33,9 +33,12 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-06-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters") path_format_arguments = { @@ -45,18 +48,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -66,9 +67,12 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-06-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters") # pylint: disable=line-too-long path_format_arguments = { @@ -79,18 +83,16 @@ def build_list_by_resource_group_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -101,9 +103,12 @@ def build_get_upgrade_profile_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-06-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default") # pylint: disable=line-too-long path_format_arguments = { @@ -115,18 +120,16 @@ def build_get_upgrade_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -138,9 +141,12 @@ def build_get_access_profile_request( role_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-06-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -153,18 +159,16 @@ def build_get_access_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -175,9 +179,12 @@ def build_list_cluster_admin_credentials_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-06-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -189,18 +196,16 @@ def build_list_cluster_admin_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -211,9 +216,12 @@ def build_list_cluster_user_credentials_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-06-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -225,18 +233,16 @@ def build_list_cluster_user_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -247,9 +253,12 @@ def build_get_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-06-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -261,18 +270,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -282,14 +289,17 @@ def build_create_or_update_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedCluster] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-06-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -301,20 +311,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -326,14 +334,17 @@ def build_update_tags_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.TagsObject] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-06-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -345,20 +356,18 @@ def build_update_tags_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -371,9 +380,12 @@ def build_delete_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-06-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -385,18 +397,16 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -406,14 +416,17 @@ def build_reset_service_principal_profile_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedClusterServicePrincipalProfile] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-06-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile") # pylint: disable=line-too-long path_format_arguments = { @@ -425,20 +438,18 @@ def build_reset_service_principal_profile_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -450,14 +461,17 @@ def build_reset_aad_profile_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedClusterAADProfile] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-06-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile") # pylint: disable=line-too-long path_format_arguments = { @@ -469,52 +483,48 @@ def build_reset_aad_profile_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs ) -class ManagedClustersOperations(object): - """ManagedClustersOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ManagedClustersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2019_06_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2019_06_01.ContainerServiceClient`'s + :attr:`managed_clusters` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> Iterable["_models.ManagedClusterListResult"]: + ) -> Iterable[_models.ManagedClusterListResult]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. The operation returns properties @@ -527,13 +537,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2019_06_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-06-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -541,9 +554,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -551,9 +566,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -591,7 +608,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.ManagedClusterListResult"]: + ) -> Iterable[_models.ManagedClusterListResult]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. The operation returns @@ -606,13 +623,16 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2019_06_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-06-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -621,9 +641,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -632,9 +654,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -673,7 +697,7 @@ def get_upgrade_profile( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedClusterUpgradeProfile": + ) -> _models.ManagedClusterUpgradeProfile: """Gets upgrade profile for a managed cluster. Gets the details of the upgrade profile for a managed cluster with a specified resource group @@ -688,13 +712,16 @@ def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2019_06_01.models.ManagedClusterUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-06-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] request = build_get_upgrade_profile_request( @@ -703,11 +730,13 @@ def get_upgrade_profile( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -735,7 +764,7 @@ def get_access_profile( resource_name: str, role_name: str, **kwargs: Any - ) -> "_models.ManagedClusterAccessProfile": + ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. Gets the accessProfile for the specified role name of the managed cluster with a specified @@ -752,13 +781,16 @@ def get_access_profile( :rtype: ~azure.mgmt.containerservice.v2019_06_01.models.ManagedClusterAccessProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterAccessProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2019-06-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] request = build_get_access_profile_request( @@ -768,11 +800,13 @@ def get_access_profile( role_name=role_name, api_version=api_version, template_url=self.get_access_profile.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -799,7 +833,7 @@ def list_cluster_admin_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster admin credential of a managed cluster. Gets cluster admin credential of the managed cluster with a specified resource group and name. @@ -813,13 +847,16 @@ def list_cluster_admin_credentials( :rtype: ~azure.mgmt.containerservice.v2019_06_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-06-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_admin_credentials_request( @@ -828,11 +865,13 @@ def list_cluster_admin_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_admin_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -859,7 +898,7 @@ def list_cluster_user_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster user credential of a managed cluster. Gets cluster user credential of the managed cluster with a specified resource group and name. @@ -873,13 +912,16 @@ def list_cluster_user_credentials( :rtype: ~azure.mgmt.containerservice.v2019_06_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2019-06-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_user_credentials_request( @@ -888,11 +930,13 @@ def list_cluster_user_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -919,7 +963,7 @@ def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedCluster": + ) -> _models.ManagedCluster: """Gets a managed cluster. Gets the details of the managed cluster with a specified resource group and name. @@ -933,13 +977,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2019_06_01.models.ManagedCluster :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-06-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] request = build_get_request( @@ -948,11 +995,13 @@ def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -977,17 +1026,20 @@ def _create_or_update_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2019-06-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'ManagedCluster') @@ -999,11 +1051,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1033,9 +1087,9 @@ def begin_create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> LROPoller["_models.ManagedCluster"]: + ) -> LROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. Creates or updates a managed cluster with the specified configuration for agents and Kubernetes @@ -1061,37 +1115,47 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_06_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-06-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1108,17 +1172,20 @@ def _update_tags_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2019-06-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'TagsObject') @@ -1130,11 +1197,13 @@ def _update_tags_initial( content_type=content_type, json=_json, template_url=self._update_tags_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1160,9 +1229,9 @@ def begin_update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> LROPoller["_models.ManagedCluster"]: + ) -> LROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates a managed cluster with the specified tags. @@ -1187,37 +1256,47 @@ def begin_update_tags( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_06_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-06-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._update_tags_initial( + raw_result = self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1236,13 +1315,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2019-06-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -1251,11 +1333,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1299,20 +1383,25 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-06-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_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) @@ -1322,8 +1411,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1340,17 +1435,20 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2019-06-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') @@ -1362,11 +1460,13 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re content_type=content_type, json=_json, template_url=self._reset_service_principal_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1388,7 +1488,7 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> LROPoller[None]: """Reset Service Principal Profile of a managed cluster. @@ -1415,23 +1515,28 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-06-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._reset_service_principal_profile_initial( + raw_result = self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1441,8 +1546,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1459,17 +1570,20 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2019-06-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') @@ -1481,11 +1595,13 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement content_type=content_type, json=_json, template_url=self._reset_aad_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1507,7 +1623,7 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> LROPoller[None]: """Reset AAD Profile of a managed cluster. @@ -1533,23 +1649,28 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-06-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._reset_aad_profile_initial( + raw_result = self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1559,8 +1680,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/operations/_operations.py index a93e73245510..9317adca4ae1 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/operations/_operations.py @@ -16,6 +16,7 @@ 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 @@ -29,55 +30,54 @@ def build_list_request( **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-06-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.ContainerService/operations") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class Operations(object): - """Operations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2019_06_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2019_06_01.ContainerServiceClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> Iterable["_models.OperationListResult"]: + ) -> Iterable[_models.OperationListResult]: """Gets a list of compute operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -86,31 +86,38 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2019_06_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-06-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_06_01/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/__init__.py index 53c675bd95e2..37a5f9e02e6f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._container_service_client import ContainerServiceClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['ContainerServiceClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/_container_service_client.py index 6556760aeb55..f0970f8e9784 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/_container_service_client.py @@ -60,9 +60,15 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.managed_clusters = ManagedClustersOperations(self._client, self._config, self._serialize, self._deserialize) - self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_clusters = ManagedClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.agent_pools = AgentPoolsOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/aio/__init__.py index 53c675bd95e2..37a5f9e02e6f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/aio/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/aio/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._container_service_client import ContainerServiceClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['ContainerServiceClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/aio/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/aio/_container_service_client.py index e1be40c90721..e0b9eef51ecf 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/aio/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/aio/_container_service_client.py @@ -61,9 +61,15 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.managed_clusters = ManagedClustersOperations(self._client, self._config, self._serialize, self._deserialize) - self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_clusters = ManagedClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.agent_pools = AgentPoolsOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/aio/operations/__init__.py index 5aac40228eec..403c0174f052 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/aio/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/aio/operations/__init__.py @@ -10,8 +10,13 @@ from ._managed_clusters_operations import ManagedClustersOperations from ._agent_pools_operations import AgentPoolsOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'Operations', 'ManagedClustersOperations', 'AgentPoolsOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/aio/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/aio/operations/_agent_pools_operations.py index 74b98f1fe5eb..84a42659ad19 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/aio/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/aio/operations/_agent_pools_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. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ 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 @@ -26,26 +27,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class AgentPoolsOperations: - """AgentPoolsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2019_08_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2019_08_01.aio.ContainerServiceClient`'s + :attr:`agent_pools` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -53,7 +52,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> AsyncIterable["_models.AgentPoolListResult"]: + ) -> AsyncIterable[_models.AgentPoolListResult]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. The operation returns properties @@ -69,13 +68,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2019_08_01.models.AgentPoolListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-08-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -85,9 +87,11 @@ def prepare_request(next_link=None): resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -97,9 +101,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -139,7 +145,7 @@ async def get( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPool": + ) -> _models.AgentPool: """Gets the agent pool. Gets the details of the agent pool by managed cluster and resource group. @@ -155,13 +161,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2019_08_01.models.AgentPool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-08-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] request = build_get_request( @@ -171,11 +180,13 @@ async def get( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -201,17 +212,20 @@ async def _create_or_update_initial( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> "_models.AgentPool": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] + ) -> _models.AgentPool: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2019-08-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] _json = self._serialize.body(parameters, 'AgentPool') @@ -224,11 +238,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -259,9 +275,9 @@ async def begin_create_or_update( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> AsyncLROPoller["_models.AgentPool"]: + ) -> AsyncLROPoller[_models.AgentPool]: """Creates or updates an agent pool. Creates or updates an agent pool in the specified managed cluster. @@ -288,17 +304,20 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_08_01.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-08-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, @@ -306,20 +325,27 @@ async def begin_create_or_update( 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): - response = pipeline_response.http_response deserialized = self._deserialize('AgentPool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -339,13 +365,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements agent_pool_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-08-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -355,11 +384,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -406,21 +437,26 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-08-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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) @@ -430,8 +466,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -451,7 +493,7 @@ async def get_upgrade_profile( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPoolUpgradeProfile": + ) -> _models.AgentPoolUpgradeProfile: """Gets upgrade profile for an agent pool. Gets the details of the upgrade profile for an agent pool with a specified resource group and @@ -468,13 +510,16 @@ async def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2019_08_01.models.AgentPoolUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2019-08-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] request = build_get_upgrade_profile_request( @@ -484,11 +529,13 @@ async def get_upgrade_profile( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -515,7 +562,7 @@ async def get_available_agent_pool_versions( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.AgentPoolAvailableVersions": + ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported versions for the specified agent pool. Gets a list of supported versions for the specified agent pool. @@ -529,13 +576,16 @@ async def get_available_agent_pool_versions( :rtype: ~azure.mgmt.containerservice.v2019_08_01.models.AgentPoolAvailableVersions :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolAvailableVersions"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-08-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] request = build_get_available_agent_pool_versions_request( @@ -544,11 +594,13 @@ async def get_available_agent_pool_versions( resource_name=resource_name, api_version=api_version, template_url=self.get_available_agent_pool_versions.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/aio/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/aio/operations/_managed_clusters_operations.py index 332c546fe2c8..0dea25852d39 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/aio/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/aio/operations/_managed_clusters_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. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ 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 @@ -26,32 +27,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ManagedClustersOperations: - """ManagedClustersOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2019_08_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2019_08_01.aio.ContainerServiceClient`'s + :attr:`managed_clusters` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.ManagedClusterListResult"]: + ) -> AsyncIterable[_models.ManagedClusterListResult]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. The operation returns properties @@ -64,13 +63,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2019_08_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-08-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -78,9 +80,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -88,9 +92,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -128,7 +134,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ManagedClusterListResult"]: + ) -> AsyncIterable[_models.ManagedClusterListResult]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. The operation returns @@ -143,13 +149,16 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2019_08_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-08-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -158,9 +167,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -169,9 +180,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -210,7 +223,7 @@ async def get_upgrade_profile( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedClusterUpgradeProfile": + ) -> _models.ManagedClusterUpgradeProfile: """Gets upgrade profile for a managed cluster. Gets the details of the upgrade profile for a managed cluster with a specified resource group @@ -225,13 +238,16 @@ async def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2019_08_01.models.ManagedClusterUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-08-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] request = build_get_upgrade_profile_request( @@ -240,11 +256,13 @@ async def get_upgrade_profile( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -272,7 +290,7 @@ async def get_access_profile( resource_name: str, role_name: str, **kwargs: Any - ) -> "_models.ManagedClusterAccessProfile": + ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. Gets the accessProfile for the specified role name of the managed cluster with a specified @@ -289,13 +307,16 @@ async def get_access_profile( :rtype: ~azure.mgmt.containerservice.v2019_08_01.models.ManagedClusterAccessProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterAccessProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2019-08-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] request = build_get_access_profile_request( @@ -305,11 +326,13 @@ async def get_access_profile( role_name=role_name, api_version=api_version, template_url=self.get_access_profile.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -336,7 +359,7 @@ async def list_cluster_admin_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster admin credential of a managed cluster. Gets cluster admin credential of the managed cluster with a specified resource group and name. @@ -350,13 +373,16 @@ async def list_cluster_admin_credentials( :rtype: ~azure.mgmt.containerservice.v2019_08_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-08-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_admin_credentials_request( @@ -365,11 +391,13 @@ async def list_cluster_admin_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_admin_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -396,7 +424,7 @@ async def list_cluster_user_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster user credential of a managed cluster. Gets cluster user credential of the managed cluster with a specified resource group and name. @@ -410,13 +438,16 @@ async def list_cluster_user_credentials( :rtype: ~azure.mgmt.containerservice.v2019_08_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2019-08-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_user_credentials_request( @@ -425,11 +456,13 @@ async def list_cluster_user_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -456,7 +489,7 @@ async def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedCluster": + ) -> _models.ManagedCluster: """Gets a managed cluster. Gets the details of the managed cluster with a specified resource group and name. @@ -470,13 +503,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2019_08_01.models.ManagedCluster :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-08-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] request = build_get_request( @@ -485,11 +521,13 @@ async def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -514,17 +552,20 @@ async def _create_or_update_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2019-08-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'ManagedCluster') @@ -536,11 +577,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -570,9 +613,9 @@ async def begin_create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> AsyncLROPoller["_models.ManagedCluster"]: + ) -> AsyncLROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. Creates or updates a managed cluster with the specified configuration for agents and Kubernetes @@ -598,37 +641,47 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_08_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-08-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -645,17 +698,20 @@ async def _update_tags_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2019-08-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'TagsObject') @@ -667,11 +723,13 @@ async def _update_tags_initial( content_type=content_type, json=_json, template_url=self._update_tags_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -697,9 +755,9 @@ async def begin_update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> AsyncLROPoller["_models.ManagedCluster"]: + ) -> AsyncLROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates a managed cluster with the specified tags. @@ -724,37 +782,47 @@ async def begin_update_tags( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_08_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-08-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._update_tags_initial( + raw_result = await self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -773,13 +841,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-08-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -788,11 +859,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -836,20 +909,25 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-08-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_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) @@ -859,8 +937,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -877,17 +961,20 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2019-08-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') @@ -899,11 +986,13 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist content_type=content_type, json=_json, template_url=self._reset_service_principal_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -925,7 +1014,7 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> AsyncLROPoller[None]: """Reset Service Principal Profile of a managed cluster. @@ -952,23 +1041,28 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-08-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._reset_service_principal_profile_initial( + raw_result = await self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -978,8 +1072,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -996,17 +1096,20 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2019-08-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') @@ -1018,11 +1121,13 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta content_type=content_type, json=_json, template_url=self._reset_aad_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1044,7 +1149,7 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> AsyncLROPoller[None]: """Reset AAD Profile of a managed cluster. @@ -1070,23 +1175,28 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-08-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._reset_aad_profile_initial( + raw_result = await self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1096,8 +1206,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1116,13 +1232,16 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-08-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_rotate_cluster_certificates_request_initial( @@ -1131,11 +1250,13 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- resource_name=resource_name, api_version=api_version, template_url=self._rotate_cluster_certificates_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1179,20 +1300,25 @@ async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-ret :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-08-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._rotate_cluster_certificates_initial( + raw_result = await self._rotate_cluster_certificates_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) @@ -1202,8 +1328,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/aio/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/aio/operations/_operations.py index 5f1460cc3632..0ac53c3f7ea1 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/aio/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/aio/operations/_operations.py @@ -14,6 +14,7 @@ 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 @@ -23,32 +24,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class Operations: - """Operations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2019_08_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2019_08_01.aio.ContainerServiceClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.OperationListResult"]: + ) -> AsyncIterable[_models.OperationListResult]: """Gets a list of compute operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -57,31 +56,38 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2019_08_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-08-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/aio/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/aio/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/models/__init__.py index 2988c4a54d06..f8a486e34973 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/models/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/models/__init__.py @@ -61,7 +61,9 @@ ScaleSetEvictionPolicy, ScaleSetPriority, ) - +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'AgentPool', 'AgentPoolAvailableVersions', @@ -115,3 +117,5 @@ 'ScaleSetEvictionPolicy', 'ScaleSetPriority', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/models/_container_service_client_enums.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/models/_container_service_client_enums.py index 18f038fe5f80..f2a8ca90fcb1 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/models/_container_service_client_enums.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/models/_container_service_client_enums.py @@ -7,11 +7,10 @@ # -------------------------------------------------------------------------- from enum import Enum -from six import with_metaclass from azure.core import CaseInsensitiveEnumMeta -class AgentPoolType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class AgentPoolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """AgentPoolType represents types of an agent pool. VirtualMachineScaleSets type is still in PREVIEW. """ @@ -19,7 +18,7 @@ class AgentPoolType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): VIRTUAL_MACHINE_SCALE_SETS = "VirtualMachineScaleSets" AVAILABILITY_SET = "AvailabilitySet" -class ContainerServiceStorageProfileTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the orchestrator choice. """ @@ -27,7 +26,7 @@ class ContainerServiceStorageProfileTypes(with_metaclass(CaseInsensitiveEnumMeta STORAGE_ACCOUNT = "StorageAccount" MANAGED_DISKS = "ManagedDisks" -class ContainerServiceVMSizeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Size of agent VMs. """ @@ -206,7 +205,7 @@ class ContainerServiceVMSizeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, E STANDARD_NV24 = "Standard_NV24" STANDARD_NV6 = "Standard_NV6" -class Count(with_metaclass(CaseInsensitiveEnumMeta, int, Enum)): +class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): """Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, and 5. The default value is 1. """ @@ -215,35 +214,35 @@ class Count(with_metaclass(CaseInsensitiveEnumMeta, int, Enum)): THREE = 3 FIVE = 5 -class LoadBalancerSku(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class LoadBalancerSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The load balancer sku for the managed cluster. """ STANDARD = "standard" BASIC = "basic" -class NetworkPlugin(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkPlugin(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Network plugin used for building Kubernetes network. """ AZURE = "azure" KUBENET = "kubenet" -class NetworkPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Network policy used for building Kubernetes network. """ CALICO = "calico" AZURE = "azure" -class OSType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux. """ LINUX = "Linux" WINDOWS = "Windows" -class ResourceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ resource group in agent nodes. Type 'None' will not use MSI for the managed cluster, service @@ -253,7 +252,7 @@ class ResourceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): SYSTEM_ASSIGNED = "SystemAssigned" NONE = "None" -class ScaleSetEvictionPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ScaleSetEvictionPolicy to be used to specify eviction policy for low priority virtual machine scale set. Default to Delete. """ @@ -261,7 +260,7 @@ class ScaleSetEvictionPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)) DELETE = "Delete" DEALLOCATE = "Deallocate" -class ScaleSetPriority(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ScaleSetPriority(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ScaleSetPriority to be used to specify virtual machine scale set priority. Default to regular. """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/models/_models_py3.py index 33b79a3f7e1e..dffe8c1ee456 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/models/_models_py3.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/models/_models_py3.py @@ -6,11 +6,13 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Dict, List, Optional, Union +from typing import Dict, List, Optional, TYPE_CHECKING, Union import msrest.serialization -from ._container_service_client_enums import * +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + import __init__ as _models class SubResource(msrest.serialization.Model): @@ -66,7 +68,7 @@ class AgentPool(SubResource): :ivar count: Number of agents (VMs) 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: Size of agent VMs. Possible values include: "Standard_A1", "Standard_A10", + :ivar vm_size: Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -115,7 +117,7 @@ class AgentPool(SubResource): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2019_08_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -123,8 +125,8 @@ class AgentPool(SubResource): :vartype min_count: int :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool - :ivar type_properties_type: AgentPoolType represents types of an agent pool. Possible values - include: "VirtualMachineScaleSets", "AvailabilitySet". + :ivar type_properties_type: AgentPoolType represents types of an agent pool. Known values are: + "VirtualMachineScaleSets", "AvailabilitySet". :vartype type_properties_type: str or ~azure.mgmt.containerservice.v2019_08_01.models.AgentPoolType :ivar orchestrator_version: Version of orchestrator specified when creating the managed @@ -139,13 +141,12 @@ class AgentPool(SubResource): :ivar enable_node_public_ip: Enable public IP for nodes. :vartype enable_node_public_ip: bool :ivar scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Possible values include: "Low", "Regular". Default value: - "Regular". + priority. Default to regular. Known values are: "Low", "Regular". Default value: "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2019_08_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy - for low priority virtual machine scale set. Default to Delete. Possible values include: - "Delete", "Deallocate". Default value: "Delete". + for low priority virtual machine scale set. Default to Delete. Known values are: "Delete", + "Deallocate". Default value: "Delete". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2019_08_01.models.ScaleSetEvictionPolicy :ivar node_taints: Taints added to new nodes during node pool create and scale. For example, @@ -188,20 +189,20 @@ def __init__( self, *, count: Optional[int] = None, - vm_size: Optional[Union[str, "ContainerServiceVMSizeTypes"]] = None, + vm_size: Optional[Union[str, "_models.ContainerServiceVMSizeTypes"]] = None, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - type_properties_type: Optional[Union[str, "AgentPoolType"]] = None, + type_properties_type: Optional[Union[str, "_models.AgentPoolType"]] = None, orchestrator_version: Optional[str] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, - scale_set_priority: Optional[Union[str, "ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", node_taints: Optional[List[str]] = None, **kwargs ): @@ -209,7 +210,7 @@ def __init__( :keyword count: Number of agents (VMs) 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: Size of agent VMs. Possible values include: "Standard_A1", "Standard_A10", + :keyword vm_size: Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -258,7 +259,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2019_08_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -266,8 +267,8 @@ def __init__( :paramtype min_count: int :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool - :keyword type_properties_type: AgentPoolType represents types of an agent pool. Possible values - include: "VirtualMachineScaleSets", "AvailabilitySet". + :keyword type_properties_type: AgentPoolType represents types of an agent pool. Known values + are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type_properties_type: str or ~azure.mgmt.containerservice.v2019_08_01.models.AgentPoolType :keyword orchestrator_version: Version of orchestrator specified when creating the managed @@ -279,12 +280,11 @@ def __init__( :keyword enable_node_public_ip: Enable public IP for nodes. :paramtype enable_node_public_ip: bool :keyword scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Possible values include: "Low", "Regular". Default value: - "Regular". + priority. Default to regular. Known values are: "Low", "Regular". Default value: "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2019_08_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction - policy for low priority virtual machine scale set. Default to Delete. Possible values include: + policy for low priority virtual machine scale set. Default to Delete. Known values are: "Delete", "Deallocate". Default value: "Delete". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2019_08_01.models.ScaleSetEvictionPolicy @@ -344,7 +344,7 @@ class AgentPoolAvailableVersions(msrest.serialization.Model): def __init__( self, *, - agent_pool_versions: Optional[List["AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem"]] = None, + agent_pool_versions: Optional[List["_models.AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem"]] = None, **kwargs ): """ @@ -421,7 +421,7 @@ class AgentPoolListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["AgentPool"]] = None, + value: Optional[List["_models.AgentPool"]] = None, **kwargs ): """ @@ -449,7 +449,7 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): :ivar kubernetes_version: Required. Kubernetes version (major, minor, patch). :vartype kubernetes_version: str :ivar os_type: Required. OsType to be used to specify os type. Choose from Linux and Windows. - Default to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2019_08_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -477,15 +477,15 @@ def __init__( self, *, kubernetes_version: str, - os_type: Union[str, "OSType"] = "Linux", - upgrades: Optional[List["AgentPoolUpgradeProfilePropertiesUpgradesItem"]] = None, + os_type: Union[str, "_models.OSType"] = "Linux", + upgrades: Optional[List["_models.AgentPoolUpgradeProfilePropertiesUpgradesItem"]] = None, **kwargs ): """ :keyword kubernetes_version: Required. Kubernetes version (major, minor, patch). :paramtype kubernetes_version: str :keyword os_type: Required. OsType to be used to specify os type. Choose from Linux and - Windows. Default to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Windows. Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2019_08_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: @@ -561,7 +561,7 @@ def __init__( code: Optional[str] = None, message: Optional[str] = None, target: Optional[str] = None, - details: Optional[List["CloudErrorBody"]] = None, + details: Optional[List["_models.CloudErrorBody"]] = None, **kwargs ): """ @@ -605,7 +605,7 @@ class ContainerServiceDiagnosticsProfile(msrest.serialization.Model): def __init__( self, *, - vm_diagnostics: "ContainerServiceVMDiagnostics", + vm_diagnostics: "_models.ContainerServiceVMDiagnostics", **kwargs ): """ @@ -642,7 +642,7 @@ def __init__( self, *, admin_username: str, - ssh: "ContainerServiceSshConfiguration", + ssh: "_models.ContainerServiceSshConfiguration", **kwargs ): """ @@ -665,17 +665,17 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar count: Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, - and 5. The default value is 1. Possible values include: 1, 3, 5. Default value: "1". + and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". :vartype count: int or ~azure.mgmt.containerservice.v2019_08_01.models.Count :ivar dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. :vartype dns_prefix: str - :ivar vm_size: Required. Size of agent VMs. Possible values include: "Standard_A1", - "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", - "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", - "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", - "Standard_A8m_v2", "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", - "Standard_B8ms", "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", - "Standard_D12", "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", + :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", + "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", + "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", + "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", "Standard_B8ms", + "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", "Standard_D12", + "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", "Standard_D13_v2_Promo", "Standard_D14", "Standard_D14_v2", "Standard_D14_v2_Promo", "Standard_D15_v2", "Standard_D16_v3", "Standard_D16s_v3", "Standard_D1_v2", "Standard_D2", "Standard_D2_v2", "Standard_D2_v2_Promo", "Standard_D2_v3", "Standard_D2s_v3", "Standard_D3", @@ -720,7 +720,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): :vartype first_consecutive_static_ip: str :ivar storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Possible values include: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". :vartype storage_profile: str or ~azure.mgmt.containerservice.v2019_08_01.models.ContainerServiceStorageProfileTypes :ivar fqdn: FQDN for the master pool. @@ -749,27 +749,27 @@ def __init__( self, *, dns_prefix: str, - vm_size: Union[str, "ContainerServiceVMSizeTypes"], - count: Optional[Union[int, "Count"]] = 1, + vm_size: Union[str, "_models.ContainerServiceVMSizeTypes"], + count: Optional[Union[int, "_models.Count"]] = 1, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, first_consecutive_static_ip: Optional[str] = "10.240.255.5", - storage_profile: Optional[Union[str, "ContainerServiceStorageProfileTypes"]] = None, + storage_profile: Optional[Union[str, "_models.ContainerServiceStorageProfileTypes"]] = None, **kwargs ): """ :keyword count: Number of masters (VMs) in the container service cluster. Allowed values are 1, - 3, and 5. The default value is 1. Possible values include: 1, 3, 5. Default value: "1". + 3, and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". :paramtype count: int or ~azure.mgmt.containerservice.v2019_08_01.models.Count :keyword dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. :paramtype dns_prefix: str - :keyword vm_size: Required. Size of agent VMs. Possible values include: "Standard_A1", - "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", - "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", - "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", - "Standard_A8m_v2", "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", - "Standard_B8ms", "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", - "Standard_D12", "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", + :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", + "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", + "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", + "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", "Standard_B8ms", + "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", "Standard_D12", + "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", "Standard_D13_v2_Promo", "Standard_D14", "Standard_D14_v2", "Standard_D14_v2_Promo", "Standard_D15_v2", "Standard_D16_v3", "Standard_D16s_v3", "Standard_D1_v2", "Standard_D2", "Standard_D2_v2", "Standard_D2_v2_Promo", "Standard_D2_v3", "Standard_D2s_v3", "Standard_D3", @@ -814,7 +814,7 @@ def __init__( :paramtype first_consecutive_static_ip: str :keyword storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Possible values include: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". :paramtype storage_profile: str or ~azure.mgmt.containerservice.v2019_08_01.models.ContainerServiceStorageProfileTypes """ @@ -832,11 +832,11 @@ def __init__( class ContainerServiceNetworkProfile(msrest.serialization.Model): """Profile of network configuration. - :ivar network_plugin: Network plugin used for building Kubernetes network. Possible values - include: "azure", "kubenet". Default value: "kubenet". + :ivar network_plugin: Network plugin used for building Kubernetes network. Known values are: + "azure", "kubenet". Default value: "kubenet". :vartype network_plugin: str or ~azure.mgmt.containerservice.v2019_08_01.models.NetworkPlugin - :ivar network_policy: Network policy used for building Kubernetes network. Possible values - include: "calico", "azure". + :ivar network_policy: Network policy used for building Kubernetes network. Known values are: + "calico", "azure". :vartype network_policy: str or ~azure.mgmt.containerservice.v2019_08_01.models.NetworkPolicy :ivar pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :vartype pod_cidr: str @@ -849,8 +849,8 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): :ivar docker_bridge_cidr: A CIDR notation IP range assigned to the Docker bridge network. It must not overlap with any Subnet IP ranges or the Kubernetes service address range. :vartype docker_bridge_cidr: str - :ivar load_balancer_sku: The load balancer sku for the managed cluster. Possible values - include: "standard", "basic". + :ivar load_balancer_sku: The load balancer sku for the managed cluster. Known values are: + "standard", "basic". :vartype load_balancer_sku: str or ~azure.mgmt.containerservice.v2019_08_01.models.LoadBalancerSku :ivar load_balancer_profile: Profile of the cluster load balancer. @@ -879,22 +879,22 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): def __init__( self, *, - network_plugin: Optional[Union[str, "NetworkPlugin"]] = "kubenet", - network_policy: Optional[Union[str, "NetworkPolicy"]] = None, + network_plugin: Optional[Union[str, "_models.NetworkPlugin"]] = "kubenet", + network_policy: Optional[Union[str, "_models.NetworkPolicy"]] = None, pod_cidr: Optional[str] = "10.244.0.0/16", service_cidr: Optional[str] = "10.0.0.0/16", dns_service_ip: Optional[str] = "10.0.0.10", docker_bridge_cidr: Optional[str] = "172.17.0.1/16", - load_balancer_sku: Optional[Union[str, "LoadBalancerSku"]] = None, - load_balancer_profile: Optional["ManagedClusterLoadBalancerProfile"] = None, + load_balancer_sku: Optional[Union[str, "_models.LoadBalancerSku"]] = None, + load_balancer_profile: Optional["_models.ManagedClusterLoadBalancerProfile"] = None, **kwargs ): """ - :keyword network_plugin: Network plugin used for building Kubernetes network. Possible values - include: "azure", "kubenet". Default value: "kubenet". + :keyword network_plugin: Network plugin used for building Kubernetes network. Known values are: + "azure", "kubenet". Default value: "kubenet". :paramtype network_plugin: str or ~azure.mgmt.containerservice.v2019_08_01.models.NetworkPlugin - :keyword network_policy: Network policy used for building Kubernetes network. Possible values - include: "calico", "azure". + :keyword network_policy: Network policy used for building Kubernetes network. Known values are: + "calico", "azure". :paramtype network_policy: str or ~azure.mgmt.containerservice.v2019_08_01.models.NetworkPolicy :keyword pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :paramtype pod_cidr: str @@ -907,8 +907,8 @@ def __init__( :keyword docker_bridge_cidr: A CIDR notation IP range assigned to the Docker bridge network. It must not overlap with any Subnet IP ranges or the Kubernetes service address range. :paramtype docker_bridge_cidr: str - :keyword load_balancer_sku: The load balancer sku for the managed cluster. Possible values - include: "standard", "basic". + :keyword load_balancer_sku: The load balancer sku for the managed cluster. Known values are: + "standard", "basic". :paramtype load_balancer_sku: str or ~azure.mgmt.containerservice.v2019_08_01.models.LoadBalancerSku :keyword load_balancer_profile: Profile of the cluster load balancer. @@ -948,7 +948,7 @@ class ContainerServiceSshConfiguration(msrest.serialization.Model): def __init__( self, *, - public_keys: List["ContainerServiceSshPublicKey"], + public_keys: List["_models.ContainerServiceSshPublicKey"], **kwargs ): """ @@ -1250,20 +1250,20 @@ def __init__( *, location: str, tags: Optional[Dict[str, str]] = None, - identity: Optional["ManagedClusterIdentity"] = None, + identity: Optional["_models.ManagedClusterIdentity"] = None, kubernetes_version: Optional[str] = None, dns_prefix: Optional[str] = None, - agent_pool_profiles: Optional[List["ManagedClusterAgentPoolProfile"]] = None, - linux_profile: Optional["ContainerServiceLinuxProfile"] = None, - windows_profile: Optional["ManagedClusterWindowsProfile"] = None, - service_principal_profile: Optional["ManagedClusterServicePrincipalProfile"] = None, - addon_profiles: Optional[Dict[str, "ManagedClusterAddonProfile"]] = None, + agent_pool_profiles: Optional[List["_models.ManagedClusterAgentPoolProfile"]] = None, + linux_profile: Optional["_models.ContainerServiceLinuxProfile"] = None, + windows_profile: Optional["_models.ManagedClusterWindowsProfile"] = None, + service_principal_profile: Optional["_models.ManagedClusterServicePrincipalProfile"] = None, + addon_profiles: Optional[Dict[str, "_models.ManagedClusterAddonProfile"]] = None, node_resource_group: Optional[str] = None, enable_rbac: Optional[bool] = None, enable_pod_security_policy: Optional[bool] = None, - network_profile: Optional["ContainerServiceNetworkProfile"] = None, - aad_profile: Optional["ManagedClusterAADProfile"] = None, - api_server_access_profile: Optional["ManagedClusterAPIServerAccessProfile"] = None, + network_profile: Optional["_models.ContainerServiceNetworkProfile"] = None, + aad_profile: Optional["_models.ManagedClusterAADProfile"] = None, + api_server_access_profile: Optional["_models.ManagedClusterAPIServerAccessProfile"] = None, **kwargs ): """ @@ -1489,7 +1489,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar count: Number of agents (VMs) 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: Size of agent VMs. Possible values include: "Standard_A1", "Standard_A10", + :ivar vm_size: Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -1538,7 +1538,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2019_08_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -1546,7 +1546,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :vartype min_count: int :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool - :ivar type: AgentPoolType represents types of an agent pool. Possible values include: + :ivar type: AgentPoolType represents types of an agent pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2019_08_01.models.AgentPoolType :ivar orchestrator_version: Version of orchestrator specified when creating the managed @@ -1561,13 +1561,12 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar enable_node_public_ip: Enable public IP for nodes. :vartype enable_node_public_ip: bool :ivar scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Possible values include: "Low", "Regular". Default value: - "Regular". + priority. Default to regular. Known values are: "Low", "Regular". Default value: "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2019_08_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy - for low priority virtual machine scale set. Default to Delete. Possible values include: - "Delete", "Deallocate". Default value: "Delete". + for low priority virtual machine scale set. Default to Delete. Known values are: "Delete", + "Deallocate". Default value: "Delete". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2019_08_01.models.ScaleSetEvictionPolicy :ivar node_taints: Taints added to new nodes during node pool create and scale. For example, @@ -1604,20 +1603,20 @@ def __init__( self, *, count: Optional[int] = None, - vm_size: Optional[Union[str, "ContainerServiceVMSizeTypes"]] = None, + vm_size: Optional[Union[str, "_models.ContainerServiceVMSizeTypes"]] = None, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - type: Optional[Union[str, "AgentPoolType"]] = None, + type: Optional[Union[str, "_models.AgentPoolType"]] = None, orchestrator_version: Optional[str] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, - scale_set_priority: Optional[Union[str, "ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", node_taints: Optional[List[str]] = None, **kwargs ): @@ -1625,7 +1624,7 @@ def __init__( :keyword count: Number of agents (VMs) 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: Size of agent VMs. Possible values include: "Standard_A1", "Standard_A10", + :keyword vm_size: Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -1674,7 +1673,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2019_08_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -1682,7 +1681,7 @@ def __init__( :paramtype min_count: int :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool - :keyword type: AgentPoolType represents types of an agent pool. Possible values include: + :keyword type: AgentPoolType represents types of an agent pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2019_08_01.models.AgentPoolType :keyword orchestrator_version: Version of orchestrator specified when creating the managed @@ -1694,12 +1693,11 @@ def __init__( :keyword enable_node_public_ip: Enable public IP for nodes. :paramtype enable_node_public_ip: bool :keyword scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Possible values include: "Low", "Regular". Default value: - "Regular". + priority. Default to regular. Known values are: "Low", "Regular". Default value: "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2019_08_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction - policy for low priority virtual machine scale set. Default to Delete. Possible values include: + policy for low priority virtual machine scale set. Default to Delete. Known values are: "Delete", "Deallocate". Default value: "Delete". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2019_08_01.models.ScaleSetEvictionPolicy @@ -1737,7 +1735,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar count: Number of agents (VMs) 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: Size of agent VMs. Possible values include: "Standard_A1", "Standard_A10", + :ivar vm_size: Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -1786,7 +1784,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2019_08_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -1794,7 +1792,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :vartype min_count: int :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool - :ivar type: AgentPoolType represents types of an agent pool. Possible values include: + :ivar type: AgentPoolType represents types of an agent pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2019_08_01.models.AgentPoolType :ivar orchestrator_version: Version of orchestrator specified when creating the managed @@ -1809,13 +1807,12 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar enable_node_public_ip: Enable public IP for nodes. :vartype enable_node_public_ip: bool :ivar scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Possible values include: "Low", "Regular". Default value: - "Regular". + priority. Default to regular. Known values are: "Low", "Regular". Default value: "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2019_08_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy - for low priority virtual machine scale set. Default to Delete. Possible values include: - "Delete", "Deallocate". Default value: "Delete". + for low priority virtual machine scale set. Default to Delete. Known values are: "Delete", + "Deallocate". Default value: "Delete". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2019_08_01.models.ScaleSetEvictionPolicy :ivar node_taints: Taints added to new nodes during node pool create and scale. For example, @@ -1858,20 +1855,20 @@ def __init__( *, name: str, count: Optional[int] = None, - vm_size: Optional[Union[str, "ContainerServiceVMSizeTypes"]] = None, + vm_size: Optional[Union[str, "_models.ContainerServiceVMSizeTypes"]] = None, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - type: Optional[Union[str, "AgentPoolType"]] = None, + type: Optional[Union[str, "_models.AgentPoolType"]] = None, orchestrator_version: Optional[str] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, - scale_set_priority: Optional[Union[str, "ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", node_taints: Optional[List[str]] = None, **kwargs ): @@ -1879,7 +1876,7 @@ def __init__( :keyword count: Number of agents (VMs) 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: Size of agent VMs. Possible values include: "Standard_A1", "Standard_A10", + :keyword vm_size: Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -1928,7 +1925,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2019_08_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -1936,7 +1933,7 @@ def __init__( :paramtype min_count: int :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool - :keyword type: AgentPoolType represents types of an agent pool. Possible values include: + :keyword type: AgentPoolType represents types of an agent pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2019_08_01.models.AgentPoolType :keyword orchestrator_version: Version of orchestrator specified when creating the managed @@ -1948,12 +1945,11 @@ def __init__( :keyword enable_node_public_ip: Enable public IP for nodes. :paramtype enable_node_public_ip: bool :keyword scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Possible values include: "Low", "Regular". Default value: - "Regular". + priority. Default to regular. Known values are: "Low", "Regular". Default value: "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2019_08_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction - policy for low priority virtual machine scale set. Default to Delete. Possible values include: + policy for low priority virtual machine scale set. Default to Delete. Known values are: "Delete", "Deallocate". Default value: "Delete". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2019_08_01.models.ScaleSetEvictionPolicy @@ -2014,7 +2010,7 @@ class ManagedClusterIdentity(msrest.serialization.Model): :ivar type: The type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ resource group in agent nodes. Type 'None' will not use MSI for the managed cluster, - service principal will be used instead. Possible values include: "SystemAssigned", "None". + service principal will be used instead. Known values are: "SystemAssigned", "None". :vartype type: str or ~azure.mgmt.containerservice.v2019_08_01.models.ResourceIdentityType """ @@ -2032,15 +2028,14 @@ class ManagedClusterIdentity(msrest.serialization.Model): def __init__( self, *, - type: Optional[Union[str, "ResourceIdentityType"]] = None, + type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, **kwargs ): """ :keyword type: The type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ resource group in agent nodes. Type 'None' will not use MSI for the managed - cluster, service principal will be used instead. Possible values include: "SystemAssigned", - "None". + cluster, service principal will be used instead. Known values are: "SystemAssigned", "None". :paramtype type: str or ~azure.mgmt.containerservice.v2019_08_01.models.ResourceIdentityType """ super(ManagedClusterIdentity, self).__init__(**kwargs) @@ -2072,7 +2067,7 @@ class ManagedClusterListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["ManagedCluster"]] = None, + value: Optional[List["_models.ManagedCluster"]] = None, **kwargs ): """ @@ -2112,10 +2107,10 @@ class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): def __init__( self, *, - managed_outbound_i_ps: Optional["ManagedClusterLoadBalancerProfileManagedOutboundIPs"] = None, - outbound_ip_prefixes: Optional["ManagedClusterLoadBalancerProfileOutboundIPPrefixes"] = None, - outbound_i_ps: Optional["ManagedClusterLoadBalancerProfileOutboundIPs"] = None, - effective_outbound_i_ps: Optional[List["ResourceReference"]] = None, + managed_outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileManagedOutboundIPs"] = None, + outbound_ip_prefixes: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPPrefixes"] = None, + outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPs"] = None, + effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, **kwargs ): """ @@ -2187,7 +2182,7 @@ class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.M def __init__( self, *, - public_ip_prefixes: Optional[List["ResourceReference"]] = None, + public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, **kwargs ): """ @@ -2213,7 +2208,7 @@ class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): def __init__( self, *, - public_i_ps: Optional[List["ResourceReference"]] = None, + public_i_ps: Optional[List["_models.ResourceReference"]] = None, **kwargs ): """ @@ -2234,7 +2229,7 @@ class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): :ivar name: Pool name. :vartype name: str :ivar os_type: Required. OsType to be used to specify os type. Choose from Linux and Windows. - Default to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2019_08_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -2257,9 +2252,9 @@ def __init__( self, *, kubernetes_version: str, - os_type: Union[str, "OSType"] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", name: Optional[str] = None, - upgrades: Optional[List["ManagedClusterPoolUpgradeProfileUpgradesItem"]] = None, + upgrades: Optional[List["_models.ManagedClusterPoolUpgradeProfileUpgradesItem"]] = None, **kwargs ): """ @@ -2268,7 +2263,7 @@ def __init__( :keyword name: Pool name. :paramtype name: str :keyword os_type: Required. OsType to be used to specify os type. Choose from Linux and - Windows. Default to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Windows. Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2019_08_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: @@ -2392,8 +2387,8 @@ class ManagedClusterUpgradeProfile(msrest.serialization.Model): def __init__( self, *, - control_plane_profile: "ManagedClusterPoolUpgradeProfile", - agent_pool_profiles: List["ManagedClusterPoolUpgradeProfile"], + control_plane_profile: "_models.ManagedClusterPoolUpgradeProfile", + agent_pool_profiles: List["_models.ManagedClusterPoolUpgradeProfile"], **kwargs ): """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/models/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/models/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/operations/__init__.py index 5aac40228eec..403c0174f052 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/operations/__init__.py @@ -10,8 +10,13 @@ from ._managed_clusters_operations import ManagedClustersOperations from ._agent_pools_operations import AgentPoolsOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'Operations', 'ManagedClustersOperations', 'AgentPoolsOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/operations/_agent_pools_operations.py index 5cbdce13d98c..28349a6c26fc 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/operations/_agent_pools_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -35,9 +35,12 @@ def build_list_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-08-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools") # pylint: disable=line-too-long path_format_arguments = { @@ -49,18 +52,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -72,9 +73,12 @@ def build_get_request( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-08-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -87,18 +91,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -109,14 +111,17 @@ def build_create_or_update_request_initial( resource_name: str, agent_pool_name: str, *, - json: JSONType = None, + json: Optional[_models.AgentPool] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-08-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -129,20 +134,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -156,9 +159,12 @@ def build_delete_request_initial( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-08-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -171,18 +177,16 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -194,9 +198,12 @@ def build_get_upgrade_profile_request( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-08-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default") # pylint: disable=line-too-long path_format_arguments = { @@ -209,18 +216,16 @@ def build_get_upgrade_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -231,9 +236,12 @@ def build_get_available_agent_pool_versions_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-08-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions") # pylint: disable=line-too-long path_format_arguments = { @@ -245,42 +253,38 @@ def build_get_available_agent_pool_versions_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class AgentPoolsOperations(object): - """AgentPoolsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class AgentPoolsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2019_08_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2019_08_01.ContainerServiceClient`'s + :attr:`agent_pools` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -288,7 +292,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Iterable["_models.AgentPoolListResult"]: + ) -> Iterable[_models.AgentPoolListResult]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. The operation returns properties @@ -304,13 +308,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2019_08_01.models.AgentPoolListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-08-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -320,9 +327,11 @@ def prepare_request(next_link=None): resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -332,9 +341,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -374,7 +385,7 @@ def get( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPool": + ) -> _models.AgentPool: """Gets the agent pool. Gets the details of the agent pool by managed cluster and resource group. @@ -390,13 +401,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2019_08_01.models.AgentPool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-08-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] request = build_get_request( @@ -406,11 +420,13 @@ def get( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -436,17 +452,20 @@ def _create_or_update_initial( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> "_models.AgentPool": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] + ) -> _models.AgentPool: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2019-08-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] _json = self._serialize.body(parameters, 'AgentPool') @@ -459,11 +478,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -494,9 +515,9 @@ def begin_create_or_update( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> LROPoller["_models.AgentPool"]: + ) -> LROPoller[_models.AgentPool]: """Creates or updates an agent pool. Creates or updates an agent pool in the specified managed cluster. @@ -522,17 +543,20 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_08_01.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-08-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, @@ -540,20 +564,27 @@ def begin_create_or_update( 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): - response = pipeline_response.http_response deserialized = self._deserialize('AgentPool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -573,13 +604,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements agent_pool_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2019-08-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -589,11 +623,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -640,21 +676,26 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-08-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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) @@ -664,8 +705,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -685,7 +732,7 @@ def get_upgrade_profile( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPoolUpgradeProfile": + ) -> _models.AgentPoolUpgradeProfile: """Gets upgrade profile for an agent pool. Gets the details of the upgrade profile for an agent pool with a specified resource group and @@ -702,13 +749,16 @@ def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2019_08_01.models.AgentPoolUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-08-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] request = build_get_upgrade_profile_request( @@ -718,11 +768,13 @@ def get_upgrade_profile( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -749,7 +801,7 @@ def get_available_agent_pool_versions( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.AgentPoolAvailableVersions": + ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported versions for the specified agent pool. Gets a list of supported versions for the specified agent pool. @@ -763,13 +815,16 @@ def get_available_agent_pool_versions( :rtype: ~azure.mgmt.containerservice.v2019_08_01.models.AgentPoolAvailableVersions :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolAvailableVersions"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-08-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] request = build_get_available_agent_pool_versions_request( @@ -778,11 +833,13 @@ def get_available_agent_pool_versions( resource_name=resource_name, api_version=api_version, template_url=self.get_available_agent_pool_versions.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/operations/_managed_clusters_operations.py index 55378b8dda07..906e90660d66 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/operations/_managed_clusters_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -33,9 +33,12 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-08-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters") path_format_arguments = { @@ -45,18 +48,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -66,9 +67,12 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-08-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters") # pylint: disable=line-too-long path_format_arguments = { @@ -79,18 +83,16 @@ def build_list_by_resource_group_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -101,9 +103,12 @@ def build_get_upgrade_profile_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-08-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default") # pylint: disable=line-too-long path_format_arguments = { @@ -115,18 +120,16 @@ def build_get_upgrade_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -138,9 +141,12 @@ def build_get_access_profile_request( role_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-08-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -153,18 +159,16 @@ def build_get_access_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -175,9 +179,12 @@ def build_list_cluster_admin_credentials_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-08-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -189,18 +196,16 @@ def build_list_cluster_admin_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -211,9 +216,12 @@ def build_list_cluster_user_credentials_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-08-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -225,18 +233,16 @@ def build_list_cluster_user_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -247,9 +253,12 @@ def build_get_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-08-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -261,18 +270,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -282,14 +289,17 @@ def build_create_or_update_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedCluster] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-08-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -301,20 +311,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -326,14 +334,17 @@ def build_update_tags_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.TagsObject] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-08-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -345,20 +356,18 @@ def build_update_tags_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -371,9 +380,12 @@ def build_delete_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-08-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -385,18 +397,16 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -406,14 +416,17 @@ def build_reset_service_principal_profile_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedClusterServicePrincipalProfile] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-08-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile") # pylint: disable=line-too-long path_format_arguments = { @@ -425,20 +438,18 @@ def build_reset_service_principal_profile_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -450,14 +461,17 @@ def build_reset_aad_profile_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedClusterAADProfile] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-08-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile") # pylint: disable=line-too-long path_format_arguments = { @@ -469,20 +483,18 @@ def build_reset_aad_profile_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -495,9 +507,12 @@ def build_rotate_cluster_certificates_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-08-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates") # pylint: disable=line-too-long path_format_arguments = { @@ -509,48 +524,44 @@ def build_rotate_cluster_certificates_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class ManagedClustersOperations(object): - """ManagedClustersOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ManagedClustersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2019_08_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2019_08_01.ContainerServiceClient`'s + :attr:`managed_clusters` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> Iterable["_models.ManagedClusterListResult"]: + ) -> Iterable[_models.ManagedClusterListResult]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. The operation returns properties @@ -563,13 +574,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2019_08_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-08-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -577,9 +591,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -587,9 +603,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -627,7 +645,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.ManagedClusterListResult"]: + ) -> Iterable[_models.ManagedClusterListResult]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. The operation returns @@ -642,13 +660,16 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2019_08_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-08-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -657,9 +678,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -668,9 +691,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -709,7 +734,7 @@ def get_upgrade_profile( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedClusterUpgradeProfile": + ) -> _models.ManagedClusterUpgradeProfile: """Gets upgrade profile for a managed cluster. Gets the details of the upgrade profile for a managed cluster with a specified resource group @@ -724,13 +749,16 @@ def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2019_08_01.models.ManagedClusterUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2019-08-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] request = build_get_upgrade_profile_request( @@ -739,11 +767,13 @@ def get_upgrade_profile( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -771,7 +801,7 @@ def get_access_profile( resource_name: str, role_name: str, **kwargs: Any - ) -> "_models.ManagedClusterAccessProfile": + ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. Gets the accessProfile for the specified role name of the managed cluster with a specified @@ -788,13 +818,16 @@ def get_access_profile( :rtype: ~azure.mgmt.containerservice.v2019_08_01.models.ManagedClusterAccessProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterAccessProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-08-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] request = build_get_access_profile_request( @@ -804,11 +837,13 @@ def get_access_profile( role_name=role_name, api_version=api_version, template_url=self.get_access_profile.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -835,7 +870,7 @@ def list_cluster_admin_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster admin credential of a managed cluster. Gets cluster admin credential of the managed cluster with a specified resource group and name. @@ -849,13 +884,16 @@ def list_cluster_admin_credentials( :rtype: ~azure.mgmt.containerservice.v2019_08_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-08-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_admin_credentials_request( @@ -864,11 +902,13 @@ def list_cluster_admin_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_admin_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -895,7 +935,7 @@ def list_cluster_user_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster user credential of a managed cluster. Gets cluster user credential of the managed cluster with a specified resource group and name. @@ -909,13 +949,16 @@ def list_cluster_user_credentials( :rtype: ~azure.mgmt.containerservice.v2019_08_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2019-08-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_user_credentials_request( @@ -924,11 +967,13 @@ def list_cluster_user_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -955,7 +1000,7 @@ def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedCluster": + ) -> _models.ManagedCluster: """Gets a managed cluster. Gets the details of the managed cluster with a specified resource group and name. @@ -969,13 +1014,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2019_08_01.models.ManagedCluster :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-08-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] request = build_get_request( @@ -984,11 +1032,13 @@ def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1013,17 +1063,20 @@ def _create_or_update_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2019-08-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'ManagedCluster') @@ -1035,11 +1088,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1069,9 +1124,9 @@ def begin_create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> LROPoller["_models.ManagedCluster"]: + ) -> LROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. Creates or updates a managed cluster with the specified configuration for agents and Kubernetes @@ -1097,37 +1152,47 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_08_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-08-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1144,17 +1209,20 @@ def _update_tags_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2019-08-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'TagsObject') @@ -1166,11 +1234,13 @@ def _update_tags_initial( content_type=content_type, json=_json, template_url=self._update_tags_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1196,9 +1266,9 @@ def begin_update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> LROPoller["_models.ManagedCluster"]: + ) -> LROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates a managed cluster with the specified tags. @@ -1223,37 +1293,47 @@ def begin_update_tags( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_08_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-08-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._update_tags_initial( + raw_result = self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1272,13 +1352,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2019-08-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -1287,11 +1370,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1335,20 +1420,25 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-08-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_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) @@ -1358,8 +1448,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1376,17 +1472,20 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2019-08-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') @@ -1398,11 +1497,13 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re content_type=content_type, json=_json, template_url=self._reset_service_principal_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1424,7 +1525,7 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> LROPoller[None]: """Reset Service Principal Profile of a managed cluster. @@ -1451,23 +1552,28 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-08-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._reset_service_principal_profile_initial( + raw_result = self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1477,8 +1583,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1495,17 +1607,20 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2019-08-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') @@ -1517,11 +1632,13 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement content_type=content_type, json=_json, template_url=self._reset_aad_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1543,7 +1660,7 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> LROPoller[None]: """Reset AAD Profile of a managed cluster. @@ -1569,23 +1686,28 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-08-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._reset_aad_profile_initial( + raw_result = self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1595,8 +1717,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1615,13 +1743,16 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2019-08-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_rotate_cluster_certificates_request_initial( @@ -1630,11 +1761,13 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return resource_name=resource_name, api_version=api_version, template_url=self._rotate_cluster_certificates_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1678,20 +1811,25 @@ def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-st :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-08-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._rotate_cluster_certificates_initial( + raw_result = self._rotate_cluster_certificates_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) @@ -1701,8 +1839,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/operations/_operations.py index e015433b8307..b12bfabeffd9 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/operations/_operations.py @@ -16,6 +16,7 @@ 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 @@ -29,55 +30,54 @@ def build_list_request( **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-08-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.ContainerService/operations") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class Operations(object): - """Operations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2019_08_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2019_08_01.ContainerServiceClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> Iterable["_models.OperationListResult"]: + ) -> Iterable[_models.OperationListResult]: """Gets a list of compute operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -86,31 +86,38 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2019_08_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-08-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_08_01/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/__init__.py index 53c675bd95e2..37a5f9e02e6f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._container_service_client import ContainerServiceClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['ContainerServiceClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/_container_service_client.py index 0e1f81597fa8..48ac69cd7556 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/_container_service_client.py @@ -56,7 +56,9 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.open_shift_managed_clusters = OpenShiftManagedClustersOperations(self._client, self._config, self._serialize, self._deserialize) + self.open_shift_managed_clusters = OpenShiftManagedClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/aio/__init__.py index 53c675bd95e2..37a5f9e02e6f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/aio/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/aio/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._container_service_client import ContainerServiceClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['ContainerServiceClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/aio/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/aio/_container_service_client.py index f7e0e11180cb..521c33f7f229 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/aio/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/aio/_container_service_client.py @@ -56,7 +56,9 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.open_shift_managed_clusters = OpenShiftManagedClustersOperations(self._client, self._config, self._serialize, self._deserialize) + self.open_shift_managed_clusters = OpenShiftManagedClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/aio/operations/__init__.py index 45d890441cd5..211a87879804 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/aio/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/aio/operations/__init__.py @@ -8,6 +8,11 @@ from ._open_shift_managed_clusters_operations import OpenShiftManagedClustersOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'OpenShiftManagedClustersOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/aio/operations/_open_shift_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/aio/operations/_open_shift_managed_clusters_operations.py index 56216ee4e0fc..8eda2427fa6b 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/aio/operations/_open_shift_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/aio/operations/_open_shift_managed_clusters_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. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ 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 @@ -26,32 +27,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class OpenShiftManagedClustersOperations: - """OpenShiftManagedClustersOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2019_09_30_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2019_09_30_preview.aio.ContainerServiceClient`'s + :attr:`open_shift_managed_clusters` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.OpenShiftManagedClusterListResult"]: + ) -> AsyncIterable[_models.OpenShiftManagedClusterListResult]: """Gets a list of OpenShift managed clusters in the specified subscription. Gets a list of OpenShift managed clusters in the specified subscription. The operation returns @@ -64,13 +63,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2019_09_30_preview.models.OpenShiftManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-09-30-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-30-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OpenShiftManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -78,9 +80,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -88,9 +92,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -128,7 +134,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.OpenShiftManagedClusterListResult"]: + ) -> AsyncIterable[_models.OpenShiftManagedClusterListResult]: """Lists OpenShift managed clusters in the specified subscription and resource group. Lists OpenShift managed clusters in the specified subscription and resource group. The @@ -143,13 +149,16 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2019_09_30_preview.models.OpenShiftManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-09-30-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-30-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OpenShiftManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -158,9 +167,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -169,9 +180,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -210,7 +223,7 @@ async def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.OpenShiftManagedCluster": + ) -> _models.OpenShiftManagedCluster: """Gets a OpenShift managed cluster. Gets the details of the managed OpenShift cluster with a specified resource group and name. @@ -224,13 +237,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2019_09_30_preview.models.OpenShiftManagedCluster :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OpenShiftManagedCluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-09-30-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-30-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedCluster] request = build_get_request( @@ -239,11 +255,13 @@ async def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -268,17 +286,20 @@ async def _create_or_update_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.OpenShiftManagedCluster", + parameters: _models.OpenShiftManagedCluster, **kwargs: Any - ) -> "_models.OpenShiftManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.OpenShiftManagedCluster"] + ) -> _models.OpenShiftManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2019-09-30-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-30-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedCluster] _json = self._serialize.body(parameters, 'OpenShiftManagedCluster') @@ -290,11 +311,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -324,9 +347,9 @@ async def begin_create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.OpenShiftManagedCluster", + parameters: _models.OpenShiftManagedCluster, **kwargs: Any - ) -> AsyncLROPoller["_models.OpenShiftManagedCluster"]: + ) -> AsyncLROPoller[_models.OpenShiftManagedCluster]: """Creates or updates an OpenShift managed cluster. Creates or updates a OpenShift managed cluster with the specified configuration for agents and @@ -354,37 +377,47 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_09_30_preview.models.OpenShiftManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-09-30-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-30-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OpenShiftManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('OpenShiftManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -401,17 +434,20 @@ async def _update_tags_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.OpenShiftManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.OpenShiftManagedCluster"] + ) -> _models.OpenShiftManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2019-09-30-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-30-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedCluster] _json = self._serialize.body(parameters, 'TagsObject') @@ -423,11 +459,13 @@ async def _update_tags_initial( content_type=content_type, json=_json, template_url=self._update_tags_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -453,9 +491,9 @@ async def begin_update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> AsyncLROPoller["_models.OpenShiftManagedCluster"]: + ) -> AsyncLROPoller[_models.OpenShiftManagedCluster]: """Updates tags on an OpenShift managed cluster. Updates an OpenShift managed cluster with the specified tags. @@ -480,37 +518,47 @@ async def begin_update_tags( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_09_30_preview.models.OpenShiftManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-09-30-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-30-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OpenShiftManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._update_tags_initial( + raw_result = await self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('OpenShiftManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -529,13 +577,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-09-30-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-30-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -544,11 +595,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -592,20 +645,25 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-09-30-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-30-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_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) @@ -615,8 +673,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/aio/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/aio/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/models/__init__.py index 8c10ceed1560..9bca41fa8e77 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/models/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/models/__init__.py @@ -28,7 +28,9 @@ OpenShiftAgentPoolProfileRole, OpenShiftContainerServiceVMSize, ) - +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'CloudErrorBody', 'NetworkProfile', @@ -49,3 +51,5 @@ 'OpenShiftAgentPoolProfileRole', 'OpenShiftContainerServiceVMSize', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/models/_container_service_client_enums.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/models/_container_service_client_enums.py index 9cff02877c35..6c64f62d0661 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/models/_container_service_client_enums.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/models/_container_service_client_enums.py @@ -7,18 +7,17 @@ # -------------------------------------------------------------------------- from enum import Enum -from six import with_metaclass from azure.core import CaseInsensitiveEnumMeta -class OpenShiftAgentPoolProfileRole(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OpenShiftAgentPoolProfileRole(str, Enum, metaclass=CaseInsensitiveEnumMeta): """OpenShiftAgentPoolProfileRole represents the role of the AgentPoolProfile. """ COMPUTE = "compute" INFRA = "infra" -class OpenShiftContainerServiceVMSize(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OpenShiftContainerServiceVMSize(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Size of OpenShift VMs. """ @@ -56,7 +55,7 @@ class OpenShiftContainerServiceVMSize(with_metaclass(CaseInsensitiveEnumMeta, st STANDARD_L16_S = "Standard_L16s" STANDARD_L32_S = "Standard_L32s" -class OSType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux. """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/models/_models_py3.py index 3a48ad8dc9b5..dbdb7f1cac9b 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/models/_models_py3.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/models/_models_py3.py @@ -6,11 +6,13 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Dict, List, Optional, Union +from typing import Dict, List, Optional, TYPE_CHECKING, Union import msrest.serialization -from ._container_service_client_enums import * +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + import __init__ as _models class CloudErrorBody(msrest.serialization.Model): @@ -42,7 +44,7 @@ def __init__( code: Optional[str] = None, message: Optional[str] = None, target: Optional[str] = None, - details: Optional[List["CloudErrorBody"]] = None, + details: Optional[List["_models.CloudErrorBody"]] = None, **kwargs ): """ @@ -246,14 +248,14 @@ def __init__( *, location: str, tags: Optional[Dict[str, str]] = None, - plan: Optional["PurchasePlan"] = None, + plan: Optional["_models.PurchasePlan"] = None, open_shift_version: Optional[str] = None, - network_profile: Optional["NetworkProfile"] = None, - router_profiles: Optional[List["OpenShiftRouterProfile"]] = None, - master_pool_profile: Optional["OpenShiftManagedClusterMasterPoolProfile"] = None, - agent_pool_profiles: Optional[List["OpenShiftManagedClusterAgentPoolProfile"]] = None, - auth_profile: Optional["OpenShiftManagedClusterAuthProfile"] = None, - monitor_profile: Optional["OpenShiftManagedClusterMonitorProfile"] = None, + network_profile: Optional["_models.NetworkProfile"] = None, + router_profiles: Optional[List["_models.OpenShiftRouterProfile"]] = None, + master_pool_profile: Optional["_models.OpenShiftManagedClusterMasterPoolProfile"] = None, + agent_pool_profiles: Optional[List["_models.OpenShiftManagedClusterAgentPoolProfile"]] = None, + auth_profile: Optional["_models.OpenShiftManagedClusterAuthProfile"] = None, + monitor_profile: Optional["_models.OpenShiftManagedClusterMonitorProfile"] = None, **kwargs ): """ @@ -399,7 +401,7 @@ class OpenShiftManagedClusterAgentPoolProfile(msrest.serialization.Model): :vartype name: str :ivar count: Required. Number of agents (VMs) to host docker containers. :vartype count: int - :ivar vm_size: Required. Size of agent VMs. Possible values include: "Standard_D2s_v3", + :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_D2s_v3", "Standard_D4s_v3", "Standard_D8s_v3", "Standard_D16s_v3", "Standard_D32s_v3", "Standard_D64s_v3", "Standard_DS4_v2", "Standard_DS5_v2", "Standard_F8s_v2", "Standard_F16s_v2", "Standard_F32s_v2", "Standard_F64s_v2", "Standard_F72s_v2", "Standard_F8s", @@ -412,10 +414,9 @@ class OpenShiftManagedClusterAgentPoolProfile(msrest.serialization.Model): :ivar subnet_cidr: Subnet CIDR for the peering. :vartype subnet_cidr: str :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2019_09_30_preview.models.OSType - :ivar role: Define the role of the AgentPoolProfile. Possible values include: "compute", - "infra". + :ivar role: Define the role of the AgentPoolProfile. Known values are: "compute", "infra". :vartype role: str or ~azure.mgmt.containerservice.v2019_09_30_preview.models.OpenShiftAgentPoolProfileRole """ @@ -440,10 +441,10 @@ def __init__( *, name: str, count: int, - vm_size: Union[str, "OpenShiftContainerServiceVMSize"], + vm_size: Union[str, "_models.OpenShiftContainerServiceVMSize"], subnet_cidr: Optional[str] = "10.0.0.0/24", - os_type: Optional[Union[str, "OSType"]] = "Linux", - role: Optional[Union[str, "OpenShiftAgentPoolProfileRole"]] = None, + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + role: Optional[Union[str, "_models.OpenShiftAgentPoolProfileRole"]] = None, **kwargs ): """ @@ -452,7 +453,7 @@ def __init__( :paramtype name: str :keyword count: Required. Number of agents (VMs) to host docker containers. :paramtype count: int - :keyword vm_size: Required. Size of agent VMs. Possible values include: "Standard_D2s_v3", + :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_D2s_v3", "Standard_D4s_v3", "Standard_D8s_v3", "Standard_D16s_v3", "Standard_D32s_v3", "Standard_D64s_v3", "Standard_DS4_v2", "Standard_DS5_v2", "Standard_F8s_v2", "Standard_F16s_v2", "Standard_F32s_v2", "Standard_F64s_v2", "Standard_F72s_v2", "Standard_F8s", @@ -465,10 +466,9 @@ def __init__( :keyword subnet_cidr: Subnet CIDR for the peering. :paramtype subnet_cidr: str :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2019_09_30_preview.models.OSType - :keyword role: Define the role of the AgentPoolProfile. Possible values include: "compute", - "infra". + :keyword role: Define the role of the AgentPoolProfile. Known values are: "compute", "infra". :paramtype role: str or ~azure.mgmt.containerservice.v2019_09_30_preview.models.OpenShiftAgentPoolProfileRole """ @@ -496,7 +496,7 @@ class OpenShiftManagedClusterAuthProfile(msrest.serialization.Model): def __init__( self, *, - identity_providers: Optional[List["OpenShiftManagedClusterIdentityProvider"]] = None, + identity_providers: Optional[List["_models.OpenShiftManagedClusterIdentityProvider"]] = None, **kwargs ): """ @@ -527,7 +527,7 @@ def __init__( self, *, name: Optional[str] = None, - provider: Optional["OpenShiftManagedClusterBaseIdentityProvider"] = None, + provider: Optional["_models.OpenShiftManagedClusterBaseIdentityProvider"] = None, **kwargs ): """ @@ -566,7 +566,7 @@ class OpenShiftManagedClusterListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["OpenShiftManagedCluster"]] = None, + value: Optional[List["_models.OpenShiftManagedCluster"]] = None, **kwargs ): """ @@ -590,7 +590,7 @@ class OpenShiftManagedClusterMasterPoolProfile(msrest.serialization.Model): :ivar count: Required. Number of masters (VMs) to host docker containers. The default value is 3. :vartype count: int - :ivar vm_size: Required. Size of agent VMs. Possible values include: "Standard_D2s_v3", + :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_D2s_v3", "Standard_D4s_v3", "Standard_D8s_v3", "Standard_D16s_v3", "Standard_D32s_v3", "Standard_D64s_v3", "Standard_DS4_v2", "Standard_DS5_v2", "Standard_F8s_v2", "Standard_F16s_v2", "Standard_F32s_v2", "Standard_F64s_v2", "Standard_F72s_v2", "Standard_F8s", @@ -603,7 +603,7 @@ class OpenShiftManagedClusterMasterPoolProfile(msrest.serialization.Model): :ivar subnet_cidr: Subnet CIDR for the peering. :vartype subnet_cidr: str :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2019_09_30_preview.models.OSType """ @@ -624,10 +624,10 @@ def __init__( self, *, count: int, - vm_size: Union[str, "OpenShiftContainerServiceVMSize"], + vm_size: Union[str, "_models.OpenShiftContainerServiceVMSize"], name: Optional[str] = None, subnet_cidr: Optional[str] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", **kwargs ): """ @@ -637,7 +637,7 @@ def __init__( :keyword count: Required. Number of masters (VMs) to host docker containers. The default value is 3. :paramtype count: int - :keyword vm_size: Required. Size of agent VMs. Possible values include: "Standard_D2s_v3", + :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_D2s_v3", "Standard_D4s_v3", "Standard_D8s_v3", "Standard_D16s_v3", "Standard_D32s_v3", "Standard_D64s_v3", "Standard_DS4_v2", "Standard_DS5_v2", "Standard_F8s_v2", "Standard_F16s_v2", "Standard_F32s_v2", "Standard_F64s_v2", "Standard_F72s_v2", "Standard_F8s", @@ -650,7 +650,7 @@ def __init__( :keyword subnet_cidr: Subnet CIDR for the peering. :paramtype subnet_cidr: str :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2019_09_30_preview.models.OSType """ super(OpenShiftManagedClusterMasterPoolProfile, self).__init__(**kwargs) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/models/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/models/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/operations/__init__.py index 45d890441cd5..211a87879804 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/operations/__init__.py @@ -8,6 +8,11 @@ from ._open_shift_managed_clusters_operations import OpenShiftManagedClustersOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'OpenShiftManagedClustersOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/operations/_open_shift_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/operations/_open_shift_managed_clusters_operations.py index 18330ed8b1fb..50895b9aec19 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/operations/_open_shift_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/operations/_open_shift_managed_clusters_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -33,9 +33,12 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-09-30-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-30-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/openShiftManagedClusters") # pylint: disable=line-too-long path_format_arguments = { @@ -45,18 +48,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -66,9 +67,12 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-09-30-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-30-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters") # pylint: disable=line-too-long path_format_arguments = { @@ -79,18 +83,16 @@ def build_list_by_resource_group_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -101,9 +103,12 @@ def build_get_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-09-30-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-30-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -115,18 +120,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -136,14 +139,17 @@ def build_create_or_update_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.OpenShiftManagedCluster] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-09-30-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-30-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -155,20 +161,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -180,14 +184,17 @@ def build_update_tags_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.TagsObject] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-09-30-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-30-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -199,20 +206,18 @@ def build_update_tags_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -225,9 +230,12 @@ def build_delete_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-09-30-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-30-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -239,48 +247,44 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class OpenShiftManagedClustersOperations(object): - """OpenShiftManagedClustersOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class OpenShiftManagedClustersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2019_09_30_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2019_09_30_preview.ContainerServiceClient`'s + :attr:`open_shift_managed_clusters` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> Iterable["_models.OpenShiftManagedClusterListResult"]: + ) -> Iterable[_models.OpenShiftManagedClusterListResult]: """Gets a list of OpenShift managed clusters in the specified subscription. Gets a list of OpenShift managed clusters in the specified subscription. The operation returns @@ -293,13 +297,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2019_09_30_preview.models.OpenShiftManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-09-30-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-30-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OpenShiftManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -307,9 +314,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -317,9 +326,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -357,7 +368,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.OpenShiftManagedClusterListResult"]: + ) -> Iterable[_models.OpenShiftManagedClusterListResult]: """Lists OpenShift managed clusters in the specified subscription and resource group. Lists OpenShift managed clusters in the specified subscription and resource group. The @@ -372,13 +383,16 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2019_09_30_preview.models.OpenShiftManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-09-30-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-30-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OpenShiftManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -387,9 +401,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -398,9 +414,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -439,7 +457,7 @@ def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.OpenShiftManagedCluster": + ) -> _models.OpenShiftManagedCluster: """Gets a OpenShift managed cluster. Gets the details of the managed OpenShift cluster with a specified resource group and name. @@ -453,13 +471,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2019_09_30_preview.models.OpenShiftManagedCluster :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OpenShiftManagedCluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2019-09-30-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-30-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedCluster] request = build_get_request( @@ -468,11 +489,13 @@ def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -497,17 +520,20 @@ def _create_or_update_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.OpenShiftManagedCluster", + parameters: _models.OpenShiftManagedCluster, **kwargs: Any - ) -> "_models.OpenShiftManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.OpenShiftManagedCluster"] + ) -> _models.OpenShiftManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2019-09-30-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-30-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedCluster] _json = self._serialize.body(parameters, 'OpenShiftManagedCluster') @@ -519,11 +545,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -553,9 +581,9 @@ def begin_create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.OpenShiftManagedCluster", + parameters: _models.OpenShiftManagedCluster, **kwargs: Any - ) -> LROPoller["_models.OpenShiftManagedCluster"]: + ) -> LROPoller[_models.OpenShiftManagedCluster]: """Creates or updates an OpenShift managed cluster. Creates or updates a OpenShift managed cluster with the specified configuration for agents and @@ -583,37 +611,47 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_09_30_preview.models.OpenShiftManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-09-30-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-30-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OpenShiftManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('OpenShiftManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -630,17 +668,20 @@ def _update_tags_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.OpenShiftManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.OpenShiftManagedCluster"] + ) -> _models.OpenShiftManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2019-09-30-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-30-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedCluster] _json = self._serialize.body(parameters, 'TagsObject') @@ -652,11 +693,13 @@ def _update_tags_initial( content_type=content_type, json=_json, template_url=self._update_tags_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -682,9 +725,9 @@ def begin_update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> LROPoller["_models.OpenShiftManagedCluster"]: + ) -> LROPoller[_models.OpenShiftManagedCluster]: """Updates tags on an OpenShift managed cluster. Updates an OpenShift managed cluster with the specified tags. @@ -709,37 +752,47 @@ def begin_update_tags( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_09_30_preview.models.OpenShiftManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-09-30-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-30-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OpenShiftManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._update_tags_initial( + raw_result = self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('OpenShiftManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -758,13 +811,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2019-09-30-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-30-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -773,11 +829,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -821,20 +879,25 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-09-30-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-30-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_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) @@ -844,8 +907,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_09_30_preview/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/__init__.py index 53c675bd95e2..37a5f9e02e6f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._container_service_client import ContainerServiceClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['ContainerServiceClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/_container_service_client.py index 5f29f6b87e19..1aa2e31ad515 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/_container_service_client.py @@ -60,9 +60,15 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.managed_clusters = ManagedClustersOperations(self._client, self._config, self._serialize, self._deserialize) - self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_clusters = ManagedClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.agent_pools = AgentPoolsOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/aio/__init__.py index 53c675bd95e2..37a5f9e02e6f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/aio/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/aio/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._container_service_client import ContainerServiceClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['ContainerServiceClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/aio/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/aio/_container_service_client.py index 57d44dd0b123..ae6051baa82c 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/aio/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/aio/_container_service_client.py @@ -61,9 +61,15 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.managed_clusters = ManagedClustersOperations(self._client, self._config, self._serialize, self._deserialize) - self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_clusters = ManagedClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.agent_pools = AgentPoolsOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/aio/operations/__init__.py index 5aac40228eec..403c0174f052 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/aio/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/aio/operations/__init__.py @@ -10,8 +10,13 @@ from ._managed_clusters_operations import ManagedClustersOperations from ._agent_pools_operations import AgentPoolsOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'Operations', 'ManagedClustersOperations', 'AgentPoolsOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/aio/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/aio/operations/_agent_pools_operations.py index 9a864c0efb1d..e0e16c336d86 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/aio/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/aio/operations/_agent_pools_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. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ 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 @@ -26,26 +27,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class AgentPoolsOperations: - """AgentPoolsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2019_10_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2019_10_01.aio.ContainerServiceClient`'s + :attr:`agent_pools` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -53,7 +52,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> AsyncIterable["_models.AgentPoolListResult"]: + ) -> AsyncIterable[_models.AgentPoolListResult]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. The operation returns properties @@ -69,13 +68,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2019_10_01.models.AgentPoolListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -85,9 +87,11 @@ def prepare_request(next_link=None): resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -97,9 +101,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -139,7 +145,7 @@ async def get( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPool": + ) -> _models.AgentPool: """Gets the agent pool. Gets the details of the agent pool by managed cluster and resource group. @@ -155,13 +161,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2019_10_01.models.AgentPool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-10-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] request = build_get_request( @@ -171,11 +180,13 @@ async def get( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -201,17 +212,20 @@ async def _create_or_update_initial( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> "_models.AgentPool": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] + ) -> _models.AgentPool: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2019-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] _json = self._serialize.body(parameters, 'AgentPool') @@ -224,11 +238,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -259,9 +275,9 @@ async def begin_create_or_update( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> AsyncLROPoller["_models.AgentPool"]: + ) -> AsyncLROPoller[_models.AgentPool]: """Creates or updates an agent pool. Creates or updates an agent pool in the specified managed cluster. @@ -288,17 +304,20 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_10_01.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, @@ -306,20 +325,27 @@ async def begin_create_or_update( 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): - response = pipeline_response.http_response deserialized = self._deserialize('AgentPool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -339,13 +365,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements agent_pool_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-10-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -355,11 +384,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -406,21 +437,26 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-10-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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) @@ -430,8 +466,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -451,7 +493,7 @@ async def get_upgrade_profile( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPoolUpgradeProfile": + ) -> _models.AgentPoolUpgradeProfile: """Gets upgrade profile for an agent pool. Gets the details of the upgrade profile for an agent pool with a specified resource group and @@ -468,13 +510,16 @@ async def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2019_10_01.models.AgentPoolUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2019-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] request = build_get_upgrade_profile_request( @@ -484,11 +529,13 @@ async def get_upgrade_profile( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -515,7 +562,7 @@ async def get_available_agent_pool_versions( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.AgentPoolAvailableVersions": + ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported versions for the specified agent pool. Gets a list of supported versions for the specified agent pool. @@ -529,13 +576,16 @@ async def get_available_agent_pool_versions( :rtype: ~azure.mgmt.containerservice.v2019_10_01.models.AgentPoolAvailableVersions :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolAvailableVersions"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-10-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] request = build_get_available_agent_pool_versions_request( @@ -544,11 +594,13 @@ async def get_available_agent_pool_versions( resource_name=resource_name, api_version=api_version, template_url=self.get_available_agent_pool_versions.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/aio/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/aio/operations/_managed_clusters_operations.py index 262bf6a908b0..6e0a24de85e8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/aio/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/aio/operations/_managed_clusters_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. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ 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 @@ -26,32 +27,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ManagedClustersOperations: - """ManagedClustersOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2019_10_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2019_10_01.aio.ContainerServiceClient`'s + :attr:`managed_clusters` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.ManagedClusterListResult"]: + ) -> AsyncIterable[_models.ManagedClusterListResult]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. The operation returns properties @@ -64,13 +63,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2019_10_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -78,9 +80,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -88,9 +92,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -128,7 +134,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ManagedClusterListResult"]: + ) -> AsyncIterable[_models.ManagedClusterListResult]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. The operation returns @@ -143,13 +149,16 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2019_10_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -158,9 +167,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -169,9 +180,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -210,7 +223,7 @@ async def get_upgrade_profile( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedClusterUpgradeProfile": + ) -> _models.ManagedClusterUpgradeProfile: """Gets upgrade profile for a managed cluster. Gets the details of the upgrade profile for a managed cluster with a specified resource group @@ -225,13 +238,16 @@ async def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2019_10_01.models.ManagedClusterUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-10-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] request = build_get_upgrade_profile_request( @@ -240,11 +256,13 @@ async def get_upgrade_profile( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -272,7 +290,7 @@ async def get_access_profile( resource_name: str, role_name: str, **kwargs: Any - ) -> "_models.ManagedClusterAccessProfile": + ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. Gets the accessProfile for the specified role name of the managed cluster with a specified @@ -289,13 +307,16 @@ async def get_access_profile( :rtype: ~azure.mgmt.containerservice.v2019_10_01.models.ManagedClusterAccessProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterAccessProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2019-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] request = build_get_access_profile_request( @@ -305,11 +326,13 @@ async def get_access_profile( role_name=role_name, api_version=api_version, template_url=self.get_access_profile.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -336,7 +359,7 @@ async def list_cluster_admin_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster admin credential of a managed cluster. Gets cluster admin credential of the managed cluster with a specified resource group and name. @@ -350,13 +373,16 @@ async def list_cluster_admin_credentials( :rtype: ~azure.mgmt.containerservice.v2019_10_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-10-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_admin_credentials_request( @@ -365,11 +391,13 @@ async def list_cluster_admin_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_admin_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -396,7 +424,7 @@ async def list_cluster_user_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster user credential of a managed cluster. Gets cluster user credential of the managed cluster with a specified resource group and name. @@ -410,13 +438,16 @@ async def list_cluster_user_credentials( :rtype: ~azure.mgmt.containerservice.v2019_10_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2019-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_user_credentials_request( @@ -425,11 +456,13 @@ async def list_cluster_user_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -456,7 +489,7 @@ async def list_cluster_monitoring_user_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster monitoring user credential of a managed cluster. Gets cluster monitoring user credential of the managed cluster with a specified resource group @@ -471,13 +504,16 @@ async def list_cluster_monitoring_user_credentials( :rtype: ~azure.mgmt.containerservice.v2019_10_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-10-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_monitoring_user_credentials_request( @@ -486,11 +522,13 @@ async def list_cluster_monitoring_user_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -517,7 +555,7 @@ async def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedCluster": + ) -> _models.ManagedCluster: """Gets a managed cluster. Gets the details of the managed cluster with a specified resource group and name. @@ -531,13 +569,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2019_10_01.models.ManagedCluster :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2019-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] request = build_get_request( @@ -546,11 +587,13 @@ async def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -575,17 +618,20 @@ async def _create_or_update_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2019-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'ManagedCluster') @@ -597,11 +643,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -631,9 +679,9 @@ async def begin_create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> AsyncLROPoller["_models.ManagedCluster"]: + ) -> AsyncLROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. Creates or updates a managed cluster with the specified configuration for agents and Kubernetes @@ -659,37 +707,47 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_10_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -706,17 +764,20 @@ async def _update_tags_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2019-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'TagsObject') @@ -728,11 +789,13 @@ async def _update_tags_initial( content_type=content_type, json=_json, template_url=self._update_tags_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -758,9 +821,9 @@ async def begin_update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> AsyncLROPoller["_models.ManagedCluster"]: + ) -> AsyncLROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates a managed cluster with the specified tags. @@ -785,37 +848,47 @@ async def begin_update_tags( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_10_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._update_tags_initial( + raw_result = await self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -834,13 +907,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-10-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -849,11 +925,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -897,20 +975,25 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-10-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_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) @@ -920,8 +1003,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -938,17 +1027,20 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2019-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') @@ -960,11 +1052,13 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist content_type=content_type, json=_json, template_url=self._reset_service_principal_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -986,7 +1080,7 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> AsyncLROPoller[None]: """Reset Service Principal Profile of a managed cluster. @@ -1013,23 +1107,28 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._reset_service_principal_profile_initial( + raw_result = await self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1039,8 +1138,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1057,17 +1162,20 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2019-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') @@ -1079,11 +1187,13 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta content_type=content_type, json=_json, template_url=self._reset_aad_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1105,7 +1215,7 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> AsyncLROPoller[None]: """Reset AAD Profile of a managed cluster. @@ -1131,23 +1241,28 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._reset_aad_profile_initial( + raw_result = await self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1157,8 +1272,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1177,13 +1298,16 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-10-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_rotate_cluster_certificates_request_initial( @@ -1192,11 +1316,13 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- resource_name=resource_name, api_version=api_version, template_url=self._rotate_cluster_certificates_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1240,20 +1366,25 @@ async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-ret :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-10-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._rotate_cluster_certificates_initial( + raw_result = await self._rotate_cluster_certificates_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) @@ -1263,8 +1394,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/aio/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/aio/operations/_operations.py index 8a5c345d9896..54530a8e359e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/aio/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/aio/operations/_operations.py @@ -14,6 +14,7 @@ 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 @@ -23,32 +24,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class Operations: - """Operations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2019_10_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2019_10_01.aio.ContainerServiceClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.OperationListResult"]: + ) -> AsyncIterable[_models.OperationListResult]: """Gets a list of compute operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -57,31 +56,38 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2019_10_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/aio/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/aio/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/models/__init__.py index 2988c4a54d06..f8a486e34973 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/models/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/models/__init__.py @@ -61,7 +61,9 @@ ScaleSetEvictionPolicy, ScaleSetPriority, ) - +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'AgentPool', 'AgentPoolAvailableVersions', @@ -115,3 +117,5 @@ 'ScaleSetEvictionPolicy', 'ScaleSetPriority', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/models/_container_service_client_enums.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/models/_container_service_client_enums.py index 18f038fe5f80..f2a8ca90fcb1 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/models/_container_service_client_enums.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/models/_container_service_client_enums.py @@ -7,11 +7,10 @@ # -------------------------------------------------------------------------- from enum import Enum -from six import with_metaclass from azure.core import CaseInsensitiveEnumMeta -class AgentPoolType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class AgentPoolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """AgentPoolType represents types of an agent pool. VirtualMachineScaleSets type is still in PREVIEW. """ @@ -19,7 +18,7 @@ class AgentPoolType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): VIRTUAL_MACHINE_SCALE_SETS = "VirtualMachineScaleSets" AVAILABILITY_SET = "AvailabilitySet" -class ContainerServiceStorageProfileTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the orchestrator choice. """ @@ -27,7 +26,7 @@ class ContainerServiceStorageProfileTypes(with_metaclass(CaseInsensitiveEnumMeta STORAGE_ACCOUNT = "StorageAccount" MANAGED_DISKS = "ManagedDisks" -class ContainerServiceVMSizeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Size of agent VMs. """ @@ -206,7 +205,7 @@ class ContainerServiceVMSizeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, E STANDARD_NV24 = "Standard_NV24" STANDARD_NV6 = "Standard_NV6" -class Count(with_metaclass(CaseInsensitiveEnumMeta, int, Enum)): +class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): """Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, and 5. The default value is 1. """ @@ -215,35 +214,35 @@ class Count(with_metaclass(CaseInsensitiveEnumMeta, int, Enum)): THREE = 3 FIVE = 5 -class LoadBalancerSku(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class LoadBalancerSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The load balancer sku for the managed cluster. """ STANDARD = "standard" BASIC = "basic" -class NetworkPlugin(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkPlugin(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Network plugin used for building Kubernetes network. """ AZURE = "azure" KUBENET = "kubenet" -class NetworkPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Network policy used for building Kubernetes network. """ CALICO = "calico" AZURE = "azure" -class OSType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux. """ LINUX = "Linux" WINDOWS = "Windows" -class ResourceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ resource group in agent nodes. Type 'None' will not use MSI for the managed cluster, service @@ -253,7 +252,7 @@ class ResourceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): SYSTEM_ASSIGNED = "SystemAssigned" NONE = "None" -class ScaleSetEvictionPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ScaleSetEvictionPolicy to be used to specify eviction policy for low priority virtual machine scale set. Default to Delete. """ @@ -261,7 +260,7 @@ class ScaleSetEvictionPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)) DELETE = "Delete" DEALLOCATE = "Deallocate" -class ScaleSetPriority(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ScaleSetPriority(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ScaleSetPriority to be used to specify virtual machine scale set priority. Default to regular. """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/models/_models_py3.py index 7fa8cdbee0ec..a62cbbe0d057 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/models/_models_py3.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/models/_models_py3.py @@ -6,11 +6,13 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Dict, List, Optional, Union +from typing import Dict, List, Optional, TYPE_CHECKING, Union import msrest.serialization -from ._container_service_client_enums import * +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + import __init__ as _models class SubResource(msrest.serialization.Model): @@ -66,7 +68,7 @@ class AgentPool(SubResource): :ivar count: Number of agents (VMs) 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: Size of agent VMs. Possible values include: "Standard_A1", "Standard_A10", + :ivar vm_size: Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -115,7 +117,7 @@ class AgentPool(SubResource): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2019_10_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -123,8 +125,8 @@ class AgentPool(SubResource): :vartype min_count: int :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool - :ivar type_properties_type: AgentPoolType represents types of an agent pool. Possible values - include: "VirtualMachineScaleSets", "AvailabilitySet". + :ivar type_properties_type: AgentPoolType represents types of an agent pool. Known values are: + "VirtualMachineScaleSets", "AvailabilitySet". :vartype type_properties_type: str or ~azure.mgmt.containerservice.v2019_10_01.models.AgentPoolType :ivar orchestrator_version: Version of orchestrator specified when creating the managed @@ -139,13 +141,12 @@ class AgentPool(SubResource): :ivar enable_node_public_ip: Enable public IP for nodes. :vartype enable_node_public_ip: bool :ivar scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Possible values include: "Low", "Regular". Default value: - "Regular". + priority. Default to regular. Known values are: "Low", "Regular". Default value: "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2019_10_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy - for low priority virtual machine scale set. Default to Delete. Possible values include: - "Delete", "Deallocate". Default value: "Delete". + for low priority virtual machine scale set. Default to Delete. Known values are: "Delete", + "Deallocate". Default value: "Delete". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2019_10_01.models.ScaleSetEvictionPolicy :ivar node_taints: Taints added to new nodes during node pool create and scale. For example, @@ -188,20 +189,20 @@ def __init__( self, *, count: Optional[int] = None, - vm_size: Optional[Union[str, "ContainerServiceVMSizeTypes"]] = None, + vm_size: Optional[Union[str, "_models.ContainerServiceVMSizeTypes"]] = None, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - type_properties_type: Optional[Union[str, "AgentPoolType"]] = None, + type_properties_type: Optional[Union[str, "_models.AgentPoolType"]] = None, orchestrator_version: Optional[str] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, - scale_set_priority: Optional[Union[str, "ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", node_taints: Optional[List[str]] = None, **kwargs ): @@ -209,7 +210,7 @@ def __init__( :keyword count: Number of agents (VMs) 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: Size of agent VMs. Possible values include: "Standard_A1", "Standard_A10", + :keyword vm_size: Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -258,7 +259,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2019_10_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -266,8 +267,8 @@ def __init__( :paramtype min_count: int :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool - :keyword type_properties_type: AgentPoolType represents types of an agent pool. Possible values - include: "VirtualMachineScaleSets", "AvailabilitySet". + :keyword type_properties_type: AgentPoolType represents types of an agent pool. Known values + are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type_properties_type: str or ~azure.mgmt.containerservice.v2019_10_01.models.AgentPoolType :keyword orchestrator_version: Version of orchestrator specified when creating the managed @@ -279,12 +280,11 @@ def __init__( :keyword enable_node_public_ip: Enable public IP for nodes. :paramtype enable_node_public_ip: bool :keyword scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Possible values include: "Low", "Regular". Default value: - "Regular". + priority. Default to regular. Known values are: "Low", "Regular". Default value: "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2019_10_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction - policy for low priority virtual machine scale set. Default to Delete. Possible values include: + policy for low priority virtual machine scale set. Default to Delete. Known values are: "Delete", "Deallocate". Default value: "Delete". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2019_10_01.models.ScaleSetEvictionPolicy @@ -344,7 +344,7 @@ class AgentPoolAvailableVersions(msrest.serialization.Model): def __init__( self, *, - agent_pool_versions: Optional[List["AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem"]] = None, + agent_pool_versions: Optional[List["_models.AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem"]] = None, **kwargs ): """ @@ -421,7 +421,7 @@ class AgentPoolListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["AgentPool"]] = None, + value: Optional[List["_models.AgentPool"]] = None, **kwargs ): """ @@ -449,7 +449,7 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): :ivar kubernetes_version: Required. Kubernetes version (major, minor, patch). :vartype kubernetes_version: str :ivar os_type: Required. OsType to be used to specify os type. Choose from Linux and Windows. - Default to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2019_10_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -477,15 +477,15 @@ def __init__( self, *, kubernetes_version: str, - os_type: Union[str, "OSType"] = "Linux", - upgrades: Optional[List["AgentPoolUpgradeProfilePropertiesUpgradesItem"]] = None, + os_type: Union[str, "_models.OSType"] = "Linux", + upgrades: Optional[List["_models.AgentPoolUpgradeProfilePropertiesUpgradesItem"]] = None, **kwargs ): """ :keyword kubernetes_version: Required. Kubernetes version (major, minor, patch). :paramtype kubernetes_version: str :keyword os_type: Required. OsType to be used to specify os type. Choose from Linux and - Windows. Default to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Windows. Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2019_10_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: @@ -561,7 +561,7 @@ def __init__( code: Optional[str] = None, message: Optional[str] = None, target: Optional[str] = None, - details: Optional[List["CloudErrorBody"]] = None, + details: Optional[List["_models.CloudErrorBody"]] = None, **kwargs ): """ @@ -605,7 +605,7 @@ class ContainerServiceDiagnosticsProfile(msrest.serialization.Model): def __init__( self, *, - vm_diagnostics: "ContainerServiceVMDiagnostics", + vm_diagnostics: "_models.ContainerServiceVMDiagnostics", **kwargs ): """ @@ -642,7 +642,7 @@ def __init__( self, *, admin_username: str, - ssh: "ContainerServiceSshConfiguration", + ssh: "_models.ContainerServiceSshConfiguration", **kwargs ): """ @@ -665,17 +665,17 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar count: Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, - and 5. The default value is 1. Possible values include: 1, 3, 5. Default value: "1". + and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". :vartype count: int or ~azure.mgmt.containerservice.v2019_10_01.models.Count :ivar dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. :vartype dns_prefix: str - :ivar vm_size: Required. Size of agent VMs. Possible values include: "Standard_A1", - "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", - "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", - "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", - "Standard_A8m_v2", "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", - "Standard_B8ms", "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", - "Standard_D12", "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", + :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", + "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", + "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", + "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", "Standard_B8ms", + "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", "Standard_D12", + "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", "Standard_D13_v2_Promo", "Standard_D14", "Standard_D14_v2", "Standard_D14_v2_Promo", "Standard_D15_v2", "Standard_D16_v3", "Standard_D16s_v3", "Standard_D1_v2", "Standard_D2", "Standard_D2_v2", "Standard_D2_v2_Promo", "Standard_D2_v3", "Standard_D2s_v3", "Standard_D3", @@ -720,7 +720,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): :vartype first_consecutive_static_ip: str :ivar storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Possible values include: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". :vartype storage_profile: str or ~azure.mgmt.containerservice.v2019_10_01.models.ContainerServiceStorageProfileTypes :ivar fqdn: FQDN for the master pool. @@ -749,27 +749,27 @@ def __init__( self, *, dns_prefix: str, - vm_size: Union[str, "ContainerServiceVMSizeTypes"], - count: Optional[Union[int, "Count"]] = 1, + vm_size: Union[str, "_models.ContainerServiceVMSizeTypes"], + count: Optional[Union[int, "_models.Count"]] = 1, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, first_consecutive_static_ip: Optional[str] = "10.240.255.5", - storage_profile: Optional[Union[str, "ContainerServiceStorageProfileTypes"]] = None, + storage_profile: Optional[Union[str, "_models.ContainerServiceStorageProfileTypes"]] = None, **kwargs ): """ :keyword count: Number of masters (VMs) in the container service cluster. Allowed values are 1, - 3, and 5. The default value is 1. Possible values include: 1, 3, 5. Default value: "1". + 3, and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". :paramtype count: int or ~azure.mgmt.containerservice.v2019_10_01.models.Count :keyword dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. :paramtype dns_prefix: str - :keyword vm_size: Required. Size of agent VMs. Possible values include: "Standard_A1", - "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", - "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", - "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", - "Standard_A8m_v2", "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", - "Standard_B8ms", "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", - "Standard_D12", "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", + :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", + "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", + "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", + "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", "Standard_B8ms", + "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", "Standard_D12", + "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", "Standard_D13_v2_Promo", "Standard_D14", "Standard_D14_v2", "Standard_D14_v2_Promo", "Standard_D15_v2", "Standard_D16_v3", "Standard_D16s_v3", "Standard_D1_v2", "Standard_D2", "Standard_D2_v2", "Standard_D2_v2_Promo", "Standard_D2_v3", "Standard_D2s_v3", "Standard_D3", @@ -814,7 +814,7 @@ def __init__( :paramtype first_consecutive_static_ip: str :keyword storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Possible values include: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". :paramtype storage_profile: str or ~azure.mgmt.containerservice.v2019_10_01.models.ContainerServiceStorageProfileTypes """ @@ -832,11 +832,11 @@ def __init__( class ContainerServiceNetworkProfile(msrest.serialization.Model): """Profile of network configuration. - :ivar network_plugin: Network plugin used for building Kubernetes network. Possible values - include: "azure", "kubenet". Default value: "kubenet". + :ivar network_plugin: Network plugin used for building Kubernetes network. Known values are: + "azure", "kubenet". Default value: "kubenet". :vartype network_plugin: str or ~azure.mgmt.containerservice.v2019_10_01.models.NetworkPlugin - :ivar network_policy: Network policy used for building Kubernetes network. Possible values - include: "calico", "azure". + :ivar network_policy: Network policy used for building Kubernetes network. Known values are: + "calico", "azure". :vartype network_policy: str or ~azure.mgmt.containerservice.v2019_10_01.models.NetworkPolicy :ivar pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :vartype pod_cidr: str @@ -849,8 +849,8 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): :ivar docker_bridge_cidr: A CIDR notation IP range assigned to the Docker bridge network. It must not overlap with any Subnet IP ranges or the Kubernetes service address range. :vartype docker_bridge_cidr: str - :ivar load_balancer_sku: The load balancer sku for the managed cluster. Possible values - include: "standard", "basic". + :ivar load_balancer_sku: The load balancer sku for the managed cluster. Known values are: + "standard", "basic". :vartype load_balancer_sku: str or ~azure.mgmt.containerservice.v2019_10_01.models.LoadBalancerSku :ivar load_balancer_profile: Profile of the cluster load balancer. @@ -879,22 +879,22 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): def __init__( self, *, - network_plugin: Optional[Union[str, "NetworkPlugin"]] = "kubenet", - network_policy: Optional[Union[str, "NetworkPolicy"]] = None, + network_plugin: Optional[Union[str, "_models.NetworkPlugin"]] = "kubenet", + network_policy: Optional[Union[str, "_models.NetworkPolicy"]] = None, pod_cidr: Optional[str] = "10.244.0.0/16", service_cidr: Optional[str] = "10.0.0.0/16", dns_service_ip: Optional[str] = "10.0.0.10", docker_bridge_cidr: Optional[str] = "172.17.0.1/16", - load_balancer_sku: Optional[Union[str, "LoadBalancerSku"]] = None, - load_balancer_profile: Optional["ManagedClusterLoadBalancerProfile"] = None, + load_balancer_sku: Optional[Union[str, "_models.LoadBalancerSku"]] = None, + load_balancer_profile: Optional["_models.ManagedClusterLoadBalancerProfile"] = None, **kwargs ): """ - :keyword network_plugin: Network plugin used for building Kubernetes network. Possible values - include: "azure", "kubenet". Default value: "kubenet". + :keyword network_plugin: Network plugin used for building Kubernetes network. Known values are: + "azure", "kubenet". Default value: "kubenet". :paramtype network_plugin: str or ~azure.mgmt.containerservice.v2019_10_01.models.NetworkPlugin - :keyword network_policy: Network policy used for building Kubernetes network. Possible values - include: "calico", "azure". + :keyword network_policy: Network policy used for building Kubernetes network. Known values are: + "calico", "azure". :paramtype network_policy: str or ~azure.mgmt.containerservice.v2019_10_01.models.NetworkPolicy :keyword pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :paramtype pod_cidr: str @@ -907,8 +907,8 @@ def __init__( :keyword docker_bridge_cidr: A CIDR notation IP range assigned to the Docker bridge network. It must not overlap with any Subnet IP ranges or the Kubernetes service address range. :paramtype docker_bridge_cidr: str - :keyword load_balancer_sku: The load balancer sku for the managed cluster. Possible values - include: "standard", "basic". + :keyword load_balancer_sku: The load balancer sku for the managed cluster. Known values are: + "standard", "basic". :paramtype load_balancer_sku: str or ~azure.mgmt.containerservice.v2019_10_01.models.LoadBalancerSku :keyword load_balancer_profile: Profile of the cluster load balancer. @@ -948,7 +948,7 @@ class ContainerServiceSshConfiguration(msrest.serialization.Model): def __init__( self, *, - public_keys: List["ContainerServiceSshPublicKey"], + public_keys: List["_models.ContainerServiceSshPublicKey"], **kwargs ): """ @@ -1254,20 +1254,20 @@ def __init__( *, location: str, tags: Optional[Dict[str, str]] = None, - identity: Optional["ManagedClusterIdentity"] = None, + identity: Optional["_models.ManagedClusterIdentity"] = None, kubernetes_version: Optional[str] = None, dns_prefix: Optional[str] = None, - agent_pool_profiles: Optional[List["ManagedClusterAgentPoolProfile"]] = None, - linux_profile: Optional["ContainerServiceLinuxProfile"] = None, - windows_profile: Optional["ManagedClusterWindowsProfile"] = None, - service_principal_profile: Optional["ManagedClusterServicePrincipalProfile"] = None, - addon_profiles: Optional[Dict[str, "ManagedClusterAddonProfile"]] = None, + agent_pool_profiles: Optional[List["_models.ManagedClusterAgentPoolProfile"]] = None, + linux_profile: Optional["_models.ContainerServiceLinuxProfile"] = None, + windows_profile: Optional["_models.ManagedClusterWindowsProfile"] = None, + service_principal_profile: Optional["_models.ManagedClusterServicePrincipalProfile"] = None, + addon_profiles: Optional[Dict[str, "_models.ManagedClusterAddonProfile"]] = None, node_resource_group: Optional[str] = None, enable_rbac: Optional[bool] = None, enable_pod_security_policy: Optional[bool] = None, - network_profile: Optional["ContainerServiceNetworkProfile"] = None, - aad_profile: Optional["ManagedClusterAADProfile"] = None, - api_server_access_profile: Optional["ManagedClusterAPIServerAccessProfile"] = None, + network_profile: Optional["_models.ContainerServiceNetworkProfile"] = None, + aad_profile: Optional["_models.ManagedClusterAADProfile"] = None, + api_server_access_profile: Optional["_models.ManagedClusterAPIServerAccessProfile"] = None, **kwargs ): """ @@ -1494,7 +1494,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar count: Number of agents (VMs) 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: Size of agent VMs. Possible values include: "Standard_A1", "Standard_A10", + :ivar vm_size: Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -1543,7 +1543,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2019_10_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -1551,7 +1551,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :vartype min_count: int :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool - :ivar type: AgentPoolType represents types of an agent pool. Possible values include: + :ivar type: AgentPoolType represents types of an agent pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2019_10_01.models.AgentPoolType :ivar orchestrator_version: Version of orchestrator specified when creating the managed @@ -1566,13 +1566,12 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar enable_node_public_ip: Enable public IP for nodes. :vartype enable_node_public_ip: bool :ivar scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Possible values include: "Low", "Regular". Default value: - "Regular". + priority. Default to regular. Known values are: "Low", "Regular". Default value: "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2019_10_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy - for low priority virtual machine scale set. Default to Delete. Possible values include: - "Delete", "Deallocate". Default value: "Delete". + for low priority virtual machine scale set. Default to Delete. Known values are: "Delete", + "Deallocate". Default value: "Delete". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2019_10_01.models.ScaleSetEvictionPolicy :ivar node_taints: Taints added to new nodes during node pool create and scale. For example, @@ -1609,20 +1608,20 @@ def __init__( self, *, count: Optional[int] = None, - vm_size: Optional[Union[str, "ContainerServiceVMSizeTypes"]] = None, + vm_size: Optional[Union[str, "_models.ContainerServiceVMSizeTypes"]] = None, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - type: Optional[Union[str, "AgentPoolType"]] = None, + type: Optional[Union[str, "_models.AgentPoolType"]] = None, orchestrator_version: Optional[str] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, - scale_set_priority: Optional[Union[str, "ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", node_taints: Optional[List[str]] = None, **kwargs ): @@ -1630,7 +1629,7 @@ def __init__( :keyword count: Number of agents (VMs) 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: Size of agent VMs. Possible values include: "Standard_A1", "Standard_A10", + :keyword vm_size: Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -1679,7 +1678,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2019_10_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -1687,7 +1686,7 @@ def __init__( :paramtype min_count: int :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool - :keyword type: AgentPoolType represents types of an agent pool. Possible values include: + :keyword type: AgentPoolType represents types of an agent pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2019_10_01.models.AgentPoolType :keyword orchestrator_version: Version of orchestrator specified when creating the managed @@ -1699,12 +1698,11 @@ def __init__( :keyword enable_node_public_ip: Enable public IP for nodes. :paramtype enable_node_public_ip: bool :keyword scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Possible values include: "Low", "Regular". Default value: - "Regular". + priority. Default to regular. Known values are: "Low", "Regular". Default value: "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2019_10_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction - policy for low priority virtual machine scale set. Default to Delete. Possible values include: + policy for low priority virtual machine scale set. Default to Delete. Known values are: "Delete", "Deallocate". Default value: "Delete". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2019_10_01.models.ScaleSetEvictionPolicy @@ -1742,7 +1740,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar count: Number of agents (VMs) 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: Size of agent VMs. Possible values include: "Standard_A1", "Standard_A10", + :ivar vm_size: Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -1791,7 +1789,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2019_10_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -1799,7 +1797,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :vartype min_count: int :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool - :ivar type: AgentPoolType represents types of an agent pool. Possible values include: + :ivar type: AgentPoolType represents types of an agent pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2019_10_01.models.AgentPoolType :ivar orchestrator_version: Version of orchestrator specified when creating the managed @@ -1814,13 +1812,12 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar enable_node_public_ip: Enable public IP for nodes. :vartype enable_node_public_ip: bool :ivar scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Possible values include: "Low", "Regular". Default value: - "Regular". + priority. Default to regular. Known values are: "Low", "Regular". Default value: "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2019_10_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy - for low priority virtual machine scale set. Default to Delete. Possible values include: - "Delete", "Deallocate". Default value: "Delete". + for low priority virtual machine scale set. Default to Delete. Known values are: "Delete", + "Deallocate". Default value: "Delete". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2019_10_01.models.ScaleSetEvictionPolicy :ivar node_taints: Taints added to new nodes during node pool create and scale. For example, @@ -1863,20 +1860,20 @@ def __init__( *, name: str, count: Optional[int] = None, - vm_size: Optional[Union[str, "ContainerServiceVMSizeTypes"]] = None, + vm_size: Optional[Union[str, "_models.ContainerServiceVMSizeTypes"]] = None, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - type: Optional[Union[str, "AgentPoolType"]] = None, + type: Optional[Union[str, "_models.AgentPoolType"]] = None, orchestrator_version: Optional[str] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, - scale_set_priority: Optional[Union[str, "ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", node_taints: Optional[List[str]] = None, **kwargs ): @@ -1884,7 +1881,7 @@ def __init__( :keyword count: Number of agents (VMs) 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: Size of agent VMs. Possible values include: "Standard_A1", "Standard_A10", + :keyword vm_size: Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -1933,7 +1930,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2019_10_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -1941,7 +1938,7 @@ def __init__( :paramtype min_count: int :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool - :keyword type: AgentPoolType represents types of an agent pool. Possible values include: + :keyword type: AgentPoolType represents types of an agent pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2019_10_01.models.AgentPoolType :keyword orchestrator_version: Version of orchestrator specified when creating the managed @@ -1953,12 +1950,11 @@ def __init__( :keyword enable_node_public_ip: Enable public IP for nodes. :paramtype enable_node_public_ip: bool :keyword scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Possible values include: "Low", "Regular". Default value: - "Regular". + priority. Default to regular. Known values are: "Low", "Regular". Default value: "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2019_10_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction - policy for low priority virtual machine scale set. Default to Delete. Possible values include: + policy for low priority virtual machine scale set. Default to Delete. Known values are: "Delete", "Deallocate". Default value: "Delete". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2019_10_01.models.ScaleSetEvictionPolicy @@ -2019,7 +2015,7 @@ class ManagedClusterIdentity(msrest.serialization.Model): :ivar type: The type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ resource group in agent nodes. Type 'None' will not use MSI for the managed cluster, - service principal will be used instead. Possible values include: "SystemAssigned", "None". + service principal will be used instead. Known values are: "SystemAssigned", "None". :vartype type: str or ~azure.mgmt.containerservice.v2019_10_01.models.ResourceIdentityType """ @@ -2037,15 +2033,14 @@ class ManagedClusterIdentity(msrest.serialization.Model): def __init__( self, *, - type: Optional[Union[str, "ResourceIdentityType"]] = None, + type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, **kwargs ): """ :keyword type: The type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ resource group in agent nodes. Type 'None' will not use MSI for the managed - cluster, service principal will be used instead. Possible values include: "SystemAssigned", - "None". + cluster, service principal will be used instead. Known values are: "SystemAssigned", "None". :paramtype type: str or ~azure.mgmt.containerservice.v2019_10_01.models.ResourceIdentityType """ super(ManagedClusterIdentity, self).__init__(**kwargs) @@ -2077,7 +2072,7 @@ class ManagedClusterListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["ManagedCluster"]] = None, + value: Optional[List["_models.ManagedCluster"]] = None, **kwargs ): """ @@ -2117,10 +2112,10 @@ class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): def __init__( self, *, - managed_outbound_i_ps: Optional["ManagedClusterLoadBalancerProfileManagedOutboundIPs"] = None, - outbound_ip_prefixes: Optional["ManagedClusterLoadBalancerProfileOutboundIPPrefixes"] = None, - outbound_i_ps: Optional["ManagedClusterLoadBalancerProfileOutboundIPs"] = None, - effective_outbound_i_ps: Optional[List["ResourceReference"]] = None, + managed_outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileManagedOutboundIPs"] = None, + outbound_ip_prefixes: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPPrefixes"] = None, + outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPs"] = None, + effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, **kwargs ): """ @@ -2192,7 +2187,7 @@ class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.M def __init__( self, *, - public_ip_prefixes: Optional[List["ResourceReference"]] = None, + public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, **kwargs ): """ @@ -2218,7 +2213,7 @@ class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): def __init__( self, *, - public_i_ps: Optional[List["ResourceReference"]] = None, + public_i_ps: Optional[List["_models.ResourceReference"]] = None, **kwargs ): """ @@ -2239,7 +2234,7 @@ class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): :ivar name: Pool name. :vartype name: str :ivar os_type: Required. OsType to be used to specify os type. Choose from Linux and Windows. - Default to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2019_10_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -2262,9 +2257,9 @@ def __init__( self, *, kubernetes_version: str, - os_type: Union[str, "OSType"] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", name: Optional[str] = None, - upgrades: Optional[List["ManagedClusterPoolUpgradeProfileUpgradesItem"]] = None, + upgrades: Optional[List["_models.ManagedClusterPoolUpgradeProfileUpgradesItem"]] = None, **kwargs ): """ @@ -2273,7 +2268,7 @@ def __init__( :keyword name: Pool name. :paramtype name: str :keyword os_type: Required. OsType to be used to specify os type. Choose from Linux and - Windows. Default to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Windows. Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2019_10_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: @@ -2397,8 +2392,8 @@ class ManagedClusterUpgradeProfile(msrest.serialization.Model): def __init__( self, *, - control_plane_profile: "ManagedClusterPoolUpgradeProfile", - agent_pool_profiles: List["ManagedClusterPoolUpgradeProfile"], + control_plane_profile: "_models.ManagedClusterPoolUpgradeProfile", + agent_pool_profiles: List["_models.ManagedClusterPoolUpgradeProfile"], **kwargs ): """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/models/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/models/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/operations/__init__.py index 5aac40228eec..403c0174f052 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/operations/__init__.py @@ -10,8 +10,13 @@ from ._managed_clusters_operations import ManagedClustersOperations from ._agent_pools_operations import AgentPoolsOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'Operations', 'ManagedClustersOperations', 'AgentPoolsOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/operations/_agent_pools_operations.py index 58db68138534..30d32418184d 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/operations/_agent_pools_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -35,9 +35,12 @@ def build_list_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-10-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools") # pylint: disable=line-too-long path_format_arguments = { @@ -49,18 +52,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -72,9 +73,12 @@ def build_get_request( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-10-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -87,18 +91,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -109,14 +111,17 @@ def build_create_or_update_request_initial( resource_name: str, agent_pool_name: str, *, - json: JSONType = None, + json: Optional[_models.AgentPool] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -129,20 +134,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -156,9 +159,12 @@ def build_delete_request_initial( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-10-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -171,18 +177,16 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -194,9 +198,12 @@ def build_get_upgrade_profile_request( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-10-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default") # pylint: disable=line-too-long path_format_arguments = { @@ -209,18 +216,16 @@ def build_get_upgrade_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -231,9 +236,12 @@ def build_get_available_agent_pool_versions_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-10-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions") # pylint: disable=line-too-long path_format_arguments = { @@ -245,42 +253,38 @@ def build_get_available_agent_pool_versions_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class AgentPoolsOperations(object): - """AgentPoolsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class AgentPoolsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2019_10_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2019_10_01.ContainerServiceClient`'s + :attr:`agent_pools` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -288,7 +292,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Iterable["_models.AgentPoolListResult"]: + ) -> Iterable[_models.AgentPoolListResult]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. The operation returns properties @@ -304,13 +308,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2019_10_01.models.AgentPoolListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -320,9 +327,11 @@ def prepare_request(next_link=None): resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -332,9 +341,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -374,7 +385,7 @@ def get( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPool": + ) -> _models.AgentPool: """Gets the agent pool. Gets the details of the agent pool by managed cluster and resource group. @@ -390,13 +401,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2019_10_01.models.AgentPool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-10-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] request = build_get_request( @@ -406,11 +420,13 @@ def get( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -436,17 +452,20 @@ def _create_or_update_initial( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> "_models.AgentPool": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] + ) -> _models.AgentPool: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2019-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] _json = self._serialize.body(parameters, 'AgentPool') @@ -459,11 +478,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -494,9 +515,9 @@ def begin_create_or_update( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> LROPoller["_models.AgentPool"]: + ) -> LROPoller[_models.AgentPool]: """Creates or updates an agent pool. Creates or updates an agent pool in the specified managed cluster. @@ -522,17 +543,20 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_10_01.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, @@ -540,20 +564,27 @@ def begin_create_or_update( 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): - response = pipeline_response.http_response deserialized = self._deserialize('AgentPool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -573,13 +604,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements agent_pool_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2019-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -589,11 +623,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -640,21 +676,26 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-10-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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) @@ -664,8 +705,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -685,7 +732,7 @@ def get_upgrade_profile( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPoolUpgradeProfile": + ) -> _models.AgentPoolUpgradeProfile: """Gets upgrade profile for an agent pool. Gets the details of the upgrade profile for an agent pool with a specified resource group and @@ -702,13 +749,16 @@ def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2019_10_01.models.AgentPoolUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-10-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] request = build_get_upgrade_profile_request( @@ -718,11 +768,13 @@ def get_upgrade_profile( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -749,7 +801,7 @@ def get_available_agent_pool_versions( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.AgentPoolAvailableVersions": + ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported versions for the specified agent pool. Gets a list of supported versions for the specified agent pool. @@ -763,13 +815,16 @@ def get_available_agent_pool_versions( :rtype: ~azure.mgmt.containerservice.v2019_10_01.models.AgentPoolAvailableVersions :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolAvailableVersions"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-10-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] request = build_get_available_agent_pool_versions_request( @@ -778,11 +833,13 @@ def get_available_agent_pool_versions( resource_name=resource_name, api_version=api_version, template_url=self.get_available_agent_pool_versions.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/operations/_managed_clusters_operations.py index 1639d2838dd6..e8ebce1fe60d 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/operations/_managed_clusters_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -33,9 +33,12 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-10-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters") path_format_arguments = { @@ -45,18 +48,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -66,9 +67,12 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-10-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters") # pylint: disable=line-too-long path_format_arguments = { @@ -79,18 +83,16 @@ def build_list_by_resource_group_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -101,9 +103,12 @@ def build_get_upgrade_profile_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-10-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default") # pylint: disable=line-too-long path_format_arguments = { @@ -115,18 +120,16 @@ def build_get_upgrade_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -138,9 +141,12 @@ def build_get_access_profile_request( role_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-10-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -153,18 +159,16 @@ def build_get_access_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -175,9 +179,12 @@ def build_list_cluster_admin_credentials_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-10-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -189,18 +196,16 @@ def build_list_cluster_admin_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -211,9 +216,12 @@ def build_list_cluster_user_credentials_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-10-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -225,18 +233,16 @@ def build_list_cluster_user_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -247,9 +253,12 @@ def build_list_cluster_monitoring_user_credentials_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-10-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -261,18 +270,16 @@ def build_list_cluster_monitoring_user_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -283,9 +290,12 @@ def build_get_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-10-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -297,18 +307,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -318,14 +326,17 @@ def build_create_or_update_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedCluster] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -337,20 +348,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -362,14 +371,17 @@ def build_update_tags_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.TagsObject] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -381,20 +393,18 @@ def build_update_tags_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -407,9 +417,12 @@ def build_delete_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-10-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -421,18 +434,16 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -442,14 +453,17 @@ def build_reset_service_principal_profile_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedClusterServicePrincipalProfile] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile") # pylint: disable=line-too-long path_format_arguments = { @@ -461,20 +475,18 @@ def build_reset_service_principal_profile_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -486,14 +498,17 @@ def build_reset_aad_profile_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedClusterAADProfile] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile") # pylint: disable=line-too-long path_format_arguments = { @@ -505,20 +520,18 @@ def build_reset_aad_profile_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -531,9 +544,12 @@ def build_rotate_cluster_certificates_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-10-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates") # pylint: disable=line-too-long path_format_arguments = { @@ -545,48 +561,44 @@ def build_rotate_cluster_certificates_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class ManagedClustersOperations(object): - """ManagedClustersOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ManagedClustersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2019_10_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2019_10_01.ContainerServiceClient`'s + :attr:`managed_clusters` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> Iterable["_models.ManagedClusterListResult"]: + ) -> Iterable[_models.ManagedClusterListResult]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. The operation returns properties @@ -599,13 +611,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2019_10_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -613,9 +628,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -623,9 +640,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -663,7 +682,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.ManagedClusterListResult"]: + ) -> Iterable[_models.ManagedClusterListResult]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. The operation returns @@ -678,13 +697,16 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2019_10_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -693,9 +715,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -704,9 +728,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -745,7 +771,7 @@ def get_upgrade_profile( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedClusterUpgradeProfile": + ) -> _models.ManagedClusterUpgradeProfile: """Gets upgrade profile for a managed cluster. Gets the details of the upgrade profile for a managed cluster with a specified resource group @@ -760,13 +786,16 @@ def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2019_10_01.models.ManagedClusterUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2019-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] request = build_get_upgrade_profile_request( @@ -775,11 +804,13 @@ def get_upgrade_profile( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -807,7 +838,7 @@ def get_access_profile( resource_name: str, role_name: str, **kwargs: Any - ) -> "_models.ManagedClusterAccessProfile": + ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. Gets the accessProfile for the specified role name of the managed cluster with a specified @@ -824,13 +855,16 @@ def get_access_profile( :rtype: ~azure.mgmt.containerservice.v2019_10_01.models.ManagedClusterAccessProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterAccessProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-10-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] request = build_get_access_profile_request( @@ -840,11 +874,13 @@ def get_access_profile( role_name=role_name, api_version=api_version, template_url=self.get_access_profile.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -871,7 +907,7 @@ def list_cluster_admin_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster admin credential of a managed cluster. Gets cluster admin credential of the managed cluster with a specified resource group and name. @@ -885,13 +921,16 @@ def list_cluster_admin_credentials( :rtype: ~azure.mgmt.containerservice.v2019_10_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-10-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_admin_credentials_request( @@ -900,11 +939,13 @@ def list_cluster_admin_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_admin_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -931,7 +972,7 @@ def list_cluster_user_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster user credential of a managed cluster. Gets cluster user credential of the managed cluster with a specified resource group and name. @@ -945,13 +986,16 @@ def list_cluster_user_credentials( :rtype: ~azure.mgmt.containerservice.v2019_10_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2019-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_user_credentials_request( @@ -960,11 +1004,13 @@ def list_cluster_user_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -991,7 +1037,7 @@ def list_cluster_monitoring_user_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster monitoring user credential of a managed cluster. Gets cluster monitoring user credential of the managed cluster with a specified resource group @@ -1006,13 +1052,16 @@ def list_cluster_monitoring_user_credentials( :rtype: ~azure.mgmt.containerservice.v2019_10_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-10-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_monitoring_user_credentials_request( @@ -1021,11 +1070,13 @@ def list_cluster_monitoring_user_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1052,7 +1103,7 @@ def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedCluster": + ) -> _models.ManagedCluster: """Gets a managed cluster. Gets the details of the managed cluster with a specified resource group and name. @@ -1066,13 +1117,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2019_10_01.models.ManagedCluster :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2019-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] request = build_get_request( @@ -1081,11 +1135,13 @@ def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1110,17 +1166,20 @@ def _create_or_update_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2019-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'ManagedCluster') @@ -1132,11 +1191,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1166,9 +1227,9 @@ def begin_create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> LROPoller["_models.ManagedCluster"]: + ) -> LROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. Creates or updates a managed cluster with the specified configuration for agents and Kubernetes @@ -1194,37 +1255,47 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_10_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1241,17 +1312,20 @@ def _update_tags_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2019-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'TagsObject') @@ -1263,11 +1337,13 @@ def _update_tags_initial( content_type=content_type, json=_json, template_url=self._update_tags_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1293,9 +1369,9 @@ def begin_update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> LROPoller["_models.ManagedCluster"]: + ) -> LROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates a managed cluster with the specified tags. @@ -1320,37 +1396,47 @@ def begin_update_tags( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_10_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._update_tags_initial( + raw_result = self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1369,13 +1455,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-10-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -1384,11 +1473,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1432,20 +1523,25 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-10-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_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) @@ -1455,8 +1551,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1473,17 +1575,20 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2019-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') @@ -1495,11 +1600,13 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re content_type=content_type, json=_json, template_url=self._reset_service_principal_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1521,7 +1628,7 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> LROPoller[None]: """Reset Service Principal Profile of a managed cluster. @@ -1548,23 +1655,28 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._reset_service_principal_profile_initial( + raw_result = self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1574,8 +1686,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1592,17 +1710,20 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2019-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') @@ -1614,11 +1735,13 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement content_type=content_type, json=_json, template_url=self._reset_aad_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1640,7 +1763,7 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> LROPoller[None]: """Reset AAD Profile of a managed cluster. @@ -1666,23 +1789,28 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._reset_aad_profile_initial( + raw_result = self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1692,8 +1820,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1712,13 +1846,16 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-10-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_rotate_cluster_certificates_request_initial( @@ -1727,11 +1864,13 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return resource_name=resource_name, api_version=api_version, template_url=self._rotate_cluster_certificates_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1775,20 +1914,25 @@ def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-st :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-10-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._rotate_cluster_certificates_initial( + raw_result = self._rotate_cluster_certificates_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) @@ -1798,8 +1942,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/operations/_operations.py index cfd661f2e3db..060ec6897058 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/operations/_operations.py @@ -16,6 +16,7 @@ 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 @@ -29,55 +30,54 @@ def build_list_request( **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-10-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.ContainerService/operations") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class Operations(object): - """Operations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2019_10_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2019_10_01.ContainerServiceClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> Iterable["_models.OperationListResult"]: + ) -> Iterable[_models.OperationListResult]: """Gets a list of compute operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -86,31 +86,38 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2019_10_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_01/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/__init__.py index 53c675bd95e2..37a5f9e02e6f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._container_service_client import ContainerServiceClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['ContainerServiceClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/_container_service_client.py index 98f5864d6602..d7398868c55b 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/_container_service_client.py @@ -56,7 +56,9 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.open_shift_managed_clusters = OpenShiftManagedClustersOperations(self._client, self._config, self._serialize, self._deserialize) + self.open_shift_managed_clusters = OpenShiftManagedClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/aio/__init__.py index 53c675bd95e2..37a5f9e02e6f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/aio/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/aio/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._container_service_client import ContainerServiceClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['ContainerServiceClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/aio/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/aio/_container_service_client.py index cf8a06d43bfd..f3d3fc73f3a7 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/aio/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/aio/_container_service_client.py @@ -56,7 +56,9 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.open_shift_managed_clusters = OpenShiftManagedClustersOperations(self._client, self._config, self._serialize, self._deserialize) + self.open_shift_managed_clusters = OpenShiftManagedClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/aio/operations/__init__.py index 45d890441cd5..211a87879804 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/aio/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/aio/operations/__init__.py @@ -8,6 +8,11 @@ from ._open_shift_managed_clusters_operations import OpenShiftManagedClustersOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'OpenShiftManagedClustersOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/aio/operations/_open_shift_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/aio/operations/_open_shift_managed_clusters_operations.py index 75b0a570a89b..693e6eb1504f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/aio/operations/_open_shift_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/aio/operations/_open_shift_managed_clusters_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. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ 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 @@ -26,32 +27,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class OpenShiftManagedClustersOperations: - """OpenShiftManagedClustersOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2019_10_27_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2019_10_27_preview.aio.ContainerServiceClient`'s + :attr:`open_shift_managed_clusters` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.OpenShiftManagedClusterListResult"]: + ) -> AsyncIterable[_models.OpenShiftManagedClusterListResult]: """Gets a list of OpenShift managed clusters in the specified subscription. Gets a list of OpenShift managed clusters in the specified subscription. The operation returns @@ -64,13 +63,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2019_10_27_preview.models.OpenShiftManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-10-27-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-27-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OpenShiftManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -78,9 +80,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -88,9 +92,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -128,7 +134,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.OpenShiftManagedClusterListResult"]: + ) -> AsyncIterable[_models.OpenShiftManagedClusterListResult]: """Lists OpenShift managed clusters in the specified subscription and resource group. Lists OpenShift managed clusters in the specified subscription and resource group. The @@ -143,13 +149,16 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2019_10_27_preview.models.OpenShiftManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-10-27-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-27-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OpenShiftManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -158,9 +167,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -169,9 +180,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -210,7 +223,7 @@ async def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.OpenShiftManagedCluster": + ) -> _models.OpenShiftManagedCluster: """Gets a OpenShift managed cluster. Gets the details of the managed OpenShift cluster with a specified resource group and name. @@ -224,13 +237,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2019_10_27_preview.models.OpenShiftManagedCluster :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OpenShiftManagedCluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-10-27-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-27-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedCluster] request = build_get_request( @@ -239,11 +255,13 @@ async def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -268,17 +286,20 @@ async def _create_or_update_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.OpenShiftManagedCluster", + parameters: _models.OpenShiftManagedCluster, **kwargs: Any - ) -> "_models.OpenShiftManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.OpenShiftManagedCluster"] + ) -> _models.OpenShiftManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2019-10-27-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-27-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedCluster] _json = self._serialize.body(parameters, 'OpenShiftManagedCluster') @@ -290,11 +311,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -324,9 +347,9 @@ async def begin_create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.OpenShiftManagedCluster", + parameters: _models.OpenShiftManagedCluster, **kwargs: Any - ) -> AsyncLROPoller["_models.OpenShiftManagedCluster"]: + ) -> AsyncLROPoller[_models.OpenShiftManagedCluster]: """Creates or updates an OpenShift managed cluster. Creates or updates a OpenShift managed cluster with the specified configuration for agents and @@ -354,37 +377,47 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_10_27_preview.models.OpenShiftManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-10-27-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-27-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OpenShiftManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('OpenShiftManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -401,17 +434,20 @@ async def _update_tags_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.OpenShiftManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.OpenShiftManagedCluster"] + ) -> _models.OpenShiftManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2019-10-27-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-27-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedCluster] _json = self._serialize.body(parameters, 'TagsObject') @@ -423,11 +459,13 @@ async def _update_tags_initial( content_type=content_type, json=_json, template_url=self._update_tags_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -453,9 +491,9 @@ async def begin_update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> AsyncLROPoller["_models.OpenShiftManagedCluster"]: + ) -> AsyncLROPoller[_models.OpenShiftManagedCluster]: """Updates tags on an OpenShift managed cluster. Updates an OpenShift managed cluster with the specified tags. @@ -480,37 +518,47 @@ async def begin_update_tags( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_10_27_preview.models.OpenShiftManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-10-27-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-27-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OpenShiftManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._update_tags_initial( + raw_result = await self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('OpenShiftManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -529,13 +577,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-10-27-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-27-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -544,11 +595,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -592,20 +645,25 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-10-27-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-27-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_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) @@ -615,8 +673,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/aio/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/aio/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/models/__init__.py index 4d929cdcbe0b..7442a585cecd 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/models/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/models/__init__.py @@ -29,7 +29,9 @@ OpenShiftAgentPoolProfileRole, OpenShiftContainerServiceVMSize, ) - +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'CloudErrorBody', 'NetworkProfile', @@ -51,3 +53,5 @@ 'OpenShiftAgentPoolProfileRole', 'OpenShiftContainerServiceVMSize', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/models/_container_service_client_enums.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/models/_container_service_client_enums.py index 9cff02877c35..6c64f62d0661 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/models/_container_service_client_enums.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/models/_container_service_client_enums.py @@ -7,18 +7,17 @@ # -------------------------------------------------------------------------- from enum import Enum -from six import with_metaclass from azure.core import CaseInsensitiveEnumMeta -class OpenShiftAgentPoolProfileRole(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OpenShiftAgentPoolProfileRole(str, Enum, metaclass=CaseInsensitiveEnumMeta): """OpenShiftAgentPoolProfileRole represents the role of the AgentPoolProfile. """ COMPUTE = "compute" INFRA = "infra" -class OpenShiftContainerServiceVMSize(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OpenShiftContainerServiceVMSize(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Size of OpenShift VMs. """ @@ -56,7 +55,7 @@ class OpenShiftContainerServiceVMSize(with_metaclass(CaseInsensitiveEnumMeta, st STANDARD_L16_S = "Standard_L16s" STANDARD_L32_S = "Standard_L32s" -class OSType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux. """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/models/_models_py3.py index ba8cce439696..a758b135ff69 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/models/_models_py3.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/models/_models_py3.py @@ -6,11 +6,13 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Dict, List, Optional, Union +from typing import Dict, List, Optional, TYPE_CHECKING, Union import msrest.serialization -from ._container_service_client_enums import * +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + import __init__ as _models class CloudErrorBody(msrest.serialization.Model): @@ -42,7 +44,7 @@ def __init__( code: Optional[str] = None, message: Optional[str] = None, target: Optional[str] = None, - details: Optional[List["CloudErrorBody"]] = None, + details: Optional[List["_models.CloudErrorBody"]] = None, **kwargs ): """ @@ -276,14 +278,14 @@ def __init__( *, location: str, tags: Optional[Dict[str, str]] = None, - plan: Optional["PurchasePlan"] = None, + plan: Optional["_models.PurchasePlan"] = None, open_shift_version: Optional[str] = None, - network_profile: Optional["NetworkProfile"] = None, - router_profiles: Optional[List["OpenShiftRouterProfile"]] = None, - master_pool_profile: Optional["OpenShiftManagedClusterMasterPoolProfile"] = None, - agent_pool_profiles: Optional[List["OpenShiftManagedClusterAgentPoolProfile"]] = None, - auth_profile: Optional["OpenShiftManagedClusterAuthProfile"] = None, - monitor_profile: Optional["OpenShiftManagedClusterMonitorProfile"] = None, + network_profile: Optional["_models.NetworkProfile"] = None, + router_profiles: Optional[List["_models.OpenShiftRouterProfile"]] = None, + master_pool_profile: Optional["_models.OpenShiftManagedClusterMasterPoolProfile"] = None, + agent_pool_profiles: Optional[List["_models.OpenShiftManagedClusterAgentPoolProfile"]] = None, + auth_profile: Optional["_models.OpenShiftManagedClusterAuthProfile"] = None, + monitor_profile: Optional["_models.OpenShiftManagedClusterMonitorProfile"] = None, refresh_cluster: Optional[bool] = None, **kwargs ): @@ -433,7 +435,7 @@ class OpenShiftManagedClusterAgentPoolProfile(msrest.serialization.Model): :vartype name: str :ivar count: Required. Number of agents (VMs) to host docker containers. :vartype count: int - :ivar vm_size: Required. Size of agent VMs. Possible values include: "Standard_D2s_v3", + :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_D2s_v3", "Standard_D4s_v3", "Standard_D8s_v3", "Standard_D16s_v3", "Standard_D32s_v3", "Standard_D64s_v3", "Standard_DS4_v2", "Standard_DS5_v2", "Standard_F8s_v2", "Standard_F16s_v2", "Standard_F32s_v2", "Standard_F64s_v2", "Standard_F72s_v2", "Standard_F8s", @@ -446,10 +448,9 @@ class OpenShiftManagedClusterAgentPoolProfile(msrest.serialization.Model): :ivar subnet_cidr: Subnet CIDR for the peering. :vartype subnet_cidr: str :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2019_10_27_preview.models.OSType - :ivar role: Define the role of the AgentPoolProfile. Possible values include: "compute", - "infra". + :ivar role: Define the role of the AgentPoolProfile. Known values are: "compute", "infra". :vartype role: str or ~azure.mgmt.containerservice.v2019_10_27_preview.models.OpenShiftAgentPoolProfileRole """ @@ -474,10 +475,10 @@ def __init__( *, name: str, count: int, - vm_size: Union[str, "OpenShiftContainerServiceVMSize"], + vm_size: Union[str, "_models.OpenShiftContainerServiceVMSize"], subnet_cidr: Optional[str] = "10.0.0.0/24", - os_type: Optional[Union[str, "OSType"]] = "Linux", - role: Optional[Union[str, "OpenShiftAgentPoolProfileRole"]] = None, + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + role: Optional[Union[str, "_models.OpenShiftAgentPoolProfileRole"]] = None, **kwargs ): """ @@ -486,7 +487,7 @@ def __init__( :paramtype name: str :keyword count: Required. Number of agents (VMs) to host docker containers. :paramtype count: int - :keyword vm_size: Required. Size of agent VMs. Possible values include: "Standard_D2s_v3", + :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_D2s_v3", "Standard_D4s_v3", "Standard_D8s_v3", "Standard_D16s_v3", "Standard_D32s_v3", "Standard_D64s_v3", "Standard_DS4_v2", "Standard_DS5_v2", "Standard_F8s_v2", "Standard_F16s_v2", "Standard_F32s_v2", "Standard_F64s_v2", "Standard_F72s_v2", "Standard_F8s", @@ -499,10 +500,9 @@ def __init__( :keyword subnet_cidr: Subnet CIDR for the peering. :paramtype subnet_cidr: str :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2019_10_27_preview.models.OSType - :keyword role: Define the role of the AgentPoolProfile. Possible values include: "compute", - "infra". + :keyword role: Define the role of the AgentPoolProfile. Known values are: "compute", "infra". :paramtype role: str or ~azure.mgmt.containerservice.v2019_10_27_preview.models.OpenShiftAgentPoolProfileRole """ @@ -530,7 +530,7 @@ class OpenShiftManagedClusterAuthProfile(msrest.serialization.Model): def __init__( self, *, - identity_providers: Optional[List["OpenShiftManagedClusterIdentityProvider"]] = None, + identity_providers: Optional[List["_models.OpenShiftManagedClusterIdentityProvider"]] = None, **kwargs ): """ @@ -561,7 +561,7 @@ def __init__( self, *, name: Optional[str] = None, - provider: Optional["OpenShiftManagedClusterBaseIdentityProvider"] = None, + provider: Optional["_models.OpenShiftManagedClusterBaseIdentityProvider"] = None, **kwargs ): """ @@ -600,7 +600,7 @@ class OpenShiftManagedClusterListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["OpenShiftManagedCluster"]] = None, + value: Optional[List["_models.OpenShiftManagedCluster"]] = None, **kwargs ): """ @@ -621,7 +621,7 @@ class OpenShiftManagedClusterMasterPoolProfile(msrest.serialization.Model): :ivar count: Required. Number of masters (VMs) to host docker containers. The default value is 3. :vartype count: int - :ivar vm_size: Required. Size of agent VMs. Possible values include: "Standard_D2s_v3", + :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_D2s_v3", "Standard_D4s_v3", "Standard_D8s_v3", "Standard_D16s_v3", "Standard_D32s_v3", "Standard_D64s_v3", "Standard_DS4_v2", "Standard_DS5_v2", "Standard_F8s_v2", "Standard_F16s_v2", "Standard_F32s_v2", "Standard_F64s_v2", "Standard_F72s_v2", "Standard_F8s", @@ -654,16 +654,16 @@ def __init__( self, *, count: int, - vm_size: Union[str, "OpenShiftContainerServiceVMSize"], + vm_size: Union[str, "_models.OpenShiftContainerServiceVMSize"], subnet_cidr: Optional[str] = None, - api_properties: Optional["OpenShiftAPIProperties"] = None, + api_properties: Optional["_models.OpenShiftAPIProperties"] = None, **kwargs ): """ :keyword count: Required. Number of masters (VMs) to host docker containers. The default value is 3. :paramtype count: int - :keyword vm_size: Required. Size of agent VMs. Possible values include: "Standard_D2s_v3", + :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_D2s_v3", "Standard_D4s_v3", "Standard_D8s_v3", "Standard_D16s_v3", "Standard_D32s_v3", "Standard_D64s_v3", "Standard_DS4_v2", "Standard_DS5_v2", "Standard_F8s_v2", "Standard_F16s_v2", "Standard_F32s_v2", "Standard_F64s_v2", "Standard_F72s_v2", "Standard_F8s", diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/models/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/models/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/operations/__init__.py index 45d890441cd5..211a87879804 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/operations/__init__.py @@ -8,6 +8,11 @@ from ._open_shift_managed_clusters_operations import OpenShiftManagedClustersOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'OpenShiftManagedClustersOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/operations/_open_shift_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/operations/_open_shift_managed_clusters_operations.py index 453bfc1a5079..223e9da532af 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/operations/_open_shift_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/operations/_open_shift_managed_clusters_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -33,9 +33,12 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-10-27-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-27-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/openShiftManagedClusters") # pylint: disable=line-too-long path_format_arguments = { @@ -45,18 +48,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -66,9 +67,12 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-10-27-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-27-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters") # pylint: disable=line-too-long path_format_arguments = { @@ -79,18 +83,16 @@ def build_list_by_resource_group_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -101,9 +103,12 @@ def build_get_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-10-27-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-27-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -115,18 +120,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -136,14 +139,17 @@ def build_create_or_update_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.OpenShiftManagedCluster] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-10-27-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-27-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -155,20 +161,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -180,14 +184,17 @@ def build_update_tags_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.TagsObject] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-10-27-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-27-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -199,20 +206,18 @@ def build_update_tags_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -225,9 +230,12 @@ def build_delete_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-10-27-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-27-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -239,48 +247,44 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class OpenShiftManagedClustersOperations(object): - """OpenShiftManagedClustersOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class OpenShiftManagedClustersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2019_10_27_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2019_10_27_preview.ContainerServiceClient`'s + :attr:`open_shift_managed_clusters` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> Iterable["_models.OpenShiftManagedClusterListResult"]: + ) -> Iterable[_models.OpenShiftManagedClusterListResult]: """Gets a list of OpenShift managed clusters in the specified subscription. Gets a list of OpenShift managed clusters in the specified subscription. The operation returns @@ -293,13 +297,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2019_10_27_preview.models.OpenShiftManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-10-27-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-27-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OpenShiftManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -307,9 +314,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -317,9 +326,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -357,7 +368,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.OpenShiftManagedClusterListResult"]: + ) -> Iterable[_models.OpenShiftManagedClusterListResult]: """Lists OpenShift managed clusters in the specified subscription and resource group. Lists OpenShift managed clusters in the specified subscription and resource group. The @@ -372,13 +383,16 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2019_10_27_preview.models.OpenShiftManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-10-27-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-27-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OpenShiftManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -387,9 +401,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -398,9 +414,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -439,7 +457,7 @@ def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.OpenShiftManagedCluster": + ) -> _models.OpenShiftManagedCluster: """Gets a OpenShift managed cluster. Gets the details of the managed OpenShift cluster with a specified resource group and name. @@ -453,13 +471,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2019_10_27_preview.models.OpenShiftManagedCluster :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OpenShiftManagedCluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2019-10-27-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-27-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedCluster] request = build_get_request( @@ -468,11 +489,13 @@ def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -497,17 +520,20 @@ def _create_or_update_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.OpenShiftManagedCluster", + parameters: _models.OpenShiftManagedCluster, **kwargs: Any - ) -> "_models.OpenShiftManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.OpenShiftManagedCluster"] + ) -> _models.OpenShiftManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2019-10-27-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-27-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedCluster] _json = self._serialize.body(parameters, 'OpenShiftManagedCluster') @@ -519,11 +545,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -553,9 +581,9 @@ def begin_create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.OpenShiftManagedCluster", + parameters: _models.OpenShiftManagedCluster, **kwargs: Any - ) -> LROPoller["_models.OpenShiftManagedCluster"]: + ) -> LROPoller[_models.OpenShiftManagedCluster]: """Creates or updates an OpenShift managed cluster. Creates or updates a OpenShift managed cluster with the specified configuration for agents and @@ -583,37 +611,47 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_10_27_preview.models.OpenShiftManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-10-27-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-27-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OpenShiftManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('OpenShiftManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -630,17 +668,20 @@ def _update_tags_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.OpenShiftManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.OpenShiftManagedCluster"] + ) -> _models.OpenShiftManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2019-10-27-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-27-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedCluster] _json = self._serialize.body(parameters, 'TagsObject') @@ -652,11 +693,13 @@ def _update_tags_initial( content_type=content_type, json=_json, template_url=self._update_tags_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -682,9 +725,9 @@ def begin_update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> LROPoller["_models.OpenShiftManagedCluster"]: + ) -> LROPoller[_models.OpenShiftManagedCluster]: """Updates tags on an OpenShift managed cluster. Updates an OpenShift managed cluster with the specified tags. @@ -709,37 +752,47 @@ def begin_update_tags( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_10_27_preview.models.OpenShiftManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-10-27-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-27-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.OpenShiftManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OpenShiftManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._update_tags_initial( + raw_result = self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('OpenShiftManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -758,13 +811,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2019-10-27-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-27-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -773,11 +829,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -821,20 +879,25 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-10-27-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-10-27-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_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) @@ -844,8 +907,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_10_27_preview/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/__init__.py index 53c675bd95e2..37a5f9e02e6f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._container_service_client import ContainerServiceClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['ContainerServiceClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/_container_service_client.py index 8e0bb0e0cb52..1a5b10f975b6 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/_container_service_client.py @@ -60,9 +60,15 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.managed_clusters = ManagedClustersOperations(self._client, self._config, self._serialize, self._deserialize) - self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_clusters = ManagedClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.agent_pools = AgentPoolsOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/aio/__init__.py index 53c675bd95e2..37a5f9e02e6f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/aio/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/aio/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._container_service_client import ContainerServiceClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['ContainerServiceClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/aio/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/aio/_container_service_client.py index d478b69e5a95..cb39a642d812 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/aio/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/aio/_container_service_client.py @@ -61,9 +61,15 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.managed_clusters = ManagedClustersOperations(self._client, self._config, self._serialize, self._deserialize) - self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_clusters = ManagedClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.agent_pools = AgentPoolsOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/aio/operations/__init__.py index 5aac40228eec..403c0174f052 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/aio/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/aio/operations/__init__.py @@ -10,8 +10,13 @@ from ._managed_clusters_operations import ManagedClustersOperations from ._agent_pools_operations import AgentPoolsOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'Operations', 'ManagedClustersOperations', 'AgentPoolsOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/aio/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/aio/operations/_agent_pools_operations.py index c26cb081077e..6954d5aa25cd 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/aio/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/aio/operations/_agent_pools_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. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ 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 @@ -26,26 +27,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class AgentPoolsOperations: - """AgentPoolsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2019_11_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2019_11_01.aio.ContainerServiceClient`'s + :attr:`agent_pools` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -53,7 +52,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> AsyncIterable["_models.AgentPoolListResult"]: + ) -> AsyncIterable[_models.AgentPoolListResult]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. The operation returns properties @@ -69,13 +68,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2019_11_01.models.AgentPoolListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-11-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -85,9 +87,11 @@ def prepare_request(next_link=None): resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -97,9 +101,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -139,7 +145,7 @@ async def get( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPool": + ) -> _models.AgentPool: """Gets the agent pool. Gets the details of the agent pool by managed cluster and resource group. @@ -155,13 +161,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2019_11_01.models.AgentPool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-11-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] request = build_get_request( @@ -171,11 +180,13 @@ async def get( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -201,17 +212,20 @@ async def _create_or_update_initial( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> "_models.AgentPool": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] + ) -> _models.AgentPool: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2019-11-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] _json = self._serialize.body(parameters, 'AgentPool') @@ -224,11 +238,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -259,9 +275,9 @@ async def begin_create_or_update( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> AsyncLROPoller["_models.AgentPool"]: + ) -> AsyncLROPoller[_models.AgentPool]: """Creates or updates an agent pool. Creates or updates an agent pool in the specified managed cluster. @@ -288,17 +304,20 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_11_01.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-11-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, @@ -306,20 +325,27 @@ async def begin_create_or_update( 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): - response = pipeline_response.http_response deserialized = self._deserialize('AgentPool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -339,13 +365,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements agent_pool_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-11-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -355,11 +384,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -406,21 +437,26 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-11-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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) @@ -430,8 +466,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -451,7 +493,7 @@ async def get_upgrade_profile( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPoolUpgradeProfile": + ) -> _models.AgentPoolUpgradeProfile: """Gets upgrade profile for an agent pool. Gets the details of the upgrade profile for an agent pool with a specified resource group and @@ -468,13 +510,16 @@ async def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2019_11_01.models.AgentPoolUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2019-11-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] request = build_get_upgrade_profile_request( @@ -484,11 +529,13 @@ async def get_upgrade_profile( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -515,7 +562,7 @@ async def get_available_agent_pool_versions( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.AgentPoolAvailableVersions": + ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported versions for the specified agent pool. Gets a list of supported versions for the specified agent pool. @@ -529,13 +576,16 @@ async def get_available_agent_pool_versions( :rtype: ~azure.mgmt.containerservice.v2019_11_01.models.AgentPoolAvailableVersions :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolAvailableVersions"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-11-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] request = build_get_available_agent_pool_versions_request( @@ -544,11 +594,13 @@ async def get_available_agent_pool_versions( resource_name=resource_name, api_version=api_version, template_url=self.get_available_agent_pool_versions.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/aio/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/aio/operations/_managed_clusters_operations.py index 6e1af65c21e4..d61f8af21ee4 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/aio/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/aio/operations/_managed_clusters_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. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ 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 @@ -26,32 +27,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ManagedClustersOperations: - """ManagedClustersOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2019_11_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2019_11_01.aio.ContainerServiceClient`'s + :attr:`managed_clusters` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.ManagedClusterListResult"]: + ) -> AsyncIterable[_models.ManagedClusterListResult]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. The operation returns properties @@ -64,13 +63,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2019_11_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-11-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -78,9 +80,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -88,9 +92,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -128,7 +134,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ManagedClusterListResult"]: + ) -> AsyncIterable[_models.ManagedClusterListResult]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. The operation returns @@ -143,13 +149,16 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2019_11_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-11-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -158,9 +167,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -169,9 +180,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -210,7 +223,7 @@ async def get_upgrade_profile( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedClusterUpgradeProfile": + ) -> _models.ManagedClusterUpgradeProfile: """Gets upgrade profile for a managed cluster. Gets the details of the upgrade profile for a managed cluster with a specified resource group @@ -225,13 +238,16 @@ async def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2019_11_01.models.ManagedClusterUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-11-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] request = build_get_upgrade_profile_request( @@ -240,11 +256,13 @@ async def get_upgrade_profile( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -272,7 +290,7 @@ async def get_access_profile( resource_name: str, role_name: str, **kwargs: Any - ) -> "_models.ManagedClusterAccessProfile": + ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. Gets the accessProfile for the specified role name of the managed cluster with a specified @@ -289,13 +307,16 @@ async def get_access_profile( :rtype: ~azure.mgmt.containerservice.v2019_11_01.models.ManagedClusterAccessProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterAccessProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2019-11-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] request = build_get_access_profile_request( @@ -305,11 +326,13 @@ async def get_access_profile( role_name=role_name, api_version=api_version, template_url=self.get_access_profile.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -336,7 +359,7 @@ async def list_cluster_admin_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster admin credential of a managed cluster. Gets cluster admin credential of the managed cluster with a specified resource group and name. @@ -350,13 +373,16 @@ async def list_cluster_admin_credentials( :rtype: ~azure.mgmt.containerservice.v2019_11_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-11-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_admin_credentials_request( @@ -365,11 +391,13 @@ async def list_cluster_admin_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_admin_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -396,7 +424,7 @@ async def list_cluster_user_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster user credential of a managed cluster. Gets cluster user credential of the managed cluster with a specified resource group and name. @@ -410,13 +438,16 @@ async def list_cluster_user_credentials( :rtype: ~azure.mgmt.containerservice.v2019_11_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2019-11-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_user_credentials_request( @@ -425,11 +456,13 @@ async def list_cluster_user_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -456,7 +489,7 @@ async def list_cluster_monitoring_user_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster monitoring user credential of a managed cluster. Gets cluster monitoring user credential of the managed cluster with a specified resource group @@ -471,13 +504,16 @@ async def list_cluster_monitoring_user_credentials( :rtype: ~azure.mgmt.containerservice.v2019_11_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-11-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_monitoring_user_credentials_request( @@ -486,11 +522,13 @@ async def list_cluster_monitoring_user_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -517,7 +555,7 @@ async def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedCluster": + ) -> _models.ManagedCluster: """Gets a managed cluster. Gets the details of the managed cluster with a specified resource group and name. @@ -531,13 +569,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2019_11_01.models.ManagedCluster :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2019-11-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] request = build_get_request( @@ -546,11 +587,13 @@ async def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -575,17 +618,20 @@ async def _create_or_update_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2019-11-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'ManagedCluster') @@ -597,11 +643,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -631,9 +679,9 @@ async def begin_create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> AsyncLROPoller["_models.ManagedCluster"]: + ) -> AsyncLROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. Creates or updates a managed cluster with the specified configuration for agents and Kubernetes @@ -659,37 +707,47 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_11_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-11-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -706,17 +764,20 @@ async def _update_tags_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2019-11-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'TagsObject') @@ -728,11 +789,13 @@ async def _update_tags_initial( content_type=content_type, json=_json, template_url=self._update_tags_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -758,9 +821,9 @@ async def begin_update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> AsyncLROPoller["_models.ManagedCluster"]: + ) -> AsyncLROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates a managed cluster with the specified tags. @@ -785,37 +848,47 @@ async def begin_update_tags( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2019_11_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-11-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._update_tags_initial( + raw_result = await self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -834,13 +907,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-11-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -849,11 +925,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -897,20 +975,25 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-11-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_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) @@ -920,8 +1003,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -938,17 +1027,20 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2019-11-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') @@ -960,11 +1052,13 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist content_type=content_type, json=_json, template_url=self._reset_service_principal_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -986,7 +1080,7 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> AsyncLROPoller[None]: """Reset Service Principal Profile of a managed cluster. @@ -1013,23 +1107,28 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-11-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._reset_service_principal_profile_initial( + raw_result = await self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1039,8 +1138,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1057,17 +1162,20 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2019-11-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') @@ -1079,11 +1187,13 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta content_type=content_type, json=_json, template_url=self._reset_aad_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1105,7 +1215,7 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> AsyncLROPoller[None]: """Reset AAD Profile of a managed cluster. @@ -1131,23 +1241,28 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-11-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._reset_aad_profile_initial( + raw_result = await self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1157,8 +1272,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1177,13 +1298,16 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-11-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_rotate_cluster_certificates_request_initial( @@ -1192,11 +1316,13 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- resource_name=resource_name, api_version=api_version, template_url=self._rotate_cluster_certificates_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1240,20 +1366,25 @@ async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-ret :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-11-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._rotate_cluster_certificates_initial( + raw_result = await self._rotate_cluster_certificates_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) @@ -1263,8 +1394,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/aio/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/aio/operations/_operations.py index 3259fbbc7e45..f5c8288f0ab4 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/aio/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/aio/operations/_operations.py @@ -14,6 +14,7 @@ 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 @@ -23,32 +24,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class Operations: - """Operations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2019_11_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2019_11_01.aio.ContainerServiceClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.OperationListResult"]: + ) -> AsyncIterable[_models.OperationListResult]: """Gets a list of compute operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -57,31 +56,38 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2019_11_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-11-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/aio/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/aio/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/models/__init__.py index 91d2c61fb783..1a970d9d5e41 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/models/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/models/__init__.py @@ -65,7 +65,9 @@ ScaleSetEvictionPolicy, ScaleSetPriority, ) - +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'AgentPool', 'AgentPoolAvailableVersions', @@ -123,3 +125,5 @@ 'ScaleSetEvictionPolicy', 'ScaleSetPriority', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/models/_container_service_client_enums.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/models/_container_service_client_enums.py index 9e8d4ef7ae7b..137bd739161e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/models/_container_service_client_enums.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/models/_container_service_client_enums.py @@ -7,18 +7,17 @@ # -------------------------------------------------------------------------- from enum import Enum -from six import with_metaclass from azure.core import CaseInsensitiveEnumMeta -class AgentPoolType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class AgentPoolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """AgentPoolType represents types of an agent pool. """ VIRTUAL_MACHINE_SCALE_SETS = "VirtualMachineScaleSets" AVAILABILITY_SET = "AvailabilitySet" -class ContainerServiceStorageProfileTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the orchestrator choice. """ @@ -26,7 +25,7 @@ class ContainerServiceStorageProfileTypes(with_metaclass(CaseInsensitiveEnumMeta STORAGE_ACCOUNT = "StorageAccount" MANAGED_DISKS = "ManagedDisks" -class ContainerServiceVMSizeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Size of agent VMs. """ @@ -205,7 +204,7 @@ class ContainerServiceVMSizeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, E STANDARD_NV24 = "Standard_NV24" STANDARD_NV6 = "Standard_NV6" -class Count(with_metaclass(CaseInsensitiveEnumMeta, int, Enum)): +class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): """Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, and 5. The default value is 1. """ @@ -214,42 +213,42 @@ class Count(with_metaclass(CaseInsensitiveEnumMeta, int, Enum)): THREE = 3 FIVE = 5 -class LoadBalancerSku(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class LoadBalancerSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The load balancer sku for the managed cluster. """ STANDARD = "standard" BASIC = "basic" -class NetworkPlugin(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkPlugin(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Network plugin used for building Kubernetes network. """ AZURE = "azure" KUBENET = "kubenet" -class NetworkPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Network policy used for building Kubernetes network. """ CALICO = "calico" AZURE = "azure" -class OSType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux. """ LINUX = "Linux" WINDOWS = "Windows" -class OutboundType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OutboundType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The outbound (egress) routing method. """ LOAD_BALANCER = "loadBalancer" USER_DEFINED_ROUTING = "userDefinedRouting" -class ResourceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ resource group in agent nodes. Type 'None' will not use MSI for the managed cluster, service @@ -259,7 +258,7 @@ class ResourceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): SYSTEM_ASSIGNED = "SystemAssigned" NONE = "None" -class ScaleSetEvictionPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ScaleSetEvictionPolicy to be used to specify eviction policy for low priority virtual machine scale set. Default to Delete. """ @@ -267,7 +266,7 @@ class ScaleSetEvictionPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)) DELETE = "Delete" DEALLOCATE = "Deallocate" -class ScaleSetPriority(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ScaleSetPriority(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ScaleSetPriority to be used to specify virtual machine scale set priority. Default to regular. """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/models/_models_py3.py index d8b0682bf358..21aa796d6e7a 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/models/_models_py3.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/models/_models_py3.py @@ -6,11 +6,13 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Dict, List, Optional, Union +from typing import Dict, List, Optional, TYPE_CHECKING, Union import msrest.serialization -from ._container_service_client_enums import * +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + import __init__ as _models class SubResource(msrest.serialization.Model): @@ -66,7 +68,7 @@ class AgentPool(SubResource): :ivar count: Number of agents (VMs) 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: Size of agent VMs. Possible values include: "Standard_A1", "Standard_A10", + :ivar vm_size: Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -115,7 +117,7 @@ class AgentPool(SubResource): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2019_11_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -123,8 +125,8 @@ class AgentPool(SubResource): :vartype min_count: int :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool - :ivar type_properties_type: AgentPoolType represents types of an agent pool. Possible values - include: "VirtualMachineScaleSets", "AvailabilitySet". + :ivar type_properties_type: AgentPoolType represents types of an agent pool. Known values are: + "VirtualMachineScaleSets", "AvailabilitySet". :vartype type_properties_type: str or ~azure.mgmt.containerservice.v2019_11_01.models.AgentPoolType :ivar orchestrator_version: Version of orchestrator specified when creating the managed @@ -139,13 +141,12 @@ class AgentPool(SubResource): :ivar enable_node_public_ip: Enable public IP for nodes. :vartype enable_node_public_ip: bool :ivar scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Possible values include: "Low", "Regular". Default value: - "Regular". + priority. Default to regular. Known values are: "Low", "Regular". Default value: "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2019_11_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy - for low priority virtual machine scale set. Default to Delete. Possible values include: - "Delete", "Deallocate". Default value: "Delete". + for low priority virtual machine scale set. Default to Delete. Known values are: "Delete", + "Deallocate". Default value: "Delete". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2019_11_01.models.ScaleSetEvictionPolicy :ivar tags: A set of tags. Agent pool tags to be persisted on the agent pool virtual machine @@ -195,20 +196,20 @@ def __init__( self, *, count: Optional[int] = None, - vm_size: Optional[Union[str, "ContainerServiceVMSizeTypes"]] = None, + vm_size: Optional[Union[str, "_models.ContainerServiceVMSizeTypes"]] = None, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - type_properties_type: Optional[Union[str, "AgentPoolType"]] = None, + type_properties_type: Optional[Union[str, "_models.AgentPoolType"]] = None, orchestrator_version: Optional[str] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, - scale_set_priority: Optional[Union[str, "ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -218,7 +219,7 @@ def __init__( :keyword count: Number of agents (VMs) 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: Size of agent VMs. Possible values include: "Standard_A1", "Standard_A10", + :keyword vm_size: Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -267,7 +268,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2019_11_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -275,8 +276,8 @@ def __init__( :paramtype min_count: int :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool - :keyword type_properties_type: AgentPoolType represents types of an agent pool. Possible values - include: "VirtualMachineScaleSets", "AvailabilitySet". + :keyword type_properties_type: AgentPoolType represents types of an agent pool. Known values + are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type_properties_type: str or ~azure.mgmt.containerservice.v2019_11_01.models.AgentPoolType :keyword orchestrator_version: Version of orchestrator specified when creating the managed @@ -288,12 +289,11 @@ def __init__( :keyword enable_node_public_ip: Enable public IP for nodes. :paramtype enable_node_public_ip: bool :keyword scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Possible values include: "Low", "Regular". Default value: - "Regular". + priority. Default to regular. Known values are: "Low", "Regular". Default value: "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2019_11_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction - policy for low priority virtual machine scale set. Default to Delete. Possible values include: + policy for low priority virtual machine scale set. Default to Delete. Known values are: "Delete", "Deallocate". Default value: "Delete". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2019_11_01.models.ScaleSetEvictionPolicy @@ -360,7 +360,7 @@ class AgentPoolAvailableVersions(msrest.serialization.Model): def __init__( self, *, - agent_pool_versions: Optional[List["AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem"]] = None, + agent_pool_versions: Optional[List["_models.AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem"]] = None, **kwargs ): """ @@ -437,7 +437,7 @@ class AgentPoolListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["AgentPool"]] = None, + value: Optional[List["_models.AgentPool"]] = None, **kwargs ): """ @@ -465,7 +465,7 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): :ivar kubernetes_version: Required. Kubernetes version (major, minor, patch). :vartype kubernetes_version: str :ivar os_type: Required. OsType to be used to specify os type. Choose from Linux and Windows. - Default to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2019_11_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -493,15 +493,15 @@ def __init__( self, *, kubernetes_version: str, - os_type: Union[str, "OSType"] = "Linux", - upgrades: Optional[List["AgentPoolUpgradeProfilePropertiesUpgradesItem"]] = None, + os_type: Union[str, "_models.OSType"] = "Linux", + upgrades: Optional[List["_models.AgentPoolUpgradeProfilePropertiesUpgradesItem"]] = None, **kwargs ): """ :keyword kubernetes_version: Required. Kubernetes version (major, minor, patch). :paramtype kubernetes_version: str :keyword os_type: Required. OsType to be used to specify os type. Choose from Linux and - Windows. Default to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Windows. Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2019_11_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: @@ -577,7 +577,7 @@ def __init__( code: Optional[str] = None, message: Optional[str] = None, target: Optional[str] = None, - details: Optional[List["CloudErrorBody"]] = None, + details: Optional[List["_models.CloudErrorBody"]] = None, **kwargs ): """ @@ -621,7 +621,7 @@ class ContainerServiceDiagnosticsProfile(msrest.serialization.Model): def __init__( self, *, - vm_diagnostics: "ContainerServiceVMDiagnostics", + vm_diagnostics: "_models.ContainerServiceVMDiagnostics", **kwargs ): """ @@ -658,7 +658,7 @@ def __init__( self, *, admin_username: str, - ssh: "ContainerServiceSshConfiguration", + ssh: "_models.ContainerServiceSshConfiguration", **kwargs ): """ @@ -681,17 +681,17 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar count: Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, - and 5. The default value is 1. Possible values include: 1, 3, 5. Default value: "1". + and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". :vartype count: int or ~azure.mgmt.containerservice.v2019_11_01.models.Count :ivar dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. :vartype dns_prefix: str - :ivar vm_size: Required. Size of agent VMs. Possible values include: "Standard_A1", - "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", - "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", - "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", - "Standard_A8m_v2", "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", - "Standard_B8ms", "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", - "Standard_D12", "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", + :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", + "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", + "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", + "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", "Standard_B8ms", + "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", "Standard_D12", + "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", "Standard_D13_v2_Promo", "Standard_D14", "Standard_D14_v2", "Standard_D14_v2_Promo", "Standard_D15_v2", "Standard_D16_v3", "Standard_D16s_v3", "Standard_D1_v2", "Standard_D2", "Standard_D2_v2", "Standard_D2_v2_Promo", "Standard_D2_v3", "Standard_D2s_v3", "Standard_D3", @@ -736,7 +736,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): :vartype first_consecutive_static_ip: str :ivar storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Possible values include: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". :vartype storage_profile: str or ~azure.mgmt.containerservice.v2019_11_01.models.ContainerServiceStorageProfileTypes :ivar fqdn: FQDN for the master pool. @@ -765,27 +765,27 @@ def __init__( self, *, dns_prefix: str, - vm_size: Union[str, "ContainerServiceVMSizeTypes"], - count: Optional[Union[int, "Count"]] = 1, + vm_size: Union[str, "_models.ContainerServiceVMSizeTypes"], + count: Optional[Union[int, "_models.Count"]] = 1, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, first_consecutive_static_ip: Optional[str] = "10.240.255.5", - storage_profile: Optional[Union[str, "ContainerServiceStorageProfileTypes"]] = None, + storage_profile: Optional[Union[str, "_models.ContainerServiceStorageProfileTypes"]] = None, **kwargs ): """ :keyword count: Number of masters (VMs) in the container service cluster. Allowed values are 1, - 3, and 5. The default value is 1. Possible values include: 1, 3, 5. Default value: "1". + 3, and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". :paramtype count: int or ~azure.mgmt.containerservice.v2019_11_01.models.Count :keyword dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. :paramtype dns_prefix: str - :keyword vm_size: Required. Size of agent VMs. Possible values include: "Standard_A1", - "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", - "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", - "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", - "Standard_A8m_v2", "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", - "Standard_B8ms", "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", - "Standard_D12", "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", + :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", + "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", + "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", + "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", "Standard_B8ms", + "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", "Standard_D12", + "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", "Standard_D13_v2_Promo", "Standard_D14", "Standard_D14_v2", "Standard_D14_v2_Promo", "Standard_D15_v2", "Standard_D16_v3", "Standard_D16s_v3", "Standard_D1_v2", "Standard_D2", "Standard_D2_v2", "Standard_D2_v2_Promo", "Standard_D2_v3", "Standard_D2s_v3", "Standard_D3", @@ -830,7 +830,7 @@ def __init__( :paramtype first_consecutive_static_ip: str :keyword storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Possible values include: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". :paramtype storage_profile: str or ~azure.mgmt.containerservice.v2019_11_01.models.ContainerServiceStorageProfileTypes """ @@ -848,11 +848,11 @@ def __init__( class ContainerServiceNetworkProfile(msrest.serialization.Model): """Profile of network configuration. - :ivar network_plugin: Network plugin used for building Kubernetes network. Possible values - include: "azure", "kubenet". Default value: "kubenet". + :ivar network_plugin: Network plugin used for building Kubernetes network. Known values are: + "azure", "kubenet". Default value: "kubenet". :vartype network_plugin: str or ~azure.mgmt.containerservice.v2019_11_01.models.NetworkPlugin - :ivar network_policy: Network policy used for building Kubernetes network. Possible values - include: "calico", "azure". + :ivar network_policy: Network policy used for building Kubernetes network. Known values are: + "calico", "azure". :vartype network_policy: str or ~azure.mgmt.containerservice.v2019_11_01.models.NetworkPolicy :ivar pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :vartype pod_cidr: str @@ -865,11 +865,11 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): :ivar docker_bridge_cidr: A CIDR notation IP range assigned to the Docker bridge network. It must not overlap with any Subnet IP ranges or the Kubernetes service address range. :vartype docker_bridge_cidr: str - :ivar outbound_type: The outbound (egress) routing method. Possible values include: - "loadBalancer", "userDefinedRouting". Default value: "loadBalancer". + :ivar outbound_type: The outbound (egress) routing method. Known values are: "loadBalancer", + "userDefinedRouting". Default value: "loadBalancer". :vartype outbound_type: str or ~azure.mgmt.containerservice.v2019_11_01.models.OutboundType - :ivar load_balancer_sku: The load balancer sku for the managed cluster. Possible values - include: "standard", "basic". + :ivar load_balancer_sku: The load balancer sku for the managed cluster. Known values are: + "standard", "basic". :vartype load_balancer_sku: str or ~azure.mgmt.containerservice.v2019_11_01.models.LoadBalancerSku :ivar load_balancer_profile: Profile of the cluster load balancer. @@ -899,23 +899,23 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): def __init__( self, *, - network_plugin: Optional[Union[str, "NetworkPlugin"]] = "kubenet", - network_policy: Optional[Union[str, "NetworkPolicy"]] = None, + network_plugin: Optional[Union[str, "_models.NetworkPlugin"]] = "kubenet", + network_policy: Optional[Union[str, "_models.NetworkPolicy"]] = None, pod_cidr: Optional[str] = "10.244.0.0/16", service_cidr: Optional[str] = "10.0.0.0/16", dns_service_ip: Optional[str] = "10.0.0.10", docker_bridge_cidr: Optional[str] = "172.17.0.1/16", - outbound_type: Optional[Union[str, "OutboundType"]] = "loadBalancer", - load_balancer_sku: Optional[Union[str, "LoadBalancerSku"]] = None, - load_balancer_profile: Optional["ManagedClusterLoadBalancerProfile"] = None, + outbound_type: Optional[Union[str, "_models.OutboundType"]] = "loadBalancer", + load_balancer_sku: Optional[Union[str, "_models.LoadBalancerSku"]] = None, + load_balancer_profile: Optional["_models.ManagedClusterLoadBalancerProfile"] = None, **kwargs ): """ - :keyword network_plugin: Network plugin used for building Kubernetes network. Possible values - include: "azure", "kubenet". Default value: "kubenet". + :keyword network_plugin: Network plugin used for building Kubernetes network. Known values are: + "azure", "kubenet". Default value: "kubenet". :paramtype network_plugin: str or ~azure.mgmt.containerservice.v2019_11_01.models.NetworkPlugin - :keyword network_policy: Network policy used for building Kubernetes network. Possible values - include: "calico", "azure". + :keyword network_policy: Network policy used for building Kubernetes network. Known values are: + "calico", "azure". :paramtype network_policy: str or ~azure.mgmt.containerservice.v2019_11_01.models.NetworkPolicy :keyword pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :paramtype pod_cidr: str @@ -928,11 +928,11 @@ def __init__( :keyword docker_bridge_cidr: A CIDR notation IP range assigned to the Docker bridge network. It must not overlap with any Subnet IP ranges or the Kubernetes service address range. :paramtype docker_bridge_cidr: str - :keyword outbound_type: The outbound (egress) routing method. Possible values include: - "loadBalancer", "userDefinedRouting". Default value: "loadBalancer". + :keyword outbound_type: The outbound (egress) routing method. Known values are: "loadBalancer", + "userDefinedRouting". Default value: "loadBalancer". :paramtype outbound_type: str or ~azure.mgmt.containerservice.v2019_11_01.models.OutboundType - :keyword load_balancer_sku: The load balancer sku for the managed cluster. Possible values - include: "standard", "basic". + :keyword load_balancer_sku: The load balancer sku for the managed cluster. Known values are: + "standard", "basic". :paramtype load_balancer_sku: str or ~azure.mgmt.containerservice.v2019_11_01.models.LoadBalancerSku :keyword load_balancer_profile: Profile of the cluster load balancer. @@ -973,7 +973,7 @@ class ContainerServiceSshConfiguration(msrest.serialization.Model): def __init__( self, *, - public_keys: List["ContainerServiceSshPublicKey"], + public_keys: List["_models.ContainerServiceSshPublicKey"], **kwargs ): """ @@ -1283,21 +1283,21 @@ def __init__( *, location: str, tags: Optional[Dict[str, str]] = None, - identity: Optional["ManagedClusterIdentity"] = None, + identity: Optional["_models.ManagedClusterIdentity"] = None, kubernetes_version: Optional[str] = None, dns_prefix: Optional[str] = None, - agent_pool_profiles: Optional[List["ManagedClusterAgentPoolProfile"]] = None, - linux_profile: Optional["ContainerServiceLinuxProfile"] = None, - windows_profile: Optional["ManagedClusterWindowsProfile"] = None, - service_principal_profile: Optional["ManagedClusterServicePrincipalProfile"] = None, - addon_profiles: Optional[Dict[str, "ManagedClusterAddonProfile"]] = None, + agent_pool_profiles: Optional[List["_models.ManagedClusterAgentPoolProfile"]] = None, + linux_profile: Optional["_models.ContainerServiceLinuxProfile"] = None, + windows_profile: Optional["_models.ManagedClusterWindowsProfile"] = None, + service_principal_profile: Optional["_models.ManagedClusterServicePrincipalProfile"] = None, + addon_profiles: Optional[Dict[str, "_models.ManagedClusterAddonProfile"]] = None, node_resource_group: Optional[str] = None, enable_rbac: Optional[bool] = None, enable_pod_security_policy: Optional[bool] = None, - network_profile: Optional["ContainerServiceNetworkProfile"] = None, - aad_profile: Optional["ManagedClusterAADProfile"] = None, - api_server_access_profile: Optional["ManagedClusterAPIServerAccessProfile"] = None, - identity_profile: Optional[Dict[str, "ManagedClusterPropertiesIdentityProfileValue"]] = None, + network_profile: Optional["_models.ContainerServiceNetworkProfile"] = None, + aad_profile: Optional["_models.ManagedClusterAADProfile"] = None, + api_server_access_profile: Optional["_models.ManagedClusterAPIServerAccessProfile"] = None, + identity_profile: Optional[Dict[str, "_models.ManagedClusterPropertiesIdentityProfileValue"]] = None, **kwargs ): """ @@ -1611,7 +1611,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar count: Number of agents (VMs) 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: Size of agent VMs. Possible values include: "Standard_A1", "Standard_A10", + :ivar vm_size: Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -1660,7 +1660,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2019_11_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -1668,7 +1668,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :vartype min_count: int :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool - :ivar type: AgentPoolType represents types of an agent pool. Possible values include: + :ivar type: AgentPoolType represents types of an agent pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2019_11_01.models.AgentPoolType :ivar orchestrator_version: Version of orchestrator specified when creating the managed @@ -1683,13 +1683,12 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar enable_node_public_ip: Enable public IP for nodes. :vartype enable_node_public_ip: bool :ivar scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Possible values include: "Low", "Regular". Default value: - "Regular". + priority. Default to regular. Known values are: "Low", "Regular". Default value: "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2019_11_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy - for low priority virtual machine scale set. Default to Delete. Possible values include: - "Delete", "Deallocate". Default value: "Delete". + for low priority virtual machine scale set. Default to Delete. Known values are: "Delete", + "Deallocate". Default value: "Delete". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2019_11_01.models.ScaleSetEvictionPolicy :ivar tags: A set of tags. Agent pool tags to be persisted on the agent pool virtual machine @@ -1733,20 +1732,20 @@ def __init__( self, *, count: Optional[int] = None, - vm_size: Optional[Union[str, "ContainerServiceVMSizeTypes"]] = None, + vm_size: Optional[Union[str, "_models.ContainerServiceVMSizeTypes"]] = None, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - type: Optional[Union[str, "AgentPoolType"]] = None, + type: Optional[Union[str, "_models.AgentPoolType"]] = None, orchestrator_version: Optional[str] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, - scale_set_priority: Optional[Union[str, "ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -1756,7 +1755,7 @@ def __init__( :keyword count: Number of agents (VMs) 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: Size of agent VMs. Possible values include: "Standard_A1", "Standard_A10", + :keyword vm_size: Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -1805,7 +1804,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2019_11_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -1813,7 +1812,7 @@ def __init__( :paramtype min_count: int :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool - :keyword type: AgentPoolType represents types of an agent pool. Possible values include: + :keyword type: AgentPoolType represents types of an agent pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2019_11_01.models.AgentPoolType :keyword orchestrator_version: Version of orchestrator specified when creating the managed @@ -1825,12 +1824,11 @@ def __init__( :keyword enable_node_public_ip: Enable public IP for nodes. :paramtype enable_node_public_ip: bool :keyword scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Possible values include: "Low", "Regular". Default value: - "Regular". + priority. Default to regular. Known values are: "Low", "Regular". Default value: "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2019_11_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction - policy for low priority virtual machine scale set. Default to Delete. Possible values include: + policy for low priority virtual machine scale set. Default to Delete. Known values are: "Delete", "Deallocate". Default value: "Delete". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2019_11_01.models.ScaleSetEvictionPolicy @@ -1875,7 +1873,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar count: Number of agents (VMs) 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: Size of agent VMs. Possible values include: "Standard_A1", "Standard_A10", + :ivar vm_size: Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -1924,7 +1922,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2019_11_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -1932,7 +1930,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :vartype min_count: int :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool - :ivar type: AgentPoolType represents types of an agent pool. Possible values include: + :ivar type: AgentPoolType represents types of an agent pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2019_11_01.models.AgentPoolType :ivar orchestrator_version: Version of orchestrator specified when creating the managed @@ -1947,13 +1945,12 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar enable_node_public_ip: Enable public IP for nodes. :vartype enable_node_public_ip: bool :ivar scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Possible values include: "Low", "Regular". Default value: - "Regular". + priority. Default to regular. Known values are: "Low", "Regular". Default value: "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2019_11_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy - for low priority virtual machine scale set. Default to Delete. Possible values include: - "Delete", "Deallocate". Default value: "Delete". + for low priority virtual machine scale set. Default to Delete. Known values are: "Delete", + "Deallocate". Default value: "Delete". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2019_11_01.models.ScaleSetEvictionPolicy :ivar tags: A set of tags. Agent pool tags to be persisted on the agent pool virtual machine @@ -2003,20 +2000,20 @@ def __init__( *, name: str, count: Optional[int] = None, - vm_size: Optional[Union[str, "ContainerServiceVMSizeTypes"]] = None, + vm_size: Optional[Union[str, "_models.ContainerServiceVMSizeTypes"]] = None, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - type: Optional[Union[str, "AgentPoolType"]] = None, + type: Optional[Union[str, "_models.AgentPoolType"]] = None, orchestrator_version: Optional[str] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, - scale_set_priority: Optional[Union[str, "ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -2026,7 +2023,7 @@ def __init__( :keyword count: Number of agents (VMs) 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: Size of agent VMs. Possible values include: "Standard_A1", "Standard_A10", + :keyword vm_size: Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -2075,7 +2072,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2019_11_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -2083,7 +2080,7 @@ def __init__( :paramtype min_count: int :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool - :keyword type: AgentPoolType represents types of an agent pool. Possible values include: + :keyword type: AgentPoolType represents types of an agent pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2019_11_01.models.AgentPoolType :keyword orchestrator_version: Version of orchestrator specified when creating the managed @@ -2095,12 +2092,11 @@ def __init__( :keyword enable_node_public_ip: Enable public IP for nodes. :paramtype enable_node_public_ip: bool :keyword scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Possible values include: "Low", "Regular". Default value: - "Regular". + priority. Default to regular. Known values are: "Low", "Regular". Default value: "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2019_11_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction - policy for low priority virtual machine scale set. Default to Delete. Possible values include: + policy for low priority virtual machine scale set. Default to Delete. Known values are: "Delete", "Deallocate". Default value: "Delete". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2019_11_01.models.ScaleSetEvictionPolicy @@ -2166,7 +2162,7 @@ class ManagedClusterIdentity(msrest.serialization.Model): :ivar type: The type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ resource group in agent nodes. Type 'None' will not use MSI for the managed cluster, - service principal will be used instead. Possible values include: "SystemAssigned", "None". + service principal will be used instead. Known values are: "SystemAssigned", "None". :vartype type: str or ~azure.mgmt.containerservice.v2019_11_01.models.ResourceIdentityType """ @@ -2184,15 +2180,14 @@ class ManagedClusterIdentity(msrest.serialization.Model): def __init__( self, *, - type: Optional[Union[str, "ResourceIdentityType"]] = None, + type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, **kwargs ): """ :keyword type: The type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ resource group in agent nodes. Type 'None' will not use MSI for the managed - cluster, service principal will be used instead. Possible values include: "SystemAssigned", - "None". + cluster, service principal will be used instead. Known values are: "SystemAssigned", "None". :paramtype type: str or ~azure.mgmt.containerservice.v2019_11_01.models.ResourceIdentityType """ super(ManagedClusterIdentity, self).__init__(**kwargs) @@ -2224,7 +2219,7 @@ class ManagedClusterListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["ManagedCluster"]] = None, + value: Optional[List["_models.ManagedCluster"]] = None, **kwargs ): """ @@ -2278,10 +2273,10 @@ class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): def __init__( self, *, - managed_outbound_i_ps: Optional["ManagedClusterLoadBalancerProfileManagedOutboundIPs"] = None, - outbound_ip_prefixes: Optional["ManagedClusterLoadBalancerProfileOutboundIPPrefixes"] = None, - outbound_i_ps: Optional["ManagedClusterLoadBalancerProfileOutboundIPs"] = None, - effective_outbound_i_ps: Optional[List["ResourceReference"]] = None, + managed_outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileManagedOutboundIPs"] = None, + outbound_ip_prefixes: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPPrefixes"] = None, + outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPs"] = None, + effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, allocated_outbound_ports: Optional[int] = 0, idle_timeout_in_minutes: Optional[int] = 30, **kwargs @@ -2364,7 +2359,7 @@ class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.M def __init__( self, *, - public_ip_prefixes: Optional[List["ResourceReference"]] = None, + public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, **kwargs ): """ @@ -2390,7 +2385,7 @@ class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): def __init__( self, *, - public_i_ps: Optional[List["ResourceReference"]] = None, + public_i_ps: Optional[List["_models.ResourceReference"]] = None, **kwargs ): """ @@ -2411,7 +2406,7 @@ class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): :ivar name: Pool name. :vartype name: str :ivar os_type: Required. OsType to be used to specify os type. Choose from Linux and Windows. - Default to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2019_11_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -2434,9 +2429,9 @@ def __init__( self, *, kubernetes_version: str, - os_type: Union[str, "OSType"] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", name: Optional[str] = None, - upgrades: Optional[List["ManagedClusterPoolUpgradeProfileUpgradesItem"]] = None, + upgrades: Optional[List["_models.ManagedClusterPoolUpgradeProfileUpgradesItem"]] = None, **kwargs ): """ @@ -2445,7 +2440,7 @@ def __init__( :keyword name: Pool name. :paramtype name: str :keyword os_type: Required. OsType to be used to specify os type. Choose from Linux and - Windows. Default to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Windows. Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2019_11_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: @@ -2605,8 +2600,8 @@ class ManagedClusterUpgradeProfile(msrest.serialization.Model): def __init__( self, *, - control_plane_profile: "ManagedClusterPoolUpgradeProfile", - agent_pool_profiles: List["ManagedClusterPoolUpgradeProfile"], + control_plane_profile: "_models.ManagedClusterPoolUpgradeProfile", + agent_pool_profiles: List["_models.ManagedClusterPoolUpgradeProfile"], **kwargs ): """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/models/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/models/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/operations/__init__.py index 5aac40228eec..403c0174f052 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/operations/__init__.py @@ -10,8 +10,13 @@ from ._managed_clusters_operations import ManagedClustersOperations from ._agent_pools_operations import AgentPoolsOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'Operations', 'ManagedClustersOperations', 'AgentPoolsOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/operations/_agent_pools_operations.py index c2e2cbd2d67f..d2d41d58e55e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/operations/_agent_pools_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -35,9 +35,12 @@ def build_list_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-11-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools") # pylint: disable=line-too-long path_format_arguments = { @@ -49,18 +52,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -72,9 +73,12 @@ def build_get_request( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-11-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -87,18 +91,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -109,14 +111,17 @@ def build_create_or_update_request_initial( resource_name: str, agent_pool_name: str, *, - json: JSONType = None, + json: Optional[_models.AgentPool] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-11-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -129,20 +134,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -156,9 +159,12 @@ def build_delete_request_initial( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-11-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -171,18 +177,16 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -194,9 +198,12 @@ def build_get_upgrade_profile_request( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-11-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default") # pylint: disable=line-too-long path_format_arguments = { @@ -209,18 +216,16 @@ def build_get_upgrade_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -231,9 +236,12 @@ def build_get_available_agent_pool_versions_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-11-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions") # pylint: disable=line-too-long path_format_arguments = { @@ -245,42 +253,38 @@ def build_get_available_agent_pool_versions_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class AgentPoolsOperations(object): - """AgentPoolsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class AgentPoolsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2019_11_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2019_11_01.ContainerServiceClient`'s + :attr:`agent_pools` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -288,7 +292,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Iterable["_models.AgentPoolListResult"]: + ) -> Iterable[_models.AgentPoolListResult]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. The operation returns properties @@ -304,13 +308,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2019_11_01.models.AgentPoolListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-11-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -320,9 +327,11 @@ def prepare_request(next_link=None): resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -332,9 +341,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -374,7 +385,7 @@ def get( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPool": + ) -> _models.AgentPool: """Gets the agent pool. Gets the details of the agent pool by managed cluster and resource group. @@ -390,13 +401,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2019_11_01.models.AgentPool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-11-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] request = build_get_request( @@ -406,11 +420,13 @@ def get( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -436,17 +452,20 @@ def _create_or_update_initial( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> "_models.AgentPool": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] + ) -> _models.AgentPool: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2019-11-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] _json = self._serialize.body(parameters, 'AgentPool') @@ -459,11 +478,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -494,9 +515,9 @@ def begin_create_or_update( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> LROPoller["_models.AgentPool"]: + ) -> LROPoller[_models.AgentPool]: """Creates or updates an agent pool. Creates or updates an agent pool in the specified managed cluster. @@ -522,17 +543,20 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_11_01.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-11-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, @@ -540,20 +564,27 @@ def begin_create_or_update( 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): - response = pipeline_response.http_response deserialized = self._deserialize('AgentPool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -573,13 +604,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements agent_pool_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2019-11-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -589,11 +623,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -640,21 +676,26 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-11-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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) @@ -664,8 +705,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -685,7 +732,7 @@ def get_upgrade_profile( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPoolUpgradeProfile": + ) -> _models.AgentPoolUpgradeProfile: """Gets upgrade profile for an agent pool. Gets the details of the upgrade profile for an agent pool with a specified resource group and @@ -702,13 +749,16 @@ def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2019_11_01.models.AgentPoolUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-11-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] request = build_get_upgrade_profile_request( @@ -718,11 +768,13 @@ def get_upgrade_profile( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -749,7 +801,7 @@ def get_available_agent_pool_versions( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.AgentPoolAvailableVersions": + ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported versions for the specified agent pool. Gets a list of supported versions for the specified agent pool. @@ -763,13 +815,16 @@ def get_available_agent_pool_versions( :rtype: ~azure.mgmt.containerservice.v2019_11_01.models.AgentPoolAvailableVersions :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolAvailableVersions"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-11-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] request = build_get_available_agent_pool_versions_request( @@ -778,11 +833,13 @@ def get_available_agent_pool_versions( resource_name=resource_name, api_version=api_version, template_url=self.get_available_agent_pool_versions.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/operations/_managed_clusters_operations.py index 71f8633df4cc..db962d360131 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/operations/_managed_clusters_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -33,9 +33,12 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-11-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters") path_format_arguments = { @@ -45,18 +48,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -66,9 +67,12 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-11-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters") # pylint: disable=line-too-long path_format_arguments = { @@ -79,18 +83,16 @@ def build_list_by_resource_group_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -101,9 +103,12 @@ def build_get_upgrade_profile_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-11-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default") # pylint: disable=line-too-long path_format_arguments = { @@ -115,18 +120,16 @@ def build_get_upgrade_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -138,9 +141,12 @@ def build_get_access_profile_request( role_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-11-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -153,18 +159,16 @@ def build_get_access_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -175,9 +179,12 @@ def build_list_cluster_admin_credentials_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-11-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -189,18 +196,16 @@ def build_list_cluster_admin_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -211,9 +216,12 @@ def build_list_cluster_user_credentials_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-11-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -225,18 +233,16 @@ def build_list_cluster_user_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -247,9 +253,12 @@ def build_list_cluster_monitoring_user_credentials_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-11-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -261,18 +270,16 @@ def build_list_cluster_monitoring_user_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -283,9 +290,12 @@ def build_get_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-11-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -297,18 +307,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -318,14 +326,17 @@ def build_create_or_update_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedCluster] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-11-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -337,20 +348,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -362,14 +371,17 @@ def build_update_tags_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.TagsObject] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-11-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -381,20 +393,18 @@ def build_update_tags_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -407,9 +417,12 @@ def build_delete_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-11-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -421,18 +434,16 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -442,14 +453,17 @@ def build_reset_service_principal_profile_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedClusterServicePrincipalProfile] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-11-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile") # pylint: disable=line-too-long path_format_arguments = { @@ -461,20 +475,18 @@ def build_reset_service_principal_profile_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -486,14 +498,17 @@ def build_reset_aad_profile_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedClusterAADProfile] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-11-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile") # pylint: disable=line-too-long path_format_arguments = { @@ -505,20 +520,18 @@ def build_reset_aad_profile_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -531,9 +544,12 @@ def build_rotate_cluster_certificates_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-11-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates") # pylint: disable=line-too-long path_format_arguments = { @@ -545,48 +561,44 @@ def build_rotate_cluster_certificates_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class ManagedClustersOperations(object): - """ManagedClustersOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ManagedClustersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2019_11_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2019_11_01.ContainerServiceClient`'s + :attr:`managed_clusters` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> Iterable["_models.ManagedClusterListResult"]: + ) -> Iterable[_models.ManagedClusterListResult]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. The operation returns properties @@ -599,13 +611,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2019_11_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-11-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -613,9 +628,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -623,9 +640,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -663,7 +682,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.ManagedClusterListResult"]: + ) -> Iterable[_models.ManagedClusterListResult]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. The operation returns @@ -678,13 +697,16 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2019_11_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-11-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -693,9 +715,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -704,9 +728,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -745,7 +771,7 @@ def get_upgrade_profile( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedClusterUpgradeProfile": + ) -> _models.ManagedClusterUpgradeProfile: """Gets upgrade profile for a managed cluster. Gets the details of the upgrade profile for a managed cluster with a specified resource group @@ -760,13 +786,16 @@ def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2019_11_01.models.ManagedClusterUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2019-11-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] request = build_get_upgrade_profile_request( @@ -775,11 +804,13 @@ def get_upgrade_profile( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -807,7 +838,7 @@ def get_access_profile( resource_name: str, role_name: str, **kwargs: Any - ) -> "_models.ManagedClusterAccessProfile": + ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. Gets the accessProfile for the specified role name of the managed cluster with a specified @@ -824,13 +855,16 @@ def get_access_profile( :rtype: ~azure.mgmt.containerservice.v2019_11_01.models.ManagedClusterAccessProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterAccessProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-11-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] request = build_get_access_profile_request( @@ -840,11 +874,13 @@ def get_access_profile( role_name=role_name, api_version=api_version, template_url=self.get_access_profile.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -871,7 +907,7 @@ def list_cluster_admin_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster admin credential of a managed cluster. Gets cluster admin credential of the managed cluster with a specified resource group and name. @@ -885,13 +921,16 @@ def list_cluster_admin_credentials( :rtype: ~azure.mgmt.containerservice.v2019_11_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-11-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_admin_credentials_request( @@ -900,11 +939,13 @@ def list_cluster_admin_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_admin_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -931,7 +972,7 @@ def list_cluster_user_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster user credential of a managed cluster. Gets cluster user credential of the managed cluster with a specified resource group and name. @@ -945,13 +986,16 @@ def list_cluster_user_credentials( :rtype: ~azure.mgmt.containerservice.v2019_11_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2019-11-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_user_credentials_request( @@ -960,11 +1004,13 @@ def list_cluster_user_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -991,7 +1037,7 @@ def list_cluster_monitoring_user_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster monitoring user credential of a managed cluster. Gets cluster monitoring user credential of the managed cluster with a specified resource group @@ -1006,13 +1052,16 @@ def list_cluster_monitoring_user_credentials( :rtype: ~azure.mgmt.containerservice.v2019_11_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-11-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_monitoring_user_credentials_request( @@ -1021,11 +1070,13 @@ def list_cluster_monitoring_user_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1052,7 +1103,7 @@ def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedCluster": + ) -> _models.ManagedCluster: """Gets a managed cluster. Gets the details of the managed cluster with a specified resource group and name. @@ -1066,13 +1117,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2019_11_01.models.ManagedCluster :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2019-11-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] request = build_get_request( @@ -1081,11 +1135,13 @@ def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1110,17 +1166,20 @@ def _create_or_update_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2019-11-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'ManagedCluster') @@ -1132,11 +1191,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1166,9 +1227,9 @@ def begin_create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> LROPoller["_models.ManagedCluster"]: + ) -> LROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. Creates or updates a managed cluster with the specified configuration for agents and Kubernetes @@ -1194,37 +1255,47 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_11_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-11-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1241,17 +1312,20 @@ def _update_tags_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2019-11-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'TagsObject') @@ -1263,11 +1337,13 @@ def _update_tags_initial( content_type=content_type, json=_json, template_url=self._update_tags_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1293,9 +1369,9 @@ def begin_update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> LROPoller["_models.ManagedCluster"]: + ) -> LROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates a managed cluster with the specified tags. @@ -1320,37 +1396,47 @@ def begin_update_tags( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2019_11_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-11-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._update_tags_initial( + raw_result = self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1369,13 +1455,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-11-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -1384,11 +1473,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1432,20 +1523,25 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-11-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_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) @@ -1455,8 +1551,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1473,17 +1575,20 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2019-11-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') @@ -1495,11 +1600,13 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re content_type=content_type, json=_json, template_url=self._reset_service_principal_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1521,7 +1628,7 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> LROPoller[None]: """Reset Service Principal Profile of a managed cluster. @@ -1548,23 +1655,28 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-11-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._reset_service_principal_profile_initial( + raw_result = self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1574,8 +1686,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1592,17 +1710,20 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2019-11-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') @@ -1614,11 +1735,13 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement content_type=content_type, json=_json, template_url=self._reset_aad_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1640,7 +1763,7 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> LROPoller[None]: """Reset AAD Profile of a managed cluster. @@ -1666,23 +1789,28 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-11-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._reset_aad_profile_initial( + raw_result = self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1692,8 +1820,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1712,13 +1846,16 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-11-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_rotate_cluster_certificates_request_initial( @@ -1727,11 +1864,13 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return resource_name=resource_name, api_version=api_version, template_url=self._rotate_cluster_certificates_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1775,20 +1914,25 @@ def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-st :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-11-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._rotate_cluster_certificates_initial( + raw_result = self._rotate_cluster_certificates_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) @@ -1798,8 +1942,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/operations/_operations.py index 9f8154803604..37606e5d60f1 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/operations/_operations.py @@ -16,6 +16,7 @@ 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 @@ -29,55 +30,54 @@ def build_list_request( **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-11-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.ContainerService/operations") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class Operations(object): - """Operations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2019_11_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2019_11_01.ContainerServiceClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> Iterable["_models.OperationListResult"]: + ) -> Iterable[_models.OperationListResult]: """Gets a list of compute operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -86,31 +86,38 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2019_11_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-11-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2019_11_01/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/__init__.py index 53c675bd95e2..37a5f9e02e6f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._container_service_client import ContainerServiceClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['ContainerServiceClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/_container_service_client.py index b5c05e32388d..acd9735116d1 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/_container_service_client.py @@ -60,9 +60,15 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.managed_clusters = ManagedClustersOperations(self._client, self._config, self._serialize, self._deserialize) - self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_clusters = ManagedClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.agent_pools = AgentPoolsOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/aio/__init__.py index 53c675bd95e2..37a5f9e02e6f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/aio/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/aio/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._container_service_client import ContainerServiceClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['ContainerServiceClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/aio/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/aio/_container_service_client.py index b6064c1d0c2c..86ef60fc8346 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/aio/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/aio/_container_service_client.py @@ -61,9 +61,15 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.managed_clusters = ManagedClustersOperations(self._client, self._config, self._serialize, self._deserialize) - self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_clusters = ManagedClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.agent_pools = AgentPoolsOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/aio/operations/__init__.py index 5aac40228eec..403c0174f052 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/aio/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/aio/operations/__init__.py @@ -10,8 +10,13 @@ from ._managed_clusters_operations import ManagedClustersOperations from ._agent_pools_operations import AgentPoolsOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'Operations', 'ManagedClustersOperations', 'AgentPoolsOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/aio/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/aio/operations/_agent_pools_operations.py index 5d051cfe7628..4727d9943df1 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/aio/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/aio/operations/_agent_pools_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. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ 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 @@ -26,26 +27,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class AgentPoolsOperations: - """AgentPoolsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2020_01_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2020_01_01.aio.ContainerServiceClient`'s + :attr:`agent_pools` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -53,7 +52,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> AsyncIterable["_models.AgentPoolListResult"]: + ) -> AsyncIterable[_models.AgentPoolListResult]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. The operation returns properties @@ -69,13 +68,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_01_01.models.AgentPoolListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-01-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -85,9 +87,11 @@ def prepare_request(next_link=None): resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -97,9 +101,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -139,7 +145,7 @@ async def get( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPool": + ) -> _models.AgentPool: """Gets the agent pool. Gets the details of the agent pool by managed cluster and resource group. @@ -155,13 +161,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2020_01_01.models.AgentPool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-01-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] request = build_get_request( @@ -171,11 +180,13 @@ async def get( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -201,17 +212,20 @@ async def _create_or_update_initial( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> "_models.AgentPool": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] + ) -> _models.AgentPool: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2020-01-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] _json = self._serialize.body(parameters, 'AgentPool') @@ -224,11 +238,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -259,9 +275,9 @@ async def begin_create_or_update( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> AsyncLROPoller["_models.AgentPool"]: + ) -> AsyncLROPoller[_models.AgentPool]: """Creates or updates an agent pool. Creates or updates an agent pool in the specified managed cluster. @@ -288,17 +304,20 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_01_01.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-01-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, @@ -306,20 +325,27 @@ async def begin_create_or_update( 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): - response = pipeline_response.http_response deserialized = self._deserialize('AgentPool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -339,13 +365,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements agent_pool_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-01-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -355,11 +384,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -406,21 +437,26 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-01-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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) @@ -430,8 +466,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -451,7 +493,7 @@ async def get_upgrade_profile( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPoolUpgradeProfile": + ) -> _models.AgentPoolUpgradeProfile: """Gets upgrade profile for an agent pool. Gets the details of the upgrade profile for an agent pool with a specified resource group and @@ -468,13 +510,16 @@ async def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2020_01_01.models.AgentPoolUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-01-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] request = build_get_upgrade_profile_request( @@ -484,11 +529,13 @@ async def get_upgrade_profile( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -515,7 +562,7 @@ async def get_available_agent_pool_versions( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.AgentPoolAvailableVersions": + ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported versions for the specified agent pool. Gets a list of supported versions for the specified agent pool. @@ -529,13 +576,16 @@ async def get_available_agent_pool_versions( :rtype: ~azure.mgmt.containerservice.v2020_01_01.models.AgentPoolAvailableVersions :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolAvailableVersions"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-01-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] request = build_get_available_agent_pool_versions_request( @@ -544,11 +594,13 @@ async def get_available_agent_pool_versions( resource_name=resource_name, api_version=api_version, template_url=self.get_available_agent_pool_versions.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/aio/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/aio/operations/_managed_clusters_operations.py index 4f8ba1457973..848351e472fc 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/aio/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/aio/operations/_managed_clusters_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. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ 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 @@ -26,32 +27,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ManagedClustersOperations: - """ManagedClustersOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2020_01_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2020_01_01.aio.ContainerServiceClient`'s + :attr:`managed_clusters` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.ManagedClusterListResult"]: + ) -> AsyncIterable[_models.ManagedClusterListResult]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. The operation returns properties @@ -64,13 +63,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_01_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-01-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -78,9 +80,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -88,9 +92,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -128,7 +134,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ManagedClusterListResult"]: + ) -> AsyncIterable[_models.ManagedClusterListResult]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. The operation returns @@ -143,13 +149,16 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_01_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-01-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -158,9 +167,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -169,9 +180,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -210,7 +223,7 @@ async def get_upgrade_profile( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedClusterUpgradeProfile": + ) -> _models.ManagedClusterUpgradeProfile: """Gets upgrade profile for a managed cluster. Gets the details of the upgrade profile for a managed cluster with a specified resource group @@ -225,13 +238,16 @@ async def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2020_01_01.models.ManagedClusterUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-01-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] request = build_get_upgrade_profile_request( @@ -240,11 +256,13 @@ async def get_upgrade_profile( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -272,7 +290,7 @@ async def get_access_profile( resource_name: str, role_name: str, **kwargs: Any - ) -> "_models.ManagedClusterAccessProfile": + ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. Gets the accessProfile for the specified role name of the managed cluster with a specified @@ -289,13 +307,16 @@ async def get_access_profile( :rtype: ~azure.mgmt.containerservice.v2020_01_01.models.ManagedClusterAccessProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterAccessProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-01-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] request = build_get_access_profile_request( @@ -305,11 +326,13 @@ async def get_access_profile( role_name=role_name, api_version=api_version, template_url=self.get_access_profile.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -336,7 +359,7 @@ async def list_cluster_admin_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster admin credential of a managed cluster. Gets cluster admin credential of the managed cluster with a specified resource group and name. @@ -350,13 +373,16 @@ async def list_cluster_admin_credentials( :rtype: ~azure.mgmt.containerservice.v2020_01_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-01-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_admin_credentials_request( @@ -365,11 +391,13 @@ async def list_cluster_admin_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_admin_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -396,7 +424,7 @@ async def list_cluster_user_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster user credential of a managed cluster. Gets cluster user credential of the managed cluster with a specified resource group and name. @@ -410,13 +438,16 @@ async def list_cluster_user_credentials( :rtype: ~azure.mgmt.containerservice.v2020_01_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-01-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_user_credentials_request( @@ -425,11 +456,13 @@ async def list_cluster_user_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -456,7 +489,7 @@ async def list_cluster_monitoring_user_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster monitoring user credential of a managed cluster. Gets cluster monitoring user credential of the managed cluster with a specified resource group @@ -471,13 +504,16 @@ async def list_cluster_monitoring_user_credentials( :rtype: ~azure.mgmt.containerservice.v2020_01_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-01-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_monitoring_user_credentials_request( @@ -486,11 +522,13 @@ async def list_cluster_monitoring_user_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -517,7 +555,7 @@ async def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedCluster": + ) -> _models.ManagedCluster: """Gets a managed cluster. Gets the details of the managed cluster with a specified resource group and name. @@ -531,13 +569,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2020_01_01.models.ManagedCluster :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-01-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] request = build_get_request( @@ -546,11 +587,13 @@ async def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -575,17 +618,20 @@ async def _create_or_update_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2020-01-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'ManagedCluster') @@ -597,11 +643,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -631,9 +679,9 @@ async def begin_create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> AsyncLROPoller["_models.ManagedCluster"]: + ) -> AsyncLROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. Creates or updates a managed cluster with the specified configuration for agents and Kubernetes @@ -659,37 +707,47 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_01_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-01-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -706,17 +764,20 @@ async def _update_tags_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-01-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'TagsObject') @@ -728,11 +789,13 @@ async def _update_tags_initial( content_type=content_type, json=_json, template_url=self._update_tags_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -758,9 +821,9 @@ async def begin_update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> AsyncLROPoller["_models.ManagedCluster"]: + ) -> AsyncLROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates a managed cluster with the specified tags. @@ -785,37 +848,47 @@ async def begin_update_tags( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_01_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-01-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._update_tags_initial( + raw_result = await self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -834,13 +907,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-01-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -849,11 +925,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -897,20 +975,25 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-01-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_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) @@ -920,8 +1003,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -938,17 +1027,20 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2020-01-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') @@ -960,11 +1052,13 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist content_type=content_type, json=_json, template_url=self._reset_service_principal_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -986,7 +1080,7 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> AsyncLROPoller[None]: """Reset Service Principal Profile of a managed cluster. @@ -1013,23 +1107,28 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-01-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._reset_service_principal_profile_initial( + raw_result = await self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1039,8 +1138,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1057,17 +1162,20 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-01-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') @@ -1079,11 +1187,13 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta content_type=content_type, json=_json, template_url=self._reset_aad_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1105,7 +1215,7 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> AsyncLROPoller[None]: """Reset AAD Profile of a managed cluster. @@ -1131,23 +1241,28 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-01-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._reset_aad_profile_initial( + raw_result = await self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1157,8 +1272,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1177,13 +1298,16 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-01-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_rotate_cluster_certificates_request_initial( @@ -1192,11 +1316,13 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- resource_name=resource_name, api_version=api_version, template_url=self._rotate_cluster_certificates_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1240,20 +1366,25 @@ async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-ret :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-01-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._rotate_cluster_certificates_initial( + raw_result = await self._rotate_cluster_certificates_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) @@ -1263,8 +1394,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/aio/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/aio/operations/_operations.py index 71d046783edb..389ef366ace5 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/aio/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/aio/operations/_operations.py @@ -14,6 +14,7 @@ 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 @@ -23,32 +24,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class Operations: - """Operations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2020_01_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2020_01_01.aio.ContainerServiceClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.OperationListResult"]: + ) -> AsyncIterable[_models.OperationListResult]: """Gets a list of compute operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -57,31 +56,38 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_01_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-01-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/aio/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/aio/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/models/__init__.py index 91d2c61fb783..1a970d9d5e41 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/models/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/models/__init__.py @@ -65,7 +65,9 @@ ScaleSetEvictionPolicy, ScaleSetPriority, ) - +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'AgentPool', 'AgentPoolAvailableVersions', @@ -123,3 +125,5 @@ 'ScaleSetEvictionPolicy', 'ScaleSetPriority', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/models/_container_service_client_enums.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/models/_container_service_client_enums.py index 9e8d4ef7ae7b..137bd739161e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/models/_container_service_client_enums.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/models/_container_service_client_enums.py @@ -7,18 +7,17 @@ # -------------------------------------------------------------------------- from enum import Enum -from six import with_metaclass from azure.core import CaseInsensitiveEnumMeta -class AgentPoolType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class AgentPoolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """AgentPoolType represents types of an agent pool. """ VIRTUAL_MACHINE_SCALE_SETS = "VirtualMachineScaleSets" AVAILABILITY_SET = "AvailabilitySet" -class ContainerServiceStorageProfileTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the orchestrator choice. """ @@ -26,7 +25,7 @@ class ContainerServiceStorageProfileTypes(with_metaclass(CaseInsensitiveEnumMeta STORAGE_ACCOUNT = "StorageAccount" MANAGED_DISKS = "ManagedDisks" -class ContainerServiceVMSizeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Size of agent VMs. """ @@ -205,7 +204,7 @@ class ContainerServiceVMSizeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, E STANDARD_NV24 = "Standard_NV24" STANDARD_NV6 = "Standard_NV6" -class Count(with_metaclass(CaseInsensitiveEnumMeta, int, Enum)): +class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): """Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, and 5. The default value is 1. """ @@ -214,42 +213,42 @@ class Count(with_metaclass(CaseInsensitiveEnumMeta, int, Enum)): THREE = 3 FIVE = 5 -class LoadBalancerSku(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class LoadBalancerSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The load balancer sku for the managed cluster. """ STANDARD = "standard" BASIC = "basic" -class NetworkPlugin(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkPlugin(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Network plugin used for building Kubernetes network. """ AZURE = "azure" KUBENET = "kubenet" -class NetworkPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Network policy used for building Kubernetes network. """ CALICO = "calico" AZURE = "azure" -class OSType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux. """ LINUX = "Linux" WINDOWS = "Windows" -class OutboundType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OutboundType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The outbound (egress) routing method. """ LOAD_BALANCER = "loadBalancer" USER_DEFINED_ROUTING = "userDefinedRouting" -class ResourceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ resource group in agent nodes. Type 'None' will not use MSI for the managed cluster, service @@ -259,7 +258,7 @@ class ResourceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): SYSTEM_ASSIGNED = "SystemAssigned" NONE = "None" -class ScaleSetEvictionPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ScaleSetEvictionPolicy to be used to specify eviction policy for low priority virtual machine scale set. Default to Delete. """ @@ -267,7 +266,7 @@ class ScaleSetEvictionPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)) DELETE = "Delete" DEALLOCATE = "Deallocate" -class ScaleSetPriority(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ScaleSetPriority(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ScaleSetPriority to be used to specify virtual machine scale set priority. Default to regular. """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/models/_models_py3.py index 8aa8ea840b64..8438ddca33a9 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/models/_models_py3.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/models/_models_py3.py @@ -6,11 +6,13 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Dict, List, Optional, Union +from typing import Dict, List, Optional, TYPE_CHECKING, Union import msrest.serialization -from ._container_service_client_enums import * +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + import __init__ as _models class SubResource(msrest.serialization.Model): @@ -66,7 +68,7 @@ class AgentPool(SubResource): :ivar count: Number of agents (VMs) 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: Size of agent VMs. Possible values include: "Standard_A1", "Standard_A10", + :ivar vm_size: Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -115,7 +117,7 @@ class AgentPool(SubResource): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2020_01_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -123,8 +125,8 @@ class AgentPool(SubResource): :vartype min_count: int :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool - :ivar type_properties_type: AgentPoolType represents types of an agent pool. Possible values - include: "VirtualMachineScaleSets", "AvailabilitySet". + :ivar type_properties_type: AgentPoolType represents types of an agent pool. Known values are: + "VirtualMachineScaleSets", "AvailabilitySet". :vartype type_properties_type: str or ~azure.mgmt.containerservice.v2020_01_01.models.AgentPoolType :ivar orchestrator_version: Version of orchestrator specified when creating the managed @@ -139,13 +141,12 @@ class AgentPool(SubResource): :ivar enable_node_public_ip: Enable public IP for nodes. :vartype enable_node_public_ip: bool :ivar scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Possible values include: "Low", "Regular". Default value: - "Regular". + priority. Default to regular. Known values are: "Low", "Regular". Default value: "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_01_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy - for low priority virtual machine scale set. Default to Delete. Possible values include: - "Delete", "Deallocate". Default value: "Delete". + for low priority virtual machine scale set. Default to Delete. Known values are: "Delete", + "Deallocate". Default value: "Delete". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_01_01.models.ScaleSetEvictionPolicy :ivar tags: A set of tags. Agent pool tags to be persisted on the agent pool virtual machine @@ -195,20 +196,20 @@ def __init__( self, *, count: Optional[int] = None, - vm_size: Optional[Union[str, "ContainerServiceVMSizeTypes"]] = None, + vm_size: Optional[Union[str, "_models.ContainerServiceVMSizeTypes"]] = None, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - type_properties_type: Optional[Union[str, "AgentPoolType"]] = None, + type_properties_type: Optional[Union[str, "_models.AgentPoolType"]] = None, orchestrator_version: Optional[str] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, - scale_set_priority: Optional[Union[str, "ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -218,7 +219,7 @@ def __init__( :keyword count: Number of agents (VMs) 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: Size of agent VMs. Possible values include: "Standard_A1", "Standard_A10", + :keyword vm_size: Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -267,7 +268,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2020_01_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -275,8 +276,8 @@ def __init__( :paramtype min_count: int :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool - :keyword type_properties_type: AgentPoolType represents types of an agent pool. Possible values - include: "VirtualMachineScaleSets", "AvailabilitySet". + :keyword type_properties_type: AgentPoolType represents types of an agent pool. Known values + are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type_properties_type: str or ~azure.mgmt.containerservice.v2020_01_01.models.AgentPoolType :keyword orchestrator_version: Version of orchestrator specified when creating the managed @@ -288,12 +289,11 @@ def __init__( :keyword enable_node_public_ip: Enable public IP for nodes. :paramtype enable_node_public_ip: bool :keyword scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Possible values include: "Low", "Regular". Default value: - "Regular". + priority. Default to regular. Known values are: "Low", "Regular". Default value: "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_01_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction - policy for low priority virtual machine scale set. Default to Delete. Possible values include: + policy for low priority virtual machine scale set. Default to Delete. Known values are: "Delete", "Deallocate". Default value: "Delete". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_01_01.models.ScaleSetEvictionPolicy @@ -360,7 +360,7 @@ class AgentPoolAvailableVersions(msrest.serialization.Model): def __init__( self, *, - agent_pool_versions: Optional[List["AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem"]] = None, + agent_pool_versions: Optional[List["_models.AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem"]] = None, **kwargs ): """ @@ -437,7 +437,7 @@ class AgentPoolListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["AgentPool"]] = None, + value: Optional[List["_models.AgentPool"]] = None, **kwargs ): """ @@ -465,7 +465,7 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): :ivar kubernetes_version: Required. Kubernetes version (major, minor, patch). :vartype kubernetes_version: str :ivar os_type: Required. OsType to be used to specify os type. Choose from Linux and Windows. - Default to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2020_01_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -493,15 +493,15 @@ def __init__( self, *, kubernetes_version: str, - os_type: Union[str, "OSType"] = "Linux", - upgrades: Optional[List["AgentPoolUpgradeProfilePropertiesUpgradesItem"]] = None, + os_type: Union[str, "_models.OSType"] = "Linux", + upgrades: Optional[List["_models.AgentPoolUpgradeProfilePropertiesUpgradesItem"]] = None, **kwargs ): """ :keyword kubernetes_version: Required. Kubernetes version (major, minor, patch). :paramtype kubernetes_version: str :keyword os_type: Required. OsType to be used to specify os type. Choose from Linux and - Windows. Default to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Windows. Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2020_01_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: @@ -577,7 +577,7 @@ def __init__( code: Optional[str] = None, message: Optional[str] = None, target: Optional[str] = None, - details: Optional[List["CloudErrorBody"]] = None, + details: Optional[List["_models.CloudErrorBody"]] = None, **kwargs ): """ @@ -621,7 +621,7 @@ class ContainerServiceDiagnosticsProfile(msrest.serialization.Model): def __init__( self, *, - vm_diagnostics: "ContainerServiceVMDiagnostics", + vm_diagnostics: "_models.ContainerServiceVMDiagnostics", **kwargs ): """ @@ -658,7 +658,7 @@ def __init__( self, *, admin_username: str, - ssh: "ContainerServiceSshConfiguration", + ssh: "_models.ContainerServiceSshConfiguration", **kwargs ): """ @@ -681,17 +681,17 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar count: Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, - and 5. The default value is 1. Possible values include: 1, 3, 5. Default value: "1". + and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". :vartype count: int or ~azure.mgmt.containerservice.v2020_01_01.models.Count :ivar dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. :vartype dns_prefix: str - :ivar vm_size: Required. Size of agent VMs. Possible values include: "Standard_A1", - "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", - "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", - "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", - "Standard_A8m_v2", "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", - "Standard_B8ms", "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", - "Standard_D12", "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", + :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", + "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", + "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", + "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", "Standard_B8ms", + "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", "Standard_D12", + "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", "Standard_D13_v2_Promo", "Standard_D14", "Standard_D14_v2", "Standard_D14_v2_Promo", "Standard_D15_v2", "Standard_D16_v3", "Standard_D16s_v3", "Standard_D1_v2", "Standard_D2", "Standard_D2_v2", "Standard_D2_v2_Promo", "Standard_D2_v3", "Standard_D2s_v3", "Standard_D3", @@ -736,7 +736,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): :vartype first_consecutive_static_ip: str :ivar storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Possible values include: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". :vartype storage_profile: str or ~azure.mgmt.containerservice.v2020_01_01.models.ContainerServiceStorageProfileTypes :ivar fqdn: FQDN for the master pool. @@ -765,27 +765,27 @@ def __init__( self, *, dns_prefix: str, - vm_size: Union[str, "ContainerServiceVMSizeTypes"], - count: Optional[Union[int, "Count"]] = 1, + vm_size: Union[str, "_models.ContainerServiceVMSizeTypes"], + count: Optional[Union[int, "_models.Count"]] = 1, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, first_consecutive_static_ip: Optional[str] = "10.240.255.5", - storage_profile: Optional[Union[str, "ContainerServiceStorageProfileTypes"]] = None, + storage_profile: Optional[Union[str, "_models.ContainerServiceStorageProfileTypes"]] = None, **kwargs ): """ :keyword count: Number of masters (VMs) in the container service cluster. Allowed values are 1, - 3, and 5. The default value is 1. Possible values include: 1, 3, 5. Default value: "1". + 3, and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". :paramtype count: int or ~azure.mgmt.containerservice.v2020_01_01.models.Count :keyword dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. :paramtype dns_prefix: str - :keyword vm_size: Required. Size of agent VMs. Possible values include: "Standard_A1", - "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", - "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", - "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", - "Standard_A8m_v2", "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", - "Standard_B8ms", "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", - "Standard_D12", "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", + :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", + "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", + "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", + "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", "Standard_B8ms", + "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", "Standard_D12", + "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", "Standard_D13_v2_Promo", "Standard_D14", "Standard_D14_v2", "Standard_D14_v2_Promo", "Standard_D15_v2", "Standard_D16_v3", "Standard_D16s_v3", "Standard_D1_v2", "Standard_D2", "Standard_D2_v2", "Standard_D2_v2_Promo", "Standard_D2_v3", "Standard_D2s_v3", "Standard_D3", @@ -830,7 +830,7 @@ def __init__( :paramtype first_consecutive_static_ip: str :keyword storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Possible values include: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". :paramtype storage_profile: str or ~azure.mgmt.containerservice.v2020_01_01.models.ContainerServiceStorageProfileTypes """ @@ -848,11 +848,11 @@ def __init__( class ContainerServiceNetworkProfile(msrest.serialization.Model): """Profile of network configuration. - :ivar network_plugin: Network plugin used for building Kubernetes network. Possible values - include: "azure", "kubenet". Default value: "kubenet". + :ivar network_plugin: Network plugin used for building Kubernetes network. Known values are: + "azure", "kubenet". Default value: "kubenet". :vartype network_plugin: str or ~azure.mgmt.containerservice.v2020_01_01.models.NetworkPlugin - :ivar network_policy: Network policy used for building Kubernetes network. Possible values - include: "calico", "azure". + :ivar network_policy: Network policy used for building Kubernetes network. Known values are: + "calico", "azure". :vartype network_policy: str or ~azure.mgmt.containerservice.v2020_01_01.models.NetworkPolicy :ivar pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :vartype pod_cidr: str @@ -865,11 +865,11 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): :ivar docker_bridge_cidr: A CIDR notation IP range assigned to the Docker bridge network. It must not overlap with any Subnet IP ranges or the Kubernetes service address range. :vartype docker_bridge_cidr: str - :ivar outbound_type: The outbound (egress) routing method. Possible values include: - "loadBalancer", "userDefinedRouting". Default value: "loadBalancer". + :ivar outbound_type: The outbound (egress) routing method. Known values are: "loadBalancer", + "userDefinedRouting". Default value: "loadBalancer". :vartype outbound_type: str or ~azure.mgmt.containerservice.v2020_01_01.models.OutboundType - :ivar load_balancer_sku: The load balancer sku for the managed cluster. Possible values - include: "standard", "basic". + :ivar load_balancer_sku: The load balancer sku for the managed cluster. Known values are: + "standard", "basic". :vartype load_balancer_sku: str or ~azure.mgmt.containerservice.v2020_01_01.models.LoadBalancerSku :ivar load_balancer_profile: Profile of the cluster load balancer. @@ -899,23 +899,23 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): def __init__( self, *, - network_plugin: Optional[Union[str, "NetworkPlugin"]] = "kubenet", - network_policy: Optional[Union[str, "NetworkPolicy"]] = None, + network_plugin: Optional[Union[str, "_models.NetworkPlugin"]] = "kubenet", + network_policy: Optional[Union[str, "_models.NetworkPolicy"]] = None, pod_cidr: Optional[str] = "10.244.0.0/16", service_cidr: Optional[str] = "10.0.0.0/16", dns_service_ip: Optional[str] = "10.0.0.10", docker_bridge_cidr: Optional[str] = "172.17.0.1/16", - outbound_type: Optional[Union[str, "OutboundType"]] = "loadBalancer", - load_balancer_sku: Optional[Union[str, "LoadBalancerSku"]] = None, - load_balancer_profile: Optional["ManagedClusterLoadBalancerProfile"] = None, + outbound_type: Optional[Union[str, "_models.OutboundType"]] = "loadBalancer", + load_balancer_sku: Optional[Union[str, "_models.LoadBalancerSku"]] = None, + load_balancer_profile: Optional["_models.ManagedClusterLoadBalancerProfile"] = None, **kwargs ): """ - :keyword network_plugin: Network plugin used for building Kubernetes network. Possible values - include: "azure", "kubenet". Default value: "kubenet". + :keyword network_plugin: Network plugin used for building Kubernetes network. Known values are: + "azure", "kubenet". Default value: "kubenet". :paramtype network_plugin: str or ~azure.mgmt.containerservice.v2020_01_01.models.NetworkPlugin - :keyword network_policy: Network policy used for building Kubernetes network. Possible values - include: "calico", "azure". + :keyword network_policy: Network policy used for building Kubernetes network. Known values are: + "calico", "azure". :paramtype network_policy: str or ~azure.mgmt.containerservice.v2020_01_01.models.NetworkPolicy :keyword pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :paramtype pod_cidr: str @@ -928,11 +928,11 @@ def __init__( :keyword docker_bridge_cidr: A CIDR notation IP range assigned to the Docker bridge network. It must not overlap with any Subnet IP ranges or the Kubernetes service address range. :paramtype docker_bridge_cidr: str - :keyword outbound_type: The outbound (egress) routing method. Possible values include: - "loadBalancer", "userDefinedRouting". Default value: "loadBalancer". + :keyword outbound_type: The outbound (egress) routing method. Known values are: "loadBalancer", + "userDefinedRouting". Default value: "loadBalancer". :paramtype outbound_type: str or ~azure.mgmt.containerservice.v2020_01_01.models.OutboundType - :keyword load_balancer_sku: The load balancer sku for the managed cluster. Possible values - include: "standard", "basic". + :keyword load_balancer_sku: The load balancer sku for the managed cluster. Known values are: + "standard", "basic". :paramtype load_balancer_sku: str or ~azure.mgmt.containerservice.v2020_01_01.models.LoadBalancerSku :keyword load_balancer_profile: Profile of the cluster load balancer. @@ -973,7 +973,7 @@ class ContainerServiceSshConfiguration(msrest.serialization.Model): def __init__( self, *, - public_keys: List["ContainerServiceSshPublicKey"], + public_keys: List["_models.ContainerServiceSshPublicKey"], **kwargs ): """ @@ -1287,22 +1287,22 @@ def __init__( *, location: str, tags: Optional[Dict[str, str]] = None, - identity: Optional["ManagedClusterIdentity"] = None, + identity: Optional["_models.ManagedClusterIdentity"] = None, kubernetes_version: Optional[str] = None, dns_prefix: Optional[str] = None, - agent_pool_profiles: Optional[List["ManagedClusterAgentPoolProfile"]] = None, - linux_profile: Optional["ContainerServiceLinuxProfile"] = None, - windows_profile: Optional["ManagedClusterWindowsProfile"] = None, - service_principal_profile: Optional["ManagedClusterServicePrincipalProfile"] = None, - addon_profiles: Optional[Dict[str, "ManagedClusterAddonProfile"]] = None, + agent_pool_profiles: Optional[List["_models.ManagedClusterAgentPoolProfile"]] = None, + linux_profile: Optional["_models.ContainerServiceLinuxProfile"] = None, + windows_profile: Optional["_models.ManagedClusterWindowsProfile"] = None, + service_principal_profile: Optional["_models.ManagedClusterServicePrincipalProfile"] = None, + addon_profiles: Optional[Dict[str, "_models.ManagedClusterAddonProfile"]] = None, node_resource_group: Optional[str] = None, enable_rbac: Optional[bool] = None, enable_pod_security_policy: Optional[bool] = None, - network_profile: Optional["ContainerServiceNetworkProfile"] = None, - aad_profile: Optional["ManagedClusterAADProfile"] = None, - api_server_access_profile: Optional["ManagedClusterAPIServerAccessProfile"] = None, + network_profile: Optional["_models.ContainerServiceNetworkProfile"] = None, + aad_profile: Optional["_models.ManagedClusterAADProfile"] = None, + api_server_access_profile: Optional["_models.ManagedClusterAPIServerAccessProfile"] = None, disk_encryption_set_id: Optional[str] = None, - identity_profile: Optional[Dict[str, "ManagedClusterPropertiesIdentityProfileValue"]] = None, + identity_profile: Optional[Dict[str, "_models.ManagedClusterPropertiesIdentityProfileValue"]] = None, **kwargs ): """ @@ -1620,7 +1620,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar count: Number of agents (VMs) 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: Size of agent VMs. Possible values include: "Standard_A1", "Standard_A10", + :ivar vm_size: Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -1669,7 +1669,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2020_01_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -1677,7 +1677,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :vartype min_count: int :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool - :ivar type: AgentPoolType represents types of an agent pool. Possible values include: + :ivar type: AgentPoolType represents types of an agent pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2020_01_01.models.AgentPoolType :ivar orchestrator_version: Version of orchestrator specified when creating the managed @@ -1692,13 +1692,12 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar enable_node_public_ip: Enable public IP for nodes. :vartype enable_node_public_ip: bool :ivar scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Possible values include: "Low", "Regular". Default value: - "Regular". + priority. Default to regular. Known values are: "Low", "Regular". Default value: "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_01_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy - for low priority virtual machine scale set. Default to Delete. Possible values include: - "Delete", "Deallocate". Default value: "Delete". + for low priority virtual machine scale set. Default to Delete. Known values are: "Delete", + "Deallocate". Default value: "Delete". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_01_01.models.ScaleSetEvictionPolicy :ivar tags: A set of tags. Agent pool tags to be persisted on the agent pool virtual machine @@ -1742,20 +1741,20 @@ def __init__( self, *, count: Optional[int] = None, - vm_size: Optional[Union[str, "ContainerServiceVMSizeTypes"]] = None, + vm_size: Optional[Union[str, "_models.ContainerServiceVMSizeTypes"]] = None, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - type: Optional[Union[str, "AgentPoolType"]] = None, + type: Optional[Union[str, "_models.AgentPoolType"]] = None, orchestrator_version: Optional[str] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, - scale_set_priority: Optional[Union[str, "ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -1765,7 +1764,7 @@ def __init__( :keyword count: Number of agents (VMs) 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: Size of agent VMs. Possible values include: "Standard_A1", "Standard_A10", + :keyword vm_size: Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -1814,7 +1813,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2020_01_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -1822,7 +1821,7 @@ def __init__( :paramtype min_count: int :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool - :keyword type: AgentPoolType represents types of an agent pool. Possible values include: + :keyword type: AgentPoolType represents types of an agent pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2020_01_01.models.AgentPoolType :keyword orchestrator_version: Version of orchestrator specified when creating the managed @@ -1834,12 +1833,11 @@ def __init__( :keyword enable_node_public_ip: Enable public IP for nodes. :paramtype enable_node_public_ip: bool :keyword scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Possible values include: "Low", "Regular". Default value: - "Regular". + priority. Default to regular. Known values are: "Low", "Regular". Default value: "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_01_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction - policy for low priority virtual machine scale set. Default to Delete. Possible values include: + policy for low priority virtual machine scale set. Default to Delete. Known values are: "Delete", "Deallocate". Default value: "Delete". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_01_01.models.ScaleSetEvictionPolicy @@ -1884,7 +1882,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar count: Number of agents (VMs) 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: Size of agent VMs. Possible values include: "Standard_A1", "Standard_A10", + :ivar vm_size: Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -1933,7 +1931,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2020_01_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -1941,7 +1939,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :vartype min_count: int :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool - :ivar type: AgentPoolType represents types of an agent pool. Possible values include: + :ivar type: AgentPoolType represents types of an agent pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2020_01_01.models.AgentPoolType :ivar orchestrator_version: Version of orchestrator specified when creating the managed @@ -1956,13 +1954,12 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar enable_node_public_ip: Enable public IP for nodes. :vartype enable_node_public_ip: bool :ivar scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Possible values include: "Low", "Regular". Default value: - "Regular". + priority. Default to regular. Known values are: "Low", "Regular". Default value: "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_01_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy - for low priority virtual machine scale set. Default to Delete. Possible values include: - "Delete", "Deallocate". Default value: "Delete". + for low priority virtual machine scale set. Default to Delete. Known values are: "Delete", + "Deallocate". Default value: "Delete". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_01_01.models.ScaleSetEvictionPolicy :ivar tags: A set of tags. Agent pool tags to be persisted on the agent pool virtual machine @@ -2012,20 +2009,20 @@ def __init__( *, name: str, count: Optional[int] = None, - vm_size: Optional[Union[str, "ContainerServiceVMSizeTypes"]] = None, + vm_size: Optional[Union[str, "_models.ContainerServiceVMSizeTypes"]] = None, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - type: Optional[Union[str, "AgentPoolType"]] = None, + type: Optional[Union[str, "_models.AgentPoolType"]] = None, orchestrator_version: Optional[str] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, - scale_set_priority: Optional[Union[str, "ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, @@ -2035,7 +2032,7 @@ def __init__( :keyword count: Number of agents (VMs) 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: Size of agent VMs. Possible values include: "Standard_A1", "Standard_A10", + :keyword vm_size: Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -2084,7 +2081,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2020_01_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -2092,7 +2089,7 @@ def __init__( :paramtype min_count: int :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool - :keyword type: AgentPoolType represents types of an agent pool. Possible values include: + :keyword type: AgentPoolType represents types of an agent pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2020_01_01.models.AgentPoolType :keyword orchestrator_version: Version of orchestrator specified when creating the managed @@ -2104,12 +2101,11 @@ def __init__( :keyword enable_node_public_ip: Enable public IP for nodes. :paramtype enable_node_public_ip: bool :keyword scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Possible values include: "Low", "Regular". Default value: - "Regular". + priority. Default to regular. Known values are: "Low", "Regular". Default value: "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_01_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction - policy for low priority virtual machine scale set. Default to Delete. Possible values include: + policy for low priority virtual machine scale set. Default to Delete. Known values are: "Delete", "Deallocate". Default value: "Delete". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_01_01.models.ScaleSetEvictionPolicy @@ -2175,7 +2171,7 @@ class ManagedClusterIdentity(msrest.serialization.Model): :ivar type: The type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ resource group in agent nodes. Type 'None' will not use MSI for the managed cluster, - service principal will be used instead. Possible values include: "SystemAssigned", "None". + service principal will be used instead. Known values are: "SystemAssigned", "None". :vartype type: str or ~azure.mgmt.containerservice.v2020_01_01.models.ResourceIdentityType """ @@ -2193,15 +2189,14 @@ class ManagedClusterIdentity(msrest.serialization.Model): def __init__( self, *, - type: Optional[Union[str, "ResourceIdentityType"]] = None, + type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, **kwargs ): """ :keyword type: The type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ resource group in agent nodes. Type 'None' will not use MSI for the managed - cluster, service principal will be used instead. Possible values include: "SystemAssigned", - "None". + cluster, service principal will be used instead. Known values are: "SystemAssigned", "None". :paramtype type: str or ~azure.mgmt.containerservice.v2020_01_01.models.ResourceIdentityType """ super(ManagedClusterIdentity, self).__init__(**kwargs) @@ -2233,7 +2228,7 @@ class ManagedClusterListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["ManagedCluster"]] = None, + value: Optional[List["_models.ManagedCluster"]] = None, **kwargs ): """ @@ -2287,10 +2282,10 @@ class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): def __init__( self, *, - managed_outbound_i_ps: Optional["ManagedClusterLoadBalancerProfileManagedOutboundIPs"] = None, - outbound_ip_prefixes: Optional["ManagedClusterLoadBalancerProfileOutboundIPPrefixes"] = None, - outbound_i_ps: Optional["ManagedClusterLoadBalancerProfileOutboundIPs"] = None, - effective_outbound_i_ps: Optional[List["ResourceReference"]] = None, + managed_outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileManagedOutboundIPs"] = None, + outbound_ip_prefixes: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPPrefixes"] = None, + outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPs"] = None, + effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, allocated_outbound_ports: Optional[int] = 0, idle_timeout_in_minutes: Optional[int] = 30, **kwargs @@ -2373,7 +2368,7 @@ class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.M def __init__( self, *, - public_ip_prefixes: Optional[List["ResourceReference"]] = None, + public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, **kwargs ): """ @@ -2399,7 +2394,7 @@ class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): def __init__( self, *, - public_i_ps: Optional[List["ResourceReference"]] = None, + public_i_ps: Optional[List["_models.ResourceReference"]] = None, **kwargs ): """ @@ -2420,7 +2415,7 @@ class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): :ivar name: Pool name. :vartype name: str :ivar os_type: Required. OsType to be used to specify os type. Choose from Linux and Windows. - Default to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2020_01_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -2443,9 +2438,9 @@ def __init__( self, *, kubernetes_version: str, - os_type: Union[str, "OSType"] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", name: Optional[str] = None, - upgrades: Optional[List["ManagedClusterPoolUpgradeProfileUpgradesItem"]] = None, + upgrades: Optional[List["_models.ManagedClusterPoolUpgradeProfileUpgradesItem"]] = None, **kwargs ): """ @@ -2454,7 +2449,7 @@ def __init__( :keyword name: Pool name. :paramtype name: str :keyword os_type: Required. OsType to be used to specify os type. Choose from Linux and - Windows. Default to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Windows. Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2020_01_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: @@ -2614,8 +2609,8 @@ class ManagedClusterUpgradeProfile(msrest.serialization.Model): def __init__( self, *, - control_plane_profile: "ManagedClusterPoolUpgradeProfile", - agent_pool_profiles: List["ManagedClusterPoolUpgradeProfile"], + control_plane_profile: "_models.ManagedClusterPoolUpgradeProfile", + agent_pool_profiles: List["_models.ManagedClusterPoolUpgradeProfile"], **kwargs ): """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/models/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/models/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/operations/__init__.py index 5aac40228eec..403c0174f052 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/operations/__init__.py @@ -10,8 +10,13 @@ from ._managed_clusters_operations import ManagedClustersOperations from ._agent_pools_operations import AgentPoolsOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'Operations', 'ManagedClustersOperations', 'AgentPoolsOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/operations/_agent_pools_operations.py index 04549cc0f748..10adc78a0b23 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/operations/_agent_pools_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -35,9 +35,12 @@ def build_list_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-01-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools") # pylint: disable=line-too-long path_format_arguments = { @@ -49,18 +52,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -72,9 +73,12 @@ def build_get_request( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-01-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -87,18 +91,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -109,14 +111,17 @@ def build_create_or_update_request_initial( resource_name: str, agent_pool_name: str, *, - json: JSONType = None, + json: Optional[_models.AgentPool] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-01-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -129,20 +134,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -156,9 +159,12 @@ def build_delete_request_initial( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-01-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -171,18 +177,16 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -194,9 +198,12 @@ def build_get_upgrade_profile_request( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-01-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default") # pylint: disable=line-too-long path_format_arguments = { @@ -209,18 +216,16 @@ def build_get_upgrade_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -231,9 +236,12 @@ def build_get_available_agent_pool_versions_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-01-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions") # pylint: disable=line-too-long path_format_arguments = { @@ -245,42 +253,38 @@ def build_get_available_agent_pool_versions_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class AgentPoolsOperations(object): - """AgentPoolsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class AgentPoolsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2020_01_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2020_01_01.ContainerServiceClient`'s + :attr:`agent_pools` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -288,7 +292,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Iterable["_models.AgentPoolListResult"]: + ) -> Iterable[_models.AgentPoolListResult]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. The operation returns properties @@ -304,13 +308,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_01_01.models.AgentPoolListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-01-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -320,9 +327,11 @@ def prepare_request(next_link=None): resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -332,9 +341,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -374,7 +385,7 @@ def get( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPool": + ) -> _models.AgentPool: """Gets the agent pool. Gets the details of the agent pool by managed cluster and resource group. @@ -390,13 +401,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2020_01_01.models.AgentPool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-01-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] request = build_get_request( @@ -406,11 +420,13 @@ def get( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -436,17 +452,20 @@ def _create_or_update_initial( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> "_models.AgentPool": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] + ) -> _models.AgentPool: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-01-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] _json = self._serialize.body(parameters, 'AgentPool') @@ -459,11 +478,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -494,9 +515,9 @@ def begin_create_or_update( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> LROPoller["_models.AgentPool"]: + ) -> LROPoller[_models.AgentPool]: """Creates or updates an agent pool. Creates or updates an agent pool in the specified managed cluster. @@ -522,17 +543,20 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_01_01.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-01-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, @@ -540,20 +564,27 @@ def begin_create_or_update( 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): - response = pipeline_response.http_response deserialized = self._deserialize('AgentPool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -573,13 +604,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements agent_pool_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-01-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -589,11 +623,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -640,21 +676,26 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-01-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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) @@ -664,8 +705,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -685,7 +732,7 @@ def get_upgrade_profile( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPoolUpgradeProfile": + ) -> _models.AgentPoolUpgradeProfile: """Gets upgrade profile for an agent pool. Gets the details of the upgrade profile for an agent pool with a specified resource group and @@ -702,13 +749,16 @@ def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2020_01_01.models.AgentPoolUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-01-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] request = build_get_upgrade_profile_request( @@ -718,11 +768,13 @@ def get_upgrade_profile( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -749,7 +801,7 @@ def get_available_agent_pool_versions( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.AgentPoolAvailableVersions": + ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported versions for the specified agent pool. Gets a list of supported versions for the specified agent pool. @@ -763,13 +815,16 @@ def get_available_agent_pool_versions( :rtype: ~azure.mgmt.containerservice.v2020_01_01.models.AgentPoolAvailableVersions :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolAvailableVersions"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-01-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] request = build_get_available_agent_pool_versions_request( @@ -778,11 +833,13 @@ def get_available_agent_pool_versions( resource_name=resource_name, api_version=api_version, template_url=self.get_available_agent_pool_versions.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/operations/_managed_clusters_operations.py index 82cd21ab8000..02861423438a 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/operations/_managed_clusters_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -33,9 +33,12 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-01-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters") path_format_arguments = { @@ -45,18 +48,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -66,9 +67,12 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-01-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters") # pylint: disable=line-too-long path_format_arguments = { @@ -79,18 +83,16 @@ def build_list_by_resource_group_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -101,9 +103,12 @@ def build_get_upgrade_profile_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-01-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default") # pylint: disable=line-too-long path_format_arguments = { @@ -115,18 +120,16 @@ def build_get_upgrade_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -138,9 +141,12 @@ def build_get_access_profile_request( role_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-01-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -153,18 +159,16 @@ def build_get_access_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -175,9 +179,12 @@ def build_list_cluster_admin_credentials_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-01-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -189,18 +196,16 @@ def build_list_cluster_admin_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -211,9 +216,12 @@ def build_list_cluster_user_credentials_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-01-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -225,18 +233,16 @@ def build_list_cluster_user_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -247,9 +253,12 @@ def build_list_cluster_monitoring_user_credentials_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-01-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -261,18 +270,16 @@ def build_list_cluster_monitoring_user_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -283,9 +290,12 @@ def build_get_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-01-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -297,18 +307,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -318,14 +326,17 @@ def build_create_or_update_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedCluster] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-01-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -337,20 +348,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -362,14 +371,17 @@ def build_update_tags_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.TagsObject] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-01-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -381,20 +393,18 @@ def build_update_tags_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -407,9 +417,12 @@ def build_delete_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-01-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -421,18 +434,16 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -442,14 +453,17 @@ def build_reset_service_principal_profile_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedClusterServicePrincipalProfile] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-01-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile") # pylint: disable=line-too-long path_format_arguments = { @@ -461,20 +475,18 @@ def build_reset_service_principal_profile_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -486,14 +498,17 @@ def build_reset_aad_profile_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedClusterAADProfile] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-01-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile") # pylint: disable=line-too-long path_format_arguments = { @@ -505,20 +520,18 @@ def build_reset_aad_profile_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -531,9 +544,12 @@ def build_rotate_cluster_certificates_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-01-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates") # pylint: disable=line-too-long path_format_arguments = { @@ -545,48 +561,44 @@ def build_rotate_cluster_certificates_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class ManagedClustersOperations(object): - """ManagedClustersOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ManagedClustersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2020_01_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2020_01_01.ContainerServiceClient`'s + :attr:`managed_clusters` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> Iterable["_models.ManagedClusterListResult"]: + ) -> Iterable[_models.ManagedClusterListResult]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. The operation returns properties @@ -599,13 +611,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_01_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-01-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -613,9 +628,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -623,9 +640,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -663,7 +682,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.ManagedClusterListResult"]: + ) -> Iterable[_models.ManagedClusterListResult]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. The operation returns @@ -678,13 +697,16 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_01_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-01-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -693,9 +715,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -704,9 +728,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -745,7 +771,7 @@ def get_upgrade_profile( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedClusterUpgradeProfile": + ) -> _models.ManagedClusterUpgradeProfile: """Gets upgrade profile for a managed cluster. Gets the details of the upgrade profile for a managed cluster with a specified resource group @@ -760,13 +786,16 @@ def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2020_01_01.models.ManagedClusterUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-01-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] request = build_get_upgrade_profile_request( @@ -775,11 +804,13 @@ def get_upgrade_profile( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -807,7 +838,7 @@ def get_access_profile( resource_name: str, role_name: str, **kwargs: Any - ) -> "_models.ManagedClusterAccessProfile": + ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. Gets the accessProfile for the specified role name of the managed cluster with a specified @@ -824,13 +855,16 @@ def get_access_profile( :rtype: ~azure.mgmt.containerservice.v2020_01_01.models.ManagedClusterAccessProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterAccessProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-01-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] request = build_get_access_profile_request( @@ -840,11 +874,13 @@ def get_access_profile( role_name=role_name, api_version=api_version, template_url=self.get_access_profile.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -871,7 +907,7 @@ def list_cluster_admin_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster admin credential of a managed cluster. Gets cluster admin credential of the managed cluster with a specified resource group and name. @@ -885,13 +921,16 @@ def list_cluster_admin_credentials( :rtype: ~azure.mgmt.containerservice.v2020_01_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-01-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_admin_credentials_request( @@ -900,11 +939,13 @@ def list_cluster_admin_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_admin_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -931,7 +972,7 @@ def list_cluster_user_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster user credential of a managed cluster. Gets cluster user credential of the managed cluster with a specified resource group and name. @@ -945,13 +986,16 @@ def list_cluster_user_credentials( :rtype: ~azure.mgmt.containerservice.v2020_01_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-01-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_user_credentials_request( @@ -960,11 +1004,13 @@ def list_cluster_user_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -991,7 +1037,7 @@ def list_cluster_monitoring_user_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster monitoring user credential of a managed cluster. Gets cluster monitoring user credential of the managed cluster with a specified resource group @@ -1006,13 +1052,16 @@ def list_cluster_monitoring_user_credentials( :rtype: ~azure.mgmt.containerservice.v2020_01_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-01-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_monitoring_user_credentials_request( @@ -1021,11 +1070,13 @@ def list_cluster_monitoring_user_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1052,7 +1103,7 @@ def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedCluster": + ) -> _models.ManagedCluster: """Gets a managed cluster. Gets the details of the managed cluster with a specified resource group and name. @@ -1066,13 +1117,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2020_01_01.models.ManagedCluster :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-01-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] request = build_get_request( @@ -1081,11 +1135,13 @@ def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1110,17 +1166,20 @@ def _create_or_update_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2020-01-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'ManagedCluster') @@ -1132,11 +1191,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1166,9 +1227,9 @@ def begin_create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> LROPoller["_models.ManagedCluster"]: + ) -> LROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. Creates or updates a managed cluster with the specified configuration for agents and Kubernetes @@ -1194,37 +1255,47 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_01_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-01-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1241,17 +1312,20 @@ def _update_tags_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-01-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'TagsObject') @@ -1263,11 +1337,13 @@ def _update_tags_initial( content_type=content_type, json=_json, template_url=self._update_tags_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1293,9 +1369,9 @@ def begin_update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> LROPoller["_models.ManagedCluster"]: + ) -> LROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates a managed cluster with the specified tags. @@ -1320,37 +1396,47 @@ def begin_update_tags( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_01_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-01-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._update_tags_initial( + raw_result = self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1369,13 +1455,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-01-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -1384,11 +1473,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1432,20 +1523,25 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-01-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_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) @@ -1455,8 +1551,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1473,17 +1575,20 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2020-01-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') @@ -1495,11 +1600,13 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re content_type=content_type, json=_json, template_url=self._reset_service_principal_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1521,7 +1628,7 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> LROPoller[None]: """Reset Service Principal Profile of a managed cluster. @@ -1548,23 +1655,28 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-01-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._reset_service_principal_profile_initial( + raw_result = self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1574,8 +1686,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1592,17 +1710,20 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2020-01-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') @@ -1614,11 +1735,13 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement content_type=content_type, json=_json, template_url=self._reset_aad_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1640,7 +1763,7 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> LROPoller[None]: """Reset AAD Profile of a managed cluster. @@ -1666,23 +1789,28 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-01-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._reset_aad_profile_initial( + raw_result = self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1692,8 +1820,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1712,13 +1846,16 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-01-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_rotate_cluster_certificates_request_initial( @@ -1727,11 +1864,13 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return resource_name=resource_name, api_version=api_version, template_url=self._rotate_cluster_certificates_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1775,20 +1914,25 @@ def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-st :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-01-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._rotate_cluster_certificates_initial( + raw_result = self._rotate_cluster_certificates_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) @@ -1798,8 +1942,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/operations/_operations.py index da0efd645949..37be3ae467f6 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/operations/_operations.py @@ -16,6 +16,7 @@ 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 @@ -29,55 +30,54 @@ def build_list_request( **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-01-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.ContainerService/operations") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class Operations(object): - """Operations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2020_01_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2020_01_01.ContainerServiceClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> Iterable["_models.OperationListResult"]: + ) -> Iterable[_models.OperationListResult]: """Gets a list of compute operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -86,31 +86,38 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_01_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-01-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_01_01/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/__init__.py index 53c675bd95e2..37a5f9e02e6f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._container_service_client import ContainerServiceClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['ContainerServiceClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/_container_service_client.py index dff2b38e7dca..f35376cde3d3 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/_container_service_client.py @@ -60,9 +60,15 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.managed_clusters = ManagedClustersOperations(self._client, self._config, self._serialize, self._deserialize) - self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_clusters = ManagedClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.agent_pools = AgentPoolsOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/aio/__init__.py index 53c675bd95e2..37a5f9e02e6f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/aio/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/aio/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._container_service_client import ContainerServiceClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['ContainerServiceClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/aio/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/aio/_container_service_client.py index c150418861e2..7db5f15edb2d 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/aio/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/aio/_container_service_client.py @@ -61,9 +61,15 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.managed_clusters = ManagedClustersOperations(self._client, self._config, self._serialize, self._deserialize) - self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_clusters = ManagedClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.agent_pools = AgentPoolsOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/aio/operations/__init__.py index 5aac40228eec..403c0174f052 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/aio/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/aio/operations/__init__.py @@ -10,8 +10,13 @@ from ._managed_clusters_operations import ManagedClustersOperations from ._agent_pools_operations import AgentPoolsOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'Operations', 'ManagedClustersOperations', 'AgentPoolsOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/aio/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/aio/operations/_agent_pools_operations.py index c4c397b271c5..88fd6e5a069a 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/aio/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/aio/operations/_agent_pools_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. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ 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 @@ -26,26 +27,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class AgentPoolsOperations: - """AgentPoolsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2020_02_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2020_02_01.aio.ContainerServiceClient`'s + :attr:`agent_pools` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -53,7 +52,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> AsyncIterable["_models.AgentPoolListResult"]: + ) -> AsyncIterable[_models.AgentPoolListResult]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. The operation returns properties @@ -69,13 +68,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_02_01.models.AgentPoolListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -85,9 +87,11 @@ def prepare_request(next_link=None): resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -97,9 +101,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -139,7 +145,7 @@ async def get( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPool": + ) -> _models.AgentPool: """Gets the agent pool. Gets the details of the agent pool by managed cluster and resource group. @@ -155,13 +161,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2020_02_01.models.AgentPool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-02-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] request = build_get_request( @@ -171,11 +180,13 @@ async def get( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -201,17 +212,20 @@ async def _create_or_update_initial( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> "_models.AgentPool": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] + ) -> _models.AgentPool: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2020-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] _json = self._serialize.body(parameters, 'AgentPool') @@ -224,11 +238,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -259,9 +275,9 @@ async def begin_create_or_update( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> AsyncLROPoller["_models.AgentPool"]: + ) -> AsyncLROPoller[_models.AgentPool]: """Creates or updates an agent pool. Creates or updates an agent pool in the specified managed cluster. @@ -288,17 +304,20 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_02_01.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, @@ -306,20 +325,27 @@ async def begin_create_or_update( 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): - response = pipeline_response.http_response deserialized = self._deserialize('AgentPool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -339,13 +365,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements agent_pool_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-02-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -355,11 +384,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -406,21 +437,26 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-02-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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) @@ -430,8 +466,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -451,7 +493,7 @@ async def get_upgrade_profile( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPoolUpgradeProfile": + ) -> _models.AgentPoolUpgradeProfile: """Gets upgrade profile for an agent pool. Gets the details of the upgrade profile for an agent pool with a specified resource group and @@ -468,13 +510,16 @@ async def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2020_02_01.models.AgentPoolUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] request = build_get_upgrade_profile_request( @@ -484,11 +529,13 @@ async def get_upgrade_profile( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -515,7 +562,7 @@ async def get_available_agent_pool_versions( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.AgentPoolAvailableVersions": + ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported versions for the specified agent pool. Gets a list of supported versions for the specified agent pool. @@ -529,13 +576,16 @@ async def get_available_agent_pool_versions( :rtype: ~azure.mgmt.containerservice.v2020_02_01.models.AgentPoolAvailableVersions :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolAvailableVersions"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-02-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] request = build_get_available_agent_pool_versions_request( @@ -544,11 +594,13 @@ async def get_available_agent_pool_versions( resource_name=resource_name, api_version=api_version, template_url=self.get_available_agent_pool_versions.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/aio/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/aio/operations/_managed_clusters_operations.py index e8e238d828dd..2ff63228fb1f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/aio/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/aio/operations/_managed_clusters_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. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ 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 @@ -26,32 +27,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ManagedClustersOperations: - """ManagedClustersOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2020_02_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2020_02_01.aio.ContainerServiceClient`'s + :attr:`managed_clusters` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.ManagedClusterListResult"]: + ) -> AsyncIterable[_models.ManagedClusterListResult]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. The operation returns properties @@ -64,13 +63,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_02_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -78,9 +80,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -88,9 +92,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -128,7 +134,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ManagedClusterListResult"]: + ) -> AsyncIterable[_models.ManagedClusterListResult]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. The operation returns @@ -143,13 +149,16 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_02_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -158,9 +167,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -169,9 +180,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -210,7 +223,7 @@ async def get_upgrade_profile( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedClusterUpgradeProfile": + ) -> _models.ManagedClusterUpgradeProfile: """Gets upgrade profile for a managed cluster. Gets the details of the upgrade profile for a managed cluster with a specified resource group @@ -225,13 +238,16 @@ async def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2020_02_01.models.ManagedClusterUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-02-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] request = build_get_upgrade_profile_request( @@ -240,11 +256,13 @@ async def get_upgrade_profile( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -272,7 +290,7 @@ async def get_access_profile( resource_name: str, role_name: str, **kwargs: Any - ) -> "_models.ManagedClusterAccessProfile": + ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. Gets the accessProfile for the specified role name of the managed cluster with a specified @@ -289,13 +307,16 @@ async def get_access_profile( :rtype: ~azure.mgmt.containerservice.v2020_02_01.models.ManagedClusterAccessProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterAccessProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] request = build_get_access_profile_request( @@ -305,11 +326,13 @@ async def get_access_profile( role_name=role_name, api_version=api_version, template_url=self.get_access_profile.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -336,7 +359,7 @@ async def list_cluster_admin_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster admin credential of a managed cluster. Gets cluster admin credential of the managed cluster with a specified resource group and name. @@ -350,13 +373,16 @@ async def list_cluster_admin_credentials( :rtype: ~azure.mgmt.containerservice.v2020_02_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-02-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_admin_credentials_request( @@ -365,11 +391,13 @@ async def list_cluster_admin_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_admin_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -396,7 +424,7 @@ async def list_cluster_user_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster user credential of a managed cluster. Gets cluster user credential of the managed cluster with a specified resource group and name. @@ -410,13 +438,16 @@ async def list_cluster_user_credentials( :rtype: ~azure.mgmt.containerservice.v2020_02_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_user_credentials_request( @@ -425,11 +456,13 @@ async def list_cluster_user_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -456,7 +489,7 @@ async def list_cluster_monitoring_user_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster monitoring user credential of a managed cluster. Gets cluster monitoring user credential of the managed cluster with a specified resource group @@ -471,13 +504,16 @@ async def list_cluster_monitoring_user_credentials( :rtype: ~azure.mgmt.containerservice.v2020_02_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-02-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_monitoring_user_credentials_request( @@ -486,11 +522,13 @@ async def list_cluster_monitoring_user_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -517,7 +555,7 @@ async def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedCluster": + ) -> _models.ManagedCluster: """Gets a managed cluster. Gets the details of the managed cluster with a specified resource group and name. @@ -531,13 +569,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2020_02_01.models.ManagedCluster :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] request = build_get_request( @@ -546,11 +587,13 @@ async def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -575,17 +618,20 @@ async def _create_or_update_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2020-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'ManagedCluster') @@ -597,11 +643,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -631,9 +679,9 @@ async def begin_create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> AsyncLROPoller["_models.ManagedCluster"]: + ) -> AsyncLROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. Creates or updates a managed cluster with the specified configuration for agents and Kubernetes @@ -659,37 +707,47 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_02_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -706,17 +764,20 @@ async def _update_tags_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'TagsObject') @@ -728,11 +789,13 @@ async def _update_tags_initial( content_type=content_type, json=_json, template_url=self._update_tags_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -758,9 +821,9 @@ async def begin_update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> AsyncLROPoller["_models.ManagedCluster"]: + ) -> AsyncLROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates a managed cluster with the specified tags. @@ -785,37 +848,47 @@ async def begin_update_tags( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_02_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._update_tags_initial( + raw_result = await self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -834,13 +907,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-02-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -849,11 +925,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -897,20 +975,25 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-02-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_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) @@ -920,8 +1003,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -938,17 +1027,20 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2020-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') @@ -960,11 +1052,13 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist content_type=content_type, json=_json, template_url=self._reset_service_principal_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -986,7 +1080,7 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> AsyncLROPoller[None]: """Reset Service Principal Profile of a managed cluster. @@ -1013,23 +1107,28 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._reset_service_principal_profile_initial( + raw_result = await self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1039,8 +1138,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1057,17 +1162,20 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') @@ -1079,11 +1187,13 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta content_type=content_type, json=_json, template_url=self._reset_aad_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1105,7 +1215,7 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> AsyncLROPoller[None]: """Reset AAD Profile of a managed cluster. @@ -1131,23 +1241,28 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._reset_aad_profile_initial( + raw_result = await self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1157,8 +1272,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1177,13 +1298,16 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-02-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_rotate_cluster_certificates_request_initial( @@ -1192,11 +1316,13 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- resource_name=resource_name, api_version=api_version, template_url=self._rotate_cluster_certificates_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1240,20 +1366,25 @@ async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-ret :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-02-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._rotate_cluster_certificates_initial( + raw_result = await self._rotate_cluster_certificates_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) @@ -1263,8 +1394,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/aio/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/aio/operations/_operations.py index f1575b9ddf26..453f193b5b4a 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/aio/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/aio/operations/_operations.py @@ -14,6 +14,7 @@ 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 @@ -23,32 +24,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class Operations: - """Operations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2020_02_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2020_02_01.aio.ContainerServiceClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.OperationListResult"]: + ) -> AsyncIterable[_models.OperationListResult]: """Gets a list of compute operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -57,31 +56,38 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_02_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/aio/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/aio/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/models/__init__.py index 776ffc5504ca..d27b03c32a54 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/models/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/models/__init__.py @@ -67,7 +67,9 @@ ScaleSetEvictionPolicy, ScaleSetPriority, ) - +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'AgentPool', 'AgentPoolAvailableVersions', @@ -127,3 +129,5 @@ 'ScaleSetEvictionPolicy', 'ScaleSetPriority', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/models/_container_service_client_enums.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/models/_container_service_client_enums.py index 10d3817c531a..c85b3fdbf115 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/models/_container_service_client_enums.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/models/_container_service_client_enums.py @@ -7,18 +7,17 @@ # -------------------------------------------------------------------------- from enum import Enum -from six import with_metaclass from azure.core import CaseInsensitiveEnumMeta -class AgentPoolType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class AgentPoolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """AgentPoolType represents types of an agent pool. """ VIRTUAL_MACHINE_SCALE_SETS = "VirtualMachineScaleSets" AVAILABILITY_SET = "AvailabilitySet" -class ContainerServiceStorageProfileTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the orchestrator choice. """ @@ -26,7 +25,7 @@ class ContainerServiceStorageProfileTypes(with_metaclass(CaseInsensitiveEnumMeta STORAGE_ACCOUNT = "StorageAccount" MANAGED_DISKS = "ManagedDisks" -class ContainerServiceVMSizeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Size of agent VMs. """ @@ -205,7 +204,7 @@ class ContainerServiceVMSizeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, E STANDARD_NV24 = "Standard_NV24" STANDARD_NV6 = "Standard_NV6" -class Count(with_metaclass(CaseInsensitiveEnumMeta, int, Enum)): +class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): """Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, and 5. The default value is 1. """ @@ -214,49 +213,49 @@ class Count(with_metaclass(CaseInsensitiveEnumMeta, int, Enum)): THREE = 3 FIVE = 5 -class LoadBalancerSku(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class LoadBalancerSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The load balancer sku for the managed cluster. """ STANDARD = "standard" BASIC = "basic" -class NetworkMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Network mode used for building Kubernetes network. """ TRANSPARENT = "transparent" BRIDGE = "bridge" -class NetworkPlugin(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkPlugin(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Network plugin used for building Kubernetes network. """ AZURE = "azure" KUBENET = "kubenet" -class NetworkPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Network policy used for building Kubernetes network. """ CALICO = "calico" AZURE = "azure" -class OSType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux. """ LINUX = "Linux" WINDOWS = "Windows" -class OutboundType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OutboundType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The outbound (egress) routing method. """ LOAD_BALANCER = "loadBalancer" USER_DEFINED_ROUTING = "userDefinedRouting" -class ResourceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ resource group in agent nodes. Type 'None' will not use MSI for the managed cluster, service @@ -266,7 +265,7 @@ class ResourceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): SYSTEM_ASSIGNED = "SystemAssigned" NONE = "None" -class ScaleSetEvictionPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ScaleSetEvictionPolicy to be used to specify eviction policy for Spot or low priority virtual machine scale set. Default to Delete. """ @@ -274,7 +273,7 @@ class ScaleSetEvictionPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)) DELETE = "Delete" DEALLOCATE = "Deallocate" -class ScaleSetPriority(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ScaleSetPriority(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ScaleSetPriority to be used to specify virtual machine scale set priority. Default to regular. """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/models/_models_py3.py index ce78eb5a7c4e..bfec8a5ef9d3 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/models/_models_py3.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/models/_models_py3.py @@ -6,11 +6,13 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Dict, List, Optional, Union +from typing import Dict, List, Optional, TYPE_CHECKING, Union import msrest.serialization -from ._container_service_client_enums import * +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + import __init__ as _models class SubResource(msrest.serialization.Model): @@ -66,7 +68,7 @@ class AgentPool(SubResource): :ivar count: Number of agents (VMs) 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: Size of agent VMs. Possible values include: "Standard_A1", "Standard_A10", + :ivar vm_size: Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -115,7 +117,7 @@ class AgentPool(SubResource): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2020_02_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -123,8 +125,8 @@ class AgentPool(SubResource): :vartype min_count: int :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool - :ivar type_properties_type: AgentPoolType represents types of an agent pool. Possible values - include: "VirtualMachineScaleSets", "AvailabilitySet". + :ivar type_properties_type: AgentPoolType represents types of an agent pool. Known values are: + "VirtualMachineScaleSets", "AvailabilitySet". :vartype type_properties_type: str or ~azure.mgmt.containerservice.v2020_02_01.models.AgentPoolType :ivar orchestrator_version: Version of orchestrator specified when creating the managed @@ -139,12 +141,12 @@ class AgentPool(SubResource): :ivar enable_node_public_ip: Enable public IP for nodes. :vartype enable_node_public_ip: bool :ivar scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Possible values include: "Spot", "Low", "Regular". Default value: + priority. Default to regular. Known values are: "Spot", "Low", "Regular". Default value: "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_02_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy - for Spot or low priority virtual machine scale set. Default to Delete. Possible values include: + for Spot or low priority virtual machine scale set. Default to Delete. Known values are: "Delete", "Deallocate". Default value: "Delete". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_02_01.models.ScaleSetEvictionPolicy @@ -200,20 +202,20 @@ def __init__( self, *, count: Optional[int] = None, - vm_size: Optional[Union[str, "ContainerServiceVMSizeTypes"]] = None, + vm_size: Optional[Union[str, "_models.ContainerServiceVMSizeTypes"]] = None, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - type_properties_type: Optional[Union[str, "AgentPoolType"]] = None, + type_properties_type: Optional[Union[str, "_models.AgentPoolType"]] = None, orchestrator_version: Optional[str] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, - scale_set_priority: Optional[Union[str, "ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", spot_max_price: Optional[float] = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, @@ -224,7 +226,7 @@ def __init__( :keyword count: Number of agents (VMs) 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: Size of agent VMs. Possible values include: "Standard_A1", "Standard_A10", + :keyword vm_size: Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -273,7 +275,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2020_02_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -281,8 +283,8 @@ def __init__( :paramtype min_count: int :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool - :keyword type_properties_type: AgentPoolType represents types of an agent pool. Possible values - include: "VirtualMachineScaleSets", "AvailabilitySet". + :keyword type_properties_type: AgentPoolType represents types of an agent pool. Known values + are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type_properties_type: str or ~azure.mgmt.containerservice.v2020_02_01.models.AgentPoolType :keyword orchestrator_version: Version of orchestrator specified when creating the managed @@ -294,13 +296,13 @@ def __init__( :keyword enable_node_public_ip: Enable public IP for nodes. :paramtype enable_node_public_ip: bool :keyword scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Possible values include: "Spot", "Low", "Regular". Default value: + priority. Default to regular. Known values are: "Spot", "Low", "Regular". Default value: "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_02_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction - policy for Spot or low priority virtual machine scale set. Default to Delete. Possible values - include: "Delete", "Deallocate". Default value: "Delete". + policy for Spot or low priority virtual machine scale set. Default to Delete. Known values are: + "Delete", "Deallocate". Default value: "Delete". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_02_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: SpotMaxPrice to be used to specify the maximum price you are willing @@ -371,7 +373,7 @@ class AgentPoolAvailableVersions(msrest.serialization.Model): def __init__( self, *, - agent_pool_versions: Optional[List["AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem"]] = None, + agent_pool_versions: Optional[List["_models.AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem"]] = None, **kwargs ): """ @@ -448,7 +450,7 @@ class AgentPoolListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["AgentPool"]] = None, + value: Optional[List["_models.AgentPool"]] = None, **kwargs ): """ @@ -476,7 +478,7 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): :ivar kubernetes_version: Required. Kubernetes version (major, minor, patch). :vartype kubernetes_version: str :ivar os_type: Required. OsType to be used to specify os type. Choose from Linux and Windows. - Default to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2020_02_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -504,15 +506,15 @@ def __init__( self, *, kubernetes_version: str, - os_type: Union[str, "OSType"] = "Linux", - upgrades: Optional[List["AgentPoolUpgradeProfilePropertiesUpgradesItem"]] = None, + os_type: Union[str, "_models.OSType"] = "Linux", + upgrades: Optional[List["_models.AgentPoolUpgradeProfilePropertiesUpgradesItem"]] = None, **kwargs ): """ :keyword kubernetes_version: Required. Kubernetes version (major, minor, patch). :paramtype kubernetes_version: str :keyword os_type: Required. OsType to be used to specify os type. Choose from Linux and - Windows. Default to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Windows. Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2020_02_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: @@ -588,7 +590,7 @@ def __init__( code: Optional[str] = None, message: Optional[str] = None, target: Optional[str] = None, - details: Optional[List["CloudErrorBody"]] = None, + details: Optional[List["_models.CloudErrorBody"]] = None, **kwargs ): """ @@ -632,7 +634,7 @@ class ContainerServiceDiagnosticsProfile(msrest.serialization.Model): def __init__( self, *, - vm_diagnostics: "ContainerServiceVMDiagnostics", + vm_diagnostics: "_models.ContainerServiceVMDiagnostics", **kwargs ): """ @@ -669,7 +671,7 @@ def __init__( self, *, admin_username: str, - ssh: "ContainerServiceSshConfiguration", + ssh: "_models.ContainerServiceSshConfiguration", **kwargs ): """ @@ -692,17 +694,17 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar count: Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, - and 5. The default value is 1. Possible values include: 1, 3, 5. Default value: "1". + and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". :vartype count: int or ~azure.mgmt.containerservice.v2020_02_01.models.Count :ivar dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. :vartype dns_prefix: str - :ivar vm_size: Required. Size of agent VMs. Possible values include: "Standard_A1", - "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", - "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", - "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", - "Standard_A8m_v2", "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", - "Standard_B8ms", "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", - "Standard_D12", "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", + :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", + "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", + "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", + "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", "Standard_B8ms", + "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", "Standard_D12", + "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", "Standard_D13_v2_Promo", "Standard_D14", "Standard_D14_v2", "Standard_D14_v2_Promo", "Standard_D15_v2", "Standard_D16_v3", "Standard_D16s_v3", "Standard_D1_v2", "Standard_D2", "Standard_D2_v2", "Standard_D2_v2_Promo", "Standard_D2_v3", "Standard_D2s_v3", "Standard_D3", @@ -747,7 +749,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): :vartype first_consecutive_static_ip: str :ivar storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Possible values include: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". :vartype storage_profile: str or ~azure.mgmt.containerservice.v2020_02_01.models.ContainerServiceStorageProfileTypes :ivar fqdn: FQDN for the master pool. @@ -776,27 +778,27 @@ def __init__( self, *, dns_prefix: str, - vm_size: Union[str, "ContainerServiceVMSizeTypes"], - count: Optional[Union[int, "Count"]] = 1, + vm_size: Union[str, "_models.ContainerServiceVMSizeTypes"], + count: Optional[Union[int, "_models.Count"]] = 1, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, first_consecutive_static_ip: Optional[str] = "10.240.255.5", - storage_profile: Optional[Union[str, "ContainerServiceStorageProfileTypes"]] = None, + storage_profile: Optional[Union[str, "_models.ContainerServiceStorageProfileTypes"]] = None, **kwargs ): """ :keyword count: Number of masters (VMs) in the container service cluster. Allowed values are 1, - 3, and 5. The default value is 1. Possible values include: 1, 3, 5. Default value: "1". + 3, and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". :paramtype count: int or ~azure.mgmt.containerservice.v2020_02_01.models.Count :keyword dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. :paramtype dns_prefix: str - :keyword vm_size: Required. Size of agent VMs. Possible values include: "Standard_A1", - "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", - "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", - "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", - "Standard_A8m_v2", "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", - "Standard_B8ms", "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", - "Standard_D12", "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", + :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", + "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", + "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", + "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", "Standard_B8ms", + "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", "Standard_D12", + "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", "Standard_D13_v2_Promo", "Standard_D14", "Standard_D14_v2", "Standard_D14_v2_Promo", "Standard_D15_v2", "Standard_D16_v3", "Standard_D16s_v3", "Standard_D1_v2", "Standard_D2", "Standard_D2_v2", "Standard_D2_v2_Promo", "Standard_D2_v3", "Standard_D2s_v3", "Standard_D3", @@ -841,7 +843,7 @@ def __init__( :paramtype first_consecutive_static_ip: str :keyword storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Possible values include: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". :paramtype storage_profile: str or ~azure.mgmt.containerservice.v2020_02_01.models.ContainerServiceStorageProfileTypes """ @@ -859,13 +861,13 @@ def __init__( class ContainerServiceNetworkProfile(msrest.serialization.Model): """Profile of network configuration. - :ivar network_plugin: Network plugin used for building Kubernetes network. Possible values - include: "azure", "kubenet". Default value: "kubenet". + :ivar network_plugin: Network plugin used for building Kubernetes network. Known values are: + "azure", "kubenet". Default value: "kubenet". :vartype network_plugin: str or ~azure.mgmt.containerservice.v2020_02_01.models.NetworkPlugin - :ivar network_policy: Network policy used for building Kubernetes network. Possible values - include: "calico", "azure". + :ivar network_policy: Network policy used for building Kubernetes network. Known values are: + "calico", "azure". :vartype network_policy: str or ~azure.mgmt.containerservice.v2020_02_01.models.NetworkPolicy - :ivar network_mode: Network mode used for building Kubernetes network. Possible values include: + :ivar network_mode: Network mode used for building Kubernetes network. Known values are: "transparent", "bridge". :vartype network_mode: str or ~azure.mgmt.containerservice.v2020_02_01.models.NetworkMode :ivar pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. @@ -879,11 +881,11 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): :ivar docker_bridge_cidr: A CIDR notation IP range assigned to the Docker bridge network. It must not overlap with any Subnet IP ranges or the Kubernetes service address range. :vartype docker_bridge_cidr: str - :ivar outbound_type: The outbound (egress) routing method. Possible values include: - "loadBalancer", "userDefinedRouting". Default value: "loadBalancer". + :ivar outbound_type: The outbound (egress) routing method. Known values are: "loadBalancer", + "userDefinedRouting". Default value: "loadBalancer". :vartype outbound_type: str or ~azure.mgmt.containerservice.v2020_02_01.models.OutboundType - :ivar load_balancer_sku: The load balancer sku for the managed cluster. Possible values - include: "standard", "basic". + :ivar load_balancer_sku: The load balancer sku for the managed cluster. Known values are: + "standard", "basic". :vartype load_balancer_sku: str or ~azure.mgmt.containerservice.v2020_02_01.models.LoadBalancerSku :ivar load_balancer_profile: Profile of the cluster load balancer. @@ -914,27 +916,27 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): def __init__( self, *, - network_plugin: Optional[Union[str, "NetworkPlugin"]] = "kubenet", - network_policy: Optional[Union[str, "NetworkPolicy"]] = None, - network_mode: Optional[Union[str, "NetworkMode"]] = None, + network_plugin: Optional[Union[str, "_models.NetworkPlugin"]] = "kubenet", + network_policy: Optional[Union[str, "_models.NetworkPolicy"]] = None, + network_mode: Optional[Union[str, "_models.NetworkMode"]] = None, pod_cidr: Optional[str] = "10.244.0.0/16", service_cidr: Optional[str] = "10.0.0.0/16", dns_service_ip: Optional[str] = "10.0.0.10", docker_bridge_cidr: Optional[str] = "172.17.0.1/16", - outbound_type: Optional[Union[str, "OutboundType"]] = "loadBalancer", - load_balancer_sku: Optional[Union[str, "LoadBalancerSku"]] = None, - load_balancer_profile: Optional["ManagedClusterLoadBalancerProfile"] = None, + outbound_type: Optional[Union[str, "_models.OutboundType"]] = "loadBalancer", + load_balancer_sku: Optional[Union[str, "_models.LoadBalancerSku"]] = None, + load_balancer_profile: Optional["_models.ManagedClusterLoadBalancerProfile"] = None, **kwargs ): """ - :keyword network_plugin: Network plugin used for building Kubernetes network. Possible values - include: "azure", "kubenet". Default value: "kubenet". + :keyword network_plugin: Network plugin used for building Kubernetes network. Known values are: + "azure", "kubenet". Default value: "kubenet". :paramtype network_plugin: str or ~azure.mgmt.containerservice.v2020_02_01.models.NetworkPlugin - :keyword network_policy: Network policy used for building Kubernetes network. Possible values - include: "calico", "azure". + :keyword network_policy: Network policy used for building Kubernetes network. Known values are: + "calico", "azure". :paramtype network_policy: str or ~azure.mgmt.containerservice.v2020_02_01.models.NetworkPolicy - :keyword network_mode: Network mode used for building Kubernetes network. Possible values - include: "transparent", "bridge". + :keyword network_mode: Network mode used for building Kubernetes network. Known values are: + "transparent", "bridge". :paramtype network_mode: str or ~azure.mgmt.containerservice.v2020_02_01.models.NetworkMode :keyword pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :paramtype pod_cidr: str @@ -947,11 +949,11 @@ def __init__( :keyword docker_bridge_cidr: A CIDR notation IP range assigned to the Docker bridge network. It must not overlap with any Subnet IP ranges or the Kubernetes service address range. :paramtype docker_bridge_cidr: str - :keyword outbound_type: The outbound (egress) routing method. Possible values include: - "loadBalancer", "userDefinedRouting". Default value: "loadBalancer". + :keyword outbound_type: The outbound (egress) routing method. Known values are: "loadBalancer", + "userDefinedRouting". Default value: "loadBalancer". :paramtype outbound_type: str or ~azure.mgmt.containerservice.v2020_02_01.models.OutboundType - :keyword load_balancer_sku: The load balancer sku for the managed cluster. Possible values - include: "standard", "basic". + :keyword load_balancer_sku: The load balancer sku for the managed cluster. Known values are: + "standard", "basic". :paramtype load_balancer_sku: str or ~azure.mgmt.containerservice.v2020_02_01.models.LoadBalancerSku :keyword load_balancer_profile: Profile of the cluster load balancer. @@ -993,7 +995,7 @@ class ContainerServiceSshConfiguration(msrest.serialization.Model): def __init__( self, *, - public_keys: List["ContainerServiceSshPublicKey"], + public_keys: List["_models.ContainerServiceSshPublicKey"], **kwargs ): """ @@ -1311,23 +1313,23 @@ def __init__( *, location: str, tags: Optional[Dict[str, str]] = None, - identity: Optional["ManagedClusterIdentity"] = None, + identity: Optional["_models.ManagedClusterIdentity"] = None, kubernetes_version: Optional[str] = None, dns_prefix: Optional[str] = None, - agent_pool_profiles: Optional[List["ManagedClusterAgentPoolProfile"]] = None, - linux_profile: Optional["ContainerServiceLinuxProfile"] = None, - windows_profile: Optional["ManagedClusterWindowsProfile"] = None, - service_principal_profile: Optional["ManagedClusterServicePrincipalProfile"] = None, - addon_profiles: Optional[Dict[str, "ManagedClusterAddonProfile"]] = None, + agent_pool_profiles: Optional[List["_models.ManagedClusterAgentPoolProfile"]] = None, + linux_profile: Optional["_models.ContainerServiceLinuxProfile"] = None, + windows_profile: Optional["_models.ManagedClusterWindowsProfile"] = None, + service_principal_profile: Optional["_models.ManagedClusterServicePrincipalProfile"] = None, + addon_profiles: Optional[Dict[str, "_models.ManagedClusterAddonProfile"]] = None, node_resource_group: Optional[str] = None, enable_rbac: Optional[bool] = None, enable_pod_security_policy: Optional[bool] = None, - network_profile: Optional["ContainerServiceNetworkProfile"] = None, - aad_profile: Optional["ManagedClusterAADProfile"] = None, - auto_scaler_profile: Optional["ManagedClusterPropertiesAutoScalerProfile"] = None, - api_server_access_profile: Optional["ManagedClusterAPIServerAccessProfile"] = None, + network_profile: Optional["_models.ContainerServiceNetworkProfile"] = None, + aad_profile: Optional["_models.ManagedClusterAADProfile"] = None, + auto_scaler_profile: Optional["_models.ManagedClusterPropertiesAutoScalerProfile"] = None, + api_server_access_profile: Optional["_models.ManagedClusterAPIServerAccessProfile"] = None, disk_encryption_set_id: Optional[str] = None, - identity_profile: Optional[Dict[str, "ManagedClusterPropertiesIdentityProfileValue"]] = None, + identity_profile: Optional[Dict[str, "_models.ManagedClusterPropertiesIdentityProfileValue"]] = None, **kwargs ): """ @@ -1649,7 +1651,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar count: Number of agents (VMs) 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: Size of agent VMs. Possible values include: "Standard_A1", "Standard_A10", + :ivar vm_size: Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -1698,7 +1700,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2020_02_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -1706,7 +1708,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :vartype min_count: int :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool - :ivar type: AgentPoolType represents types of an agent pool. Possible values include: + :ivar type: AgentPoolType represents types of an agent pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2020_02_01.models.AgentPoolType :ivar orchestrator_version: Version of orchestrator specified when creating the managed @@ -1721,12 +1723,12 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar enable_node_public_ip: Enable public IP for nodes. :vartype enable_node_public_ip: bool :ivar scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Possible values include: "Spot", "Low", "Regular". Default value: + priority. Default to regular. Known values are: "Spot", "Low", "Regular". Default value: "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_02_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy - for Spot or low priority virtual machine scale set. Default to Delete. Possible values include: + for Spot or low priority virtual machine scale set. Default to Delete. Known values are: "Delete", "Deallocate". Default value: "Delete". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_02_01.models.ScaleSetEvictionPolicy @@ -1776,20 +1778,20 @@ def __init__( self, *, count: Optional[int] = None, - vm_size: Optional[Union[str, "ContainerServiceVMSizeTypes"]] = None, + vm_size: Optional[Union[str, "_models.ContainerServiceVMSizeTypes"]] = None, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - type: Optional[Union[str, "AgentPoolType"]] = None, + type: Optional[Union[str, "_models.AgentPoolType"]] = None, orchestrator_version: Optional[str] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, - scale_set_priority: Optional[Union[str, "ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", spot_max_price: Optional[float] = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, @@ -1800,7 +1802,7 @@ def __init__( :keyword count: Number of agents (VMs) 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: Size of agent VMs. Possible values include: "Standard_A1", "Standard_A10", + :keyword vm_size: Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -1849,7 +1851,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2020_02_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -1857,7 +1859,7 @@ def __init__( :paramtype min_count: int :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool - :keyword type: AgentPoolType represents types of an agent pool. Possible values include: + :keyword type: AgentPoolType represents types of an agent pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2020_02_01.models.AgentPoolType :keyword orchestrator_version: Version of orchestrator specified when creating the managed @@ -1869,13 +1871,13 @@ def __init__( :keyword enable_node_public_ip: Enable public IP for nodes. :paramtype enable_node_public_ip: bool :keyword scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Possible values include: "Spot", "Low", "Regular". Default value: + priority. Default to regular. Known values are: "Spot", "Low", "Regular". Default value: "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_02_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction - policy for Spot or low priority virtual machine scale set. Default to Delete. Possible values - include: "Delete", "Deallocate". Default value: "Delete". + policy for Spot or low priority virtual machine scale set. Default to Delete. Known values are: + "Delete", "Deallocate". Default value: "Delete". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_02_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: SpotMaxPrice to be used to specify the maximum price you are willing @@ -1924,7 +1926,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar count: Number of agents (VMs) 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: Size of agent VMs. Possible values include: "Standard_A1", "Standard_A10", + :ivar vm_size: Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -1973,7 +1975,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2020_02_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -1981,7 +1983,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :vartype min_count: int :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool - :ivar type: AgentPoolType represents types of an agent pool. Possible values include: + :ivar type: AgentPoolType represents types of an agent pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2020_02_01.models.AgentPoolType :ivar orchestrator_version: Version of orchestrator specified when creating the managed @@ -1996,12 +1998,12 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar enable_node_public_ip: Enable public IP for nodes. :vartype enable_node_public_ip: bool :ivar scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Possible values include: "Spot", "Low", "Regular". Default value: + priority. Default to regular. Known values are: "Spot", "Low", "Regular". Default value: "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_02_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy - for Spot or low priority virtual machine scale set. Default to Delete. Possible values include: + for Spot or low priority virtual machine scale set. Default to Delete. Known values are: "Delete", "Deallocate". Default value: "Delete". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_02_01.models.ScaleSetEvictionPolicy @@ -2057,20 +2059,20 @@ def __init__( *, name: str, count: Optional[int] = None, - vm_size: Optional[Union[str, "ContainerServiceVMSizeTypes"]] = None, + vm_size: Optional[Union[str, "_models.ContainerServiceVMSizeTypes"]] = None, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - type: Optional[Union[str, "AgentPoolType"]] = None, + type: Optional[Union[str, "_models.AgentPoolType"]] = None, orchestrator_version: Optional[str] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, - scale_set_priority: Optional[Union[str, "ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", spot_max_price: Optional[float] = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, @@ -2081,7 +2083,7 @@ def __init__( :keyword count: Number of agents (VMs) 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: Size of agent VMs. Possible values include: "Standard_A1", "Standard_A10", + :keyword vm_size: Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -2130,7 +2132,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2020_02_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -2138,7 +2140,7 @@ def __init__( :paramtype min_count: int :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool - :keyword type: AgentPoolType represents types of an agent pool. Possible values include: + :keyword type: AgentPoolType represents types of an agent pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2020_02_01.models.AgentPoolType :keyword orchestrator_version: Version of orchestrator specified when creating the managed @@ -2150,13 +2152,13 @@ def __init__( :keyword enable_node_public_ip: Enable public IP for nodes. :paramtype enable_node_public_ip: bool :keyword scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Possible values include: "Spot", "Low", "Regular". Default value: + priority. Default to regular. Known values are: "Spot", "Low", "Regular". Default value: "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_02_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction - policy for Spot or low priority virtual machine scale set. Default to Delete. Possible values - include: "Delete", "Deallocate". Default value: "Delete". + policy for Spot or low priority virtual machine scale set. Default to Delete. Known values are: + "Delete", "Deallocate". Default value: "Delete". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_02_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: SpotMaxPrice to be used to specify the maximum price you are willing @@ -2225,7 +2227,7 @@ class ManagedClusterIdentity(msrest.serialization.Model): :ivar type: The type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ resource group in agent nodes. Type 'None' will not use MSI for the managed cluster, - service principal will be used instead. Possible values include: "SystemAssigned", "None". + service principal will be used instead. Known values are: "SystemAssigned", "None". :vartype type: str or ~azure.mgmt.containerservice.v2020_02_01.models.ResourceIdentityType """ @@ -2243,15 +2245,14 @@ class ManagedClusterIdentity(msrest.serialization.Model): def __init__( self, *, - type: Optional[Union[str, "ResourceIdentityType"]] = None, + type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, **kwargs ): """ :keyword type: The type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ resource group in agent nodes. Type 'None' will not use MSI for the managed - cluster, service principal will be used instead. Possible values include: "SystemAssigned", - "None". + cluster, service principal will be used instead. Known values are: "SystemAssigned", "None". :paramtype type: str or ~azure.mgmt.containerservice.v2020_02_01.models.ResourceIdentityType """ super(ManagedClusterIdentity, self).__init__(**kwargs) @@ -2283,7 +2284,7 @@ class ManagedClusterListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["ManagedCluster"]] = None, + value: Optional[List["_models.ManagedCluster"]] = None, **kwargs ): """ @@ -2337,10 +2338,10 @@ class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): def __init__( self, *, - managed_outbound_i_ps: Optional["ManagedClusterLoadBalancerProfileManagedOutboundIPs"] = None, - outbound_ip_prefixes: Optional["ManagedClusterLoadBalancerProfileOutboundIPPrefixes"] = None, - outbound_i_ps: Optional["ManagedClusterLoadBalancerProfileOutboundIPs"] = None, - effective_outbound_i_ps: Optional[List["ResourceReference"]] = None, + managed_outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileManagedOutboundIPs"] = None, + outbound_ip_prefixes: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPPrefixes"] = None, + outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPs"] = None, + effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, allocated_outbound_ports: Optional[int] = 0, idle_timeout_in_minutes: Optional[int] = 30, **kwargs @@ -2423,7 +2424,7 @@ class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.M def __init__( self, *, - public_ip_prefixes: Optional[List["ResourceReference"]] = None, + public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, **kwargs ): """ @@ -2449,7 +2450,7 @@ class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): def __init__( self, *, - public_i_ps: Optional[List["ResourceReference"]] = None, + public_i_ps: Optional[List["_models.ResourceReference"]] = None, **kwargs ): """ @@ -2470,7 +2471,7 @@ class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): :ivar name: Pool name. :vartype name: str :ivar os_type: Required. OsType to be used to specify os type. Choose from Linux and Windows. - Default to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2020_02_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -2493,9 +2494,9 @@ def __init__( self, *, kubernetes_version: str, - os_type: Union[str, "OSType"] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", name: Optional[str] = None, - upgrades: Optional[List["ManagedClusterPoolUpgradeProfileUpgradesItem"]] = None, + upgrades: Optional[List["_models.ManagedClusterPoolUpgradeProfileUpgradesItem"]] = None, **kwargs ): """ @@ -2504,7 +2505,7 @@ def __init__( :keyword name: Pool name. :paramtype name: str :keyword os_type: Required. OsType to be used to specify os type. Choose from Linux and - Windows. Default to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Windows. Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2020_02_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: @@ -2738,8 +2739,8 @@ class ManagedClusterUpgradeProfile(msrest.serialization.Model): def __init__( self, *, - control_plane_profile: "ManagedClusterPoolUpgradeProfile", - agent_pool_profiles: List["ManagedClusterPoolUpgradeProfile"], + control_plane_profile: "_models.ManagedClusterPoolUpgradeProfile", + agent_pool_profiles: List["_models.ManagedClusterPoolUpgradeProfile"], **kwargs ): """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/models/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/models/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/operations/__init__.py index 5aac40228eec..403c0174f052 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/operations/__init__.py @@ -10,8 +10,13 @@ from ._managed_clusters_operations import ManagedClustersOperations from ._agent_pools_operations import AgentPoolsOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'Operations', 'ManagedClustersOperations', 'AgentPoolsOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/operations/_agent_pools_operations.py index 044c2d3e7127..f49b9a360b15 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/operations/_agent_pools_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -35,9 +35,12 @@ def build_list_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools") # pylint: disable=line-too-long path_format_arguments = { @@ -49,18 +52,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -72,9 +73,12 @@ def build_get_request( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -87,18 +91,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -109,14 +111,17 @@ def build_create_or_update_request_initial( resource_name: str, agent_pool_name: str, *, - json: JSONType = None, + json: Optional[_models.AgentPool] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-02-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -129,20 +134,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -156,9 +159,12 @@ def build_delete_request_initial( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -171,18 +177,16 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -194,9 +198,12 @@ def build_get_upgrade_profile_request( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default") # pylint: disable=line-too-long path_format_arguments = { @@ -209,18 +216,16 @@ def build_get_upgrade_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -231,9 +236,12 @@ def build_get_available_agent_pool_versions_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions") # pylint: disable=line-too-long path_format_arguments = { @@ -245,42 +253,38 @@ def build_get_available_agent_pool_versions_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class AgentPoolsOperations(object): - """AgentPoolsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class AgentPoolsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2020_02_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2020_02_01.ContainerServiceClient`'s + :attr:`agent_pools` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -288,7 +292,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Iterable["_models.AgentPoolListResult"]: + ) -> Iterable[_models.AgentPoolListResult]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. The operation returns properties @@ -304,13 +308,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_02_01.models.AgentPoolListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -320,9 +327,11 @@ def prepare_request(next_link=None): resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -332,9 +341,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -374,7 +385,7 @@ def get( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPool": + ) -> _models.AgentPool: """Gets the agent pool. Gets the details of the agent pool by managed cluster and resource group. @@ -390,13 +401,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2020_02_01.models.AgentPool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-02-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] request = build_get_request( @@ -406,11 +420,13 @@ def get( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -436,17 +452,20 @@ def _create_or_update_initial( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> "_models.AgentPool": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] + ) -> _models.AgentPool: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] _json = self._serialize.body(parameters, 'AgentPool') @@ -459,11 +478,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -494,9 +515,9 @@ def begin_create_or_update( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> LROPoller["_models.AgentPool"]: + ) -> LROPoller[_models.AgentPool]: """Creates or updates an agent pool. Creates or updates an agent pool in the specified managed cluster. @@ -522,17 +543,20 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_02_01.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, @@ -540,20 +564,27 @@ def begin_create_or_update( 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): - response = pipeline_response.http_response deserialized = self._deserialize('AgentPool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -573,13 +604,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements agent_pool_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -589,11 +623,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -640,21 +676,26 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-02-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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) @@ -664,8 +705,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -685,7 +732,7 @@ def get_upgrade_profile( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPoolUpgradeProfile": + ) -> _models.AgentPoolUpgradeProfile: """Gets upgrade profile for an agent pool. Gets the details of the upgrade profile for an agent pool with a specified resource group and @@ -702,13 +749,16 @@ def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2020_02_01.models.AgentPoolUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-02-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] request = build_get_upgrade_profile_request( @@ -718,11 +768,13 @@ def get_upgrade_profile( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -749,7 +801,7 @@ def get_available_agent_pool_versions( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.AgentPoolAvailableVersions": + ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported versions for the specified agent pool. Gets a list of supported versions for the specified agent pool. @@ -763,13 +815,16 @@ def get_available_agent_pool_versions( :rtype: ~azure.mgmt.containerservice.v2020_02_01.models.AgentPoolAvailableVersions :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolAvailableVersions"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-02-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] request = build_get_available_agent_pool_versions_request( @@ -778,11 +833,13 @@ def get_available_agent_pool_versions( resource_name=resource_name, api_version=api_version, template_url=self.get_available_agent_pool_versions.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/operations/_managed_clusters_operations.py index 38f353329d7b..aa208df218fb 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/operations/_managed_clusters_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -33,9 +33,12 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters") path_format_arguments = { @@ -45,18 +48,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -66,9 +67,12 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters") # pylint: disable=line-too-long path_format_arguments = { @@ -79,18 +83,16 @@ def build_list_by_resource_group_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -101,9 +103,12 @@ def build_get_upgrade_profile_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default") # pylint: disable=line-too-long path_format_arguments = { @@ -115,18 +120,16 @@ def build_get_upgrade_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -138,9 +141,12 @@ def build_get_access_profile_request( role_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -153,18 +159,16 @@ def build_get_access_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -175,9 +179,12 @@ def build_list_cluster_admin_credentials_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -189,18 +196,16 @@ def build_list_cluster_admin_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -211,9 +216,12 @@ def build_list_cluster_user_credentials_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -225,18 +233,16 @@ def build_list_cluster_user_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -247,9 +253,12 @@ def build_list_cluster_monitoring_user_credentials_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -261,18 +270,16 @@ def build_list_cluster_monitoring_user_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -283,9 +290,12 @@ def build_get_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -297,18 +307,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -318,14 +326,17 @@ def build_create_or_update_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedCluster] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-02-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -337,20 +348,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -362,14 +371,17 @@ def build_update_tags_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.TagsObject] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-02-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -381,20 +393,18 @@ def build_update_tags_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -407,9 +417,12 @@ def build_delete_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -421,18 +434,16 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -442,14 +453,17 @@ def build_reset_service_principal_profile_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedClusterServicePrincipalProfile] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-02-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile") # pylint: disable=line-too-long path_format_arguments = { @@ -461,20 +475,18 @@ def build_reset_service_principal_profile_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -486,14 +498,17 @@ def build_reset_aad_profile_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedClusterAADProfile] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-02-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile") # pylint: disable=line-too-long path_format_arguments = { @@ -505,20 +520,18 @@ def build_reset_aad_profile_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -531,9 +544,12 @@ def build_rotate_cluster_certificates_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates") # pylint: disable=line-too-long path_format_arguments = { @@ -545,48 +561,44 @@ def build_rotate_cluster_certificates_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class ManagedClustersOperations(object): - """ManagedClustersOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ManagedClustersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2020_02_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2020_02_01.ContainerServiceClient`'s + :attr:`managed_clusters` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> Iterable["_models.ManagedClusterListResult"]: + ) -> Iterable[_models.ManagedClusterListResult]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. The operation returns properties @@ -599,13 +611,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_02_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -613,9 +628,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -623,9 +640,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -663,7 +682,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.ManagedClusterListResult"]: + ) -> Iterable[_models.ManagedClusterListResult]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. The operation returns @@ -678,13 +697,16 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_02_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -693,9 +715,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -704,9 +728,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -745,7 +771,7 @@ def get_upgrade_profile( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedClusterUpgradeProfile": + ) -> _models.ManagedClusterUpgradeProfile: """Gets upgrade profile for a managed cluster. Gets the details of the upgrade profile for a managed cluster with a specified resource group @@ -760,13 +786,16 @@ def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2020_02_01.models.ManagedClusterUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] request = build_get_upgrade_profile_request( @@ -775,11 +804,13 @@ def get_upgrade_profile( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -807,7 +838,7 @@ def get_access_profile( resource_name: str, role_name: str, **kwargs: Any - ) -> "_models.ManagedClusterAccessProfile": + ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. Gets the accessProfile for the specified role name of the managed cluster with a specified @@ -824,13 +855,16 @@ def get_access_profile( :rtype: ~azure.mgmt.containerservice.v2020_02_01.models.ManagedClusterAccessProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterAccessProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-02-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] request = build_get_access_profile_request( @@ -840,11 +874,13 @@ def get_access_profile( role_name=role_name, api_version=api_version, template_url=self.get_access_profile.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -871,7 +907,7 @@ def list_cluster_admin_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster admin credential of a managed cluster. Gets cluster admin credential of the managed cluster with a specified resource group and name. @@ -885,13 +921,16 @@ def list_cluster_admin_credentials( :rtype: ~azure.mgmt.containerservice.v2020_02_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-02-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_admin_credentials_request( @@ -900,11 +939,13 @@ def list_cluster_admin_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_admin_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -931,7 +972,7 @@ def list_cluster_user_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster user credential of a managed cluster. Gets cluster user credential of the managed cluster with a specified resource group and name. @@ -945,13 +986,16 @@ def list_cluster_user_credentials( :rtype: ~azure.mgmt.containerservice.v2020_02_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_user_credentials_request( @@ -960,11 +1004,13 @@ def list_cluster_user_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -991,7 +1037,7 @@ def list_cluster_monitoring_user_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster monitoring user credential of a managed cluster. Gets cluster monitoring user credential of the managed cluster with a specified resource group @@ -1006,13 +1052,16 @@ def list_cluster_monitoring_user_credentials( :rtype: ~azure.mgmt.containerservice.v2020_02_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-02-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_monitoring_user_credentials_request( @@ -1021,11 +1070,13 @@ def list_cluster_monitoring_user_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1052,7 +1103,7 @@ def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedCluster": + ) -> _models.ManagedCluster: """Gets a managed cluster. Gets the details of the managed cluster with a specified resource group and name. @@ -1066,13 +1117,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2020_02_01.models.ManagedCluster :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] request = build_get_request( @@ -1081,11 +1135,13 @@ def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1110,17 +1166,20 @@ def _create_or_update_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2020-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'ManagedCluster') @@ -1132,11 +1191,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1166,9 +1227,9 @@ def begin_create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> LROPoller["_models.ManagedCluster"]: + ) -> LROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. Creates or updates a managed cluster with the specified configuration for agents and Kubernetes @@ -1194,37 +1255,47 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_02_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1241,17 +1312,20 @@ def _update_tags_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'TagsObject') @@ -1263,11 +1337,13 @@ def _update_tags_initial( content_type=content_type, json=_json, template_url=self._update_tags_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1293,9 +1369,9 @@ def begin_update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> LROPoller["_models.ManagedCluster"]: + ) -> LROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates a managed cluster with the specified tags. @@ -1320,37 +1396,47 @@ def begin_update_tags( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_02_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._update_tags_initial( + raw_result = self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1369,13 +1455,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-02-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -1384,11 +1473,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1432,20 +1523,25 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-02-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_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) @@ -1455,8 +1551,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1473,17 +1575,20 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2020-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') @@ -1495,11 +1600,13 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re content_type=content_type, json=_json, template_url=self._reset_service_principal_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1521,7 +1628,7 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> LROPoller[None]: """Reset Service Principal Profile of a managed cluster. @@ -1548,23 +1655,28 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._reset_service_principal_profile_initial( + raw_result = self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1574,8 +1686,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1592,17 +1710,20 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2020-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') @@ -1614,11 +1735,13 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement content_type=content_type, json=_json, template_url=self._reset_aad_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1640,7 +1763,7 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> LROPoller[None]: """Reset AAD Profile of a managed cluster. @@ -1666,23 +1789,28 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._reset_aad_profile_initial( + raw_result = self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1692,8 +1820,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1712,13 +1846,16 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-02-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_rotate_cluster_certificates_request_initial( @@ -1727,11 +1864,13 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return resource_name=resource_name, api_version=api_version, template_url=self._rotate_cluster_certificates_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1775,20 +1914,25 @@ def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-st :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-02-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._rotate_cluster_certificates_initial( + raw_result = self._rotate_cluster_certificates_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) @@ -1798,8 +1942,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/operations/_operations.py index 532ea9e3a5a5..c4f8b331e113 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/operations/_operations.py @@ -16,6 +16,7 @@ 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 @@ -29,55 +30,54 @@ def build_list_request( **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.ContainerService/operations") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class Operations(object): - """Operations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2020_02_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2020_02_01.ContainerServiceClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> Iterable["_models.OperationListResult"]: + ) -> Iterable[_models.OperationListResult]: """Gets a list of compute operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -86,31 +86,38 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_02_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/__init__.py index 53c675bd95e2..37a5f9e02e6f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._container_service_client import ContainerServiceClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['ContainerServiceClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/_container_service_client.py index 2cf71c13c832..3af0440deec6 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/_container_service_client.py @@ -60,9 +60,15 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.managed_clusters = ManagedClustersOperations(self._client, self._config, self._serialize, self._deserialize) - self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_clusters = ManagedClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.agent_pools = AgentPoolsOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/aio/__init__.py index 53c675bd95e2..37a5f9e02e6f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/aio/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/aio/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._container_service_client import ContainerServiceClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['ContainerServiceClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/aio/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/aio/_container_service_client.py index d45548cced31..fe38c25df9d1 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/aio/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/aio/_container_service_client.py @@ -61,9 +61,15 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.managed_clusters = ManagedClustersOperations(self._client, self._config, self._serialize, self._deserialize) - self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_clusters = ManagedClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.agent_pools = AgentPoolsOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/aio/operations/__init__.py index 5aac40228eec..403c0174f052 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/aio/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/aio/operations/__init__.py @@ -10,8 +10,13 @@ from ._managed_clusters_operations import ManagedClustersOperations from ._agent_pools_operations import AgentPoolsOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'Operations', 'ManagedClustersOperations', 'AgentPoolsOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/aio/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/aio/operations/_agent_pools_operations.py index 23f1b04f1835..bb194f88ef35 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/aio/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/aio/operations/_agent_pools_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. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ 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 @@ -26,26 +27,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class AgentPoolsOperations: - """AgentPoolsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2020_03_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2020_03_01.aio.ContainerServiceClient`'s + :attr:`agent_pools` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -53,7 +52,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> AsyncIterable["_models.AgentPoolListResult"]: + ) -> AsyncIterable[_models.AgentPoolListResult]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. The operation returns properties @@ -69,13 +68,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_03_01.models.AgentPoolListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -85,9 +87,11 @@ def prepare_request(next_link=None): resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -97,9 +101,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -139,7 +145,7 @@ async def get( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPool": + ) -> _models.AgentPool: """Gets the agent pool. Gets the details of the agent pool by managed cluster and resource group. @@ -155,13 +161,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2020_03_01.models.AgentPool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] request = build_get_request( @@ -171,11 +180,13 @@ async def get( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -201,17 +212,20 @@ async def _create_or_update_initial( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> "_models.AgentPool": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] + ) -> _models.AgentPool: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2020-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] _json = self._serialize.body(parameters, 'AgentPool') @@ -224,11 +238,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -259,9 +275,9 @@ async def begin_create_or_update( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> AsyncLROPoller["_models.AgentPool"]: + ) -> AsyncLROPoller[_models.AgentPool]: """Creates or updates an agent pool. Creates or updates an agent pool in the specified managed cluster. @@ -288,17 +304,20 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_03_01.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, @@ -306,20 +325,27 @@ async def begin_create_or_update( 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): - response = pipeline_response.http_response deserialized = self._deserialize('AgentPool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -339,13 +365,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements agent_pool_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -355,11 +384,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -406,21 +437,26 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-03-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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) @@ -430,8 +466,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -451,7 +493,7 @@ async def get_upgrade_profile( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPoolUpgradeProfile": + ) -> _models.AgentPoolUpgradeProfile: """Gets upgrade profile for an agent pool. Gets the details of the upgrade profile for an agent pool with a specified resource group and @@ -468,13 +510,16 @@ async def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2020_03_01.models.AgentPoolUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] request = build_get_upgrade_profile_request( @@ -484,11 +529,13 @@ async def get_upgrade_profile( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -515,7 +562,7 @@ async def get_available_agent_pool_versions( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.AgentPoolAvailableVersions": + ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported versions for the specified agent pool. Gets a list of supported versions for the specified agent pool. @@ -529,13 +576,16 @@ async def get_available_agent_pool_versions( :rtype: ~azure.mgmt.containerservice.v2020_03_01.models.AgentPoolAvailableVersions :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolAvailableVersions"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] request = build_get_available_agent_pool_versions_request( @@ -544,11 +594,13 @@ async def get_available_agent_pool_versions( resource_name=resource_name, api_version=api_version, template_url=self.get_available_agent_pool_versions.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/aio/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/aio/operations/_managed_clusters_operations.py index 2b49ee75fec8..82a58bc1f3ad 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/aio/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/aio/operations/_managed_clusters_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. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ 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 @@ -26,32 +27,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ManagedClustersOperations: - """ManagedClustersOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2020_03_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2020_03_01.aio.ContainerServiceClient`'s + :attr:`managed_clusters` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.ManagedClusterListResult"]: + ) -> AsyncIterable[_models.ManagedClusterListResult]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. The operation returns properties @@ -64,13 +63,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_03_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -78,9 +80,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -88,9 +92,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -128,7 +134,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ManagedClusterListResult"]: + ) -> AsyncIterable[_models.ManagedClusterListResult]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. The operation returns @@ -143,13 +149,16 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_03_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -158,9 +167,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -169,9 +180,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -210,7 +223,7 @@ async def get_upgrade_profile( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedClusterUpgradeProfile": + ) -> _models.ManagedClusterUpgradeProfile: """Gets upgrade profile for a managed cluster. Gets the details of the upgrade profile for a managed cluster with a specified resource group @@ -225,13 +238,16 @@ async def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2020_03_01.models.ManagedClusterUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] request = build_get_upgrade_profile_request( @@ -240,11 +256,13 @@ async def get_upgrade_profile( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -272,7 +290,7 @@ async def get_access_profile( resource_name: str, role_name: str, **kwargs: Any - ) -> "_models.ManagedClusterAccessProfile": + ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. Gets the accessProfile for the specified role name of the managed cluster with a specified @@ -289,13 +307,16 @@ async def get_access_profile( :rtype: ~azure.mgmt.containerservice.v2020_03_01.models.ManagedClusterAccessProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterAccessProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] request = build_get_access_profile_request( @@ -305,11 +326,13 @@ async def get_access_profile( role_name=role_name, api_version=api_version, template_url=self.get_access_profile.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -336,7 +359,7 @@ async def list_cluster_admin_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster admin credential of a managed cluster. Gets cluster admin credential of the managed cluster with a specified resource group and name. @@ -350,13 +373,16 @@ async def list_cluster_admin_credentials( :rtype: ~azure.mgmt.containerservice.v2020_03_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_admin_credentials_request( @@ -365,11 +391,13 @@ async def list_cluster_admin_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_admin_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -396,7 +424,7 @@ async def list_cluster_user_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster user credential of a managed cluster. Gets cluster user credential of the managed cluster with a specified resource group and name. @@ -410,13 +438,16 @@ async def list_cluster_user_credentials( :rtype: ~azure.mgmt.containerservice.v2020_03_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_user_credentials_request( @@ -425,11 +456,13 @@ async def list_cluster_user_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -456,7 +489,7 @@ async def list_cluster_monitoring_user_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster monitoring user credential of a managed cluster. Gets cluster monitoring user credential of the managed cluster with a specified resource group @@ -471,13 +504,16 @@ async def list_cluster_monitoring_user_credentials( :rtype: ~azure.mgmt.containerservice.v2020_03_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_monitoring_user_credentials_request( @@ -486,11 +522,13 @@ async def list_cluster_monitoring_user_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -517,7 +555,7 @@ async def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedCluster": + ) -> _models.ManagedCluster: """Gets a managed cluster. Gets the details of the managed cluster with a specified resource group and name. @@ -531,13 +569,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2020_03_01.models.ManagedCluster :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] request = build_get_request( @@ -546,11 +587,13 @@ async def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -575,17 +618,20 @@ async def _create_or_update_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2020-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'ManagedCluster') @@ -597,11 +643,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -631,9 +679,9 @@ async def begin_create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> AsyncLROPoller["_models.ManagedCluster"]: + ) -> AsyncLROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. Creates or updates a managed cluster with the specified configuration for agents and Kubernetes @@ -659,37 +707,47 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_03_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -706,17 +764,20 @@ async def _update_tags_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'TagsObject') @@ -728,11 +789,13 @@ async def _update_tags_initial( content_type=content_type, json=_json, template_url=self._update_tags_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -758,9 +821,9 @@ async def begin_update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> AsyncLROPoller["_models.ManagedCluster"]: + ) -> AsyncLROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates a managed cluster with the specified tags. @@ -785,37 +848,47 @@ async def begin_update_tags( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_03_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._update_tags_initial( + raw_result = await self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -834,13 +907,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -849,11 +925,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -897,20 +975,25 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-03-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_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) @@ -920,8 +1003,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -938,17 +1027,20 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2020-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') @@ -960,11 +1052,13 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist content_type=content_type, json=_json, template_url=self._reset_service_principal_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -986,7 +1080,7 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> AsyncLROPoller[None]: """Reset Service Principal Profile of a managed cluster. @@ -1013,23 +1107,28 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._reset_service_principal_profile_initial( + raw_result = await self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1039,8 +1138,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1057,17 +1162,20 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') @@ -1079,11 +1187,13 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta content_type=content_type, json=_json, template_url=self._reset_aad_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1105,7 +1215,7 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> AsyncLROPoller[None]: """Reset AAD Profile of a managed cluster. @@ -1131,23 +1241,28 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._reset_aad_profile_initial( + raw_result = await self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1157,8 +1272,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1177,13 +1298,16 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_rotate_cluster_certificates_request_initial( @@ -1192,11 +1316,13 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- resource_name=resource_name, api_version=api_version, template_url=self._rotate_cluster_certificates_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1240,20 +1366,25 @@ async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-ret :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-03-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._rotate_cluster_certificates_initial( + raw_result = await self._rotate_cluster_certificates_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) @@ -1263,8 +1394,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/aio/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/aio/operations/_operations.py index cdc9e36ff56f..73fb21f8242d 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/aio/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/aio/operations/_operations.py @@ -14,6 +14,7 @@ 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 @@ -23,32 +24,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class Operations: - """Operations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2020_03_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2020_03_01.aio.ContainerServiceClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.OperationListResult"]: + ) -> AsyncIterable[_models.OperationListResult]: """Gets a list of compute operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -57,31 +56,38 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_03_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/aio/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/aio/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/models/__init__.py index c087ee137f98..ee6bfbcd2b80 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/models/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/models/__init__.py @@ -72,7 +72,9 @@ ScaleSetEvictionPolicy, ScaleSetPriority, ) - +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'AgentPool', 'AgentPoolAvailableVersions', @@ -137,3 +139,5 @@ 'ScaleSetEvictionPolicy', 'ScaleSetPriority', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/models/_container_service_client_enums.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/models/_container_service_client_enums.py index 7ec3306282c9..2b17b2cc88e8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/models/_container_service_client_enums.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/models/_container_service_client_enums.py @@ -7,25 +7,24 @@ # -------------------------------------------------------------------------- from enum import Enum -from six import with_metaclass from azure.core import CaseInsensitiveEnumMeta -class AgentPoolMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class AgentPoolMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """AgentPoolMode represents mode of an agent pool. """ SYSTEM = "System" USER = "User" -class AgentPoolType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class AgentPoolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """AgentPoolType represents types of an agent pool. """ VIRTUAL_MACHINE_SCALE_SETS = "VirtualMachineScaleSets" AVAILABILITY_SET = "AvailabilitySet" -class ContainerServiceStorageProfileTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the orchestrator choice. """ @@ -33,7 +32,7 @@ class ContainerServiceStorageProfileTypes(with_metaclass(CaseInsensitiveEnumMeta STORAGE_ACCOUNT = "StorageAccount" MANAGED_DISKS = "ManagedDisks" -class ContainerServiceVMSizeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Size of agent VMs. """ @@ -212,7 +211,7 @@ class ContainerServiceVMSizeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, E STANDARD_NV24 = "Standard_NV24" STANDARD_NV6 = "Standard_NV6" -class Count(with_metaclass(CaseInsensitiveEnumMeta, int, Enum)): +class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): """Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, and 5. The default value is 1. """ @@ -221,62 +220,62 @@ class Count(with_metaclass(CaseInsensitiveEnumMeta, int, Enum)): THREE = 3 FIVE = 5 -class LoadBalancerSku(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class LoadBalancerSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The load balancer sku for the managed cluster. """ STANDARD = "standard" BASIC = "basic" -class ManagedClusterSKUName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ManagedClusterSKUName(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Name of a managed cluster SKU. """ BASIC = "Basic" -class ManagedClusterSKUTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ManagedClusterSKUTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Tier of a managed cluster SKU. """ PAID = "Paid" FREE = "Free" -class NetworkMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Network mode used for building Kubernetes network. """ TRANSPARENT = "transparent" BRIDGE = "bridge" -class NetworkPlugin(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkPlugin(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Network plugin used for building Kubernetes network. """ AZURE = "azure" KUBENET = "kubenet" -class NetworkPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Network policy used for building Kubernetes network. """ CALICO = "calico" AZURE = "azure" -class OSType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux. """ LINUX = "Linux" WINDOWS = "Windows" -class OutboundType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OutboundType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The outbound (egress) routing method. """ LOAD_BALANCER = "loadBalancer" USER_DEFINED_ROUTING = "userDefinedRouting" -class ResourceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ resource group in agent nodes. Type 'None' will not use MSI for the managed cluster, service @@ -286,7 +285,7 @@ class ResourceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): SYSTEM_ASSIGNED = "SystemAssigned" NONE = "None" -class ScaleSetEvictionPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ScaleSetEvictionPolicy to be used to specify eviction policy for Spot or low priority virtual machine scale set. Default to Delete. """ @@ -294,7 +293,7 @@ class ScaleSetEvictionPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)) DELETE = "Delete" DEALLOCATE = "Deallocate" -class ScaleSetPriority(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ScaleSetPriority(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ScaleSetPriority to be used to specify virtual machine scale set priority. Default to regular. """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/models/_models_py3.py index 241d8e1ae932..0cc9cca28ea1 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/models/_models_py3.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/models/_models_py3.py @@ -6,11 +6,13 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Dict, List, Optional, Union +from typing import Dict, List, Optional, TYPE_CHECKING, Union import msrest.serialization -from ._container_service_client_enums import * +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + import __init__ as _models class SubResource(msrest.serialization.Model): @@ -67,7 +69,7 @@ class AgentPool(SubResource): range of 0 to 100 (inclusive) for user pools and in the range of 1 to 100 (inclusive) for system pools. The default value is 1. :vartype count: int - :ivar vm_size: Size of agent VMs. Possible values include: "Standard_A1", "Standard_A10", + :ivar vm_size: Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -116,7 +118,7 @@ class AgentPool(SubResource): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2020_03_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -124,12 +126,11 @@ class AgentPool(SubResource): :vartype min_count: int :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool - :ivar type_properties_type: AgentPoolType represents types of an agent pool. Possible values - include: "VirtualMachineScaleSets", "AvailabilitySet". + :ivar type_properties_type: AgentPoolType represents types of an agent pool. Known values are: + "VirtualMachineScaleSets", "AvailabilitySet". :vartype type_properties_type: str or ~azure.mgmt.containerservice.v2020_03_01.models.AgentPoolType - :ivar mode: AgentPoolMode represents mode of an agent pool. Possible values include: "System", - "User". + :ivar mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", "User". :vartype mode: str or ~azure.mgmt.containerservice.v2020_03_01.models.AgentPoolMode :ivar orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -143,12 +144,12 @@ class AgentPool(SubResource): :ivar enable_node_public_ip: Enable public IP for nodes. :vartype enable_node_public_ip: bool :ivar scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Possible values include: "Spot", "Low", "Regular". Default value: + priority. Default to regular. Known values are: "Spot", "Low", "Regular". Default value: "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_03_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy - for Spot or low priority virtual machine scale set. Default to Delete. Possible values include: + for Spot or low priority virtual machine scale set. Default to Delete. Known values are: "Delete", "Deallocate". Default value: "Delete". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_03_01.models.ScaleSetEvictionPolicy @@ -205,21 +206,21 @@ def __init__( self, *, count: Optional[int] = None, - vm_size: Optional[Union[str, "ContainerServiceVMSizeTypes"]] = None, + vm_size: Optional[Union[str, "_models.ContainerServiceVMSizeTypes"]] = None, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - type_properties_type: Optional[Union[str, "AgentPoolType"]] = None, - mode: Optional[Union[str, "AgentPoolMode"]] = None, + type_properties_type: Optional[Union[str, "_models.AgentPoolType"]] = None, + mode: Optional[Union[str, "_models.AgentPoolMode"]] = None, orchestrator_version: Optional[str] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, - scale_set_priority: Optional[Union[str, "ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", spot_max_price: Optional[float] = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, @@ -231,7 +232,7 @@ def __init__( range of 0 to 100 (inclusive) for user pools and in the range of 1 to 100 (inclusive) for system pools. The default value is 1. :paramtype count: int - :keyword vm_size: Size of agent VMs. Possible values include: "Standard_A1", "Standard_A10", + :keyword vm_size: Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -280,7 +281,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2020_03_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -288,12 +289,12 @@ def __init__( :paramtype min_count: int :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool - :keyword type_properties_type: AgentPoolType represents types of an agent pool. Possible values - include: "VirtualMachineScaleSets", "AvailabilitySet". + :keyword type_properties_type: AgentPoolType represents types of an agent pool. Known values + are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type_properties_type: str or ~azure.mgmt.containerservice.v2020_03_01.models.AgentPoolType - :keyword mode: AgentPoolMode represents mode of an agent pool. Possible values include: - "System", "User". + :keyword mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", + "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2020_03_01.models.AgentPoolMode :keyword orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -304,13 +305,13 @@ def __init__( :keyword enable_node_public_ip: Enable public IP for nodes. :paramtype enable_node_public_ip: bool :keyword scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Possible values include: "Spot", "Low", "Regular". Default value: + priority. Default to regular. Known values are: "Spot", "Low", "Regular". Default value: "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_03_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction - policy for Spot or low priority virtual machine scale set. Default to Delete. Possible values - include: "Delete", "Deallocate". Default value: "Delete". + policy for Spot or low priority virtual machine scale set. Default to Delete. Known values are: + "Delete", "Deallocate". Default value: "Delete". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_03_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: SpotMaxPrice to be used to specify the maximum price you are willing @@ -382,7 +383,7 @@ class AgentPoolAvailableVersions(msrest.serialization.Model): def __init__( self, *, - agent_pool_versions: Optional[List["AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem"]] = None, + agent_pool_versions: Optional[List["_models.AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem"]] = None, **kwargs ): """ @@ -459,7 +460,7 @@ class AgentPoolListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["AgentPool"]] = None, + value: Optional[List["_models.AgentPool"]] = None, **kwargs ): """ @@ -487,7 +488,7 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): :ivar kubernetes_version: Required. Kubernetes version (major, minor, patch). :vartype kubernetes_version: str :ivar os_type: Required. OsType to be used to specify os type. Choose from Linux and Windows. - Default to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2020_03_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -515,15 +516,15 @@ def __init__( self, *, kubernetes_version: str, - os_type: Union[str, "OSType"] = "Linux", - upgrades: Optional[List["AgentPoolUpgradeProfilePropertiesUpgradesItem"]] = None, + os_type: Union[str, "_models.OSType"] = "Linux", + upgrades: Optional[List["_models.AgentPoolUpgradeProfilePropertiesUpgradesItem"]] = None, **kwargs ): """ :keyword kubernetes_version: Required. Kubernetes version (major, minor, patch). :paramtype kubernetes_version: str :keyword os_type: Required. OsType to be used to specify os type. Choose from Linux and - Windows. Default to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Windows. Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2020_03_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: @@ -667,23 +668,23 @@ class BaseManagedCluster(msrest.serialization.Model): def __init__( self, *, - identity: Optional["ManagedClusterIdentity"] = None, + identity: Optional["_models.ManagedClusterIdentity"] = None, kubernetes_version: Optional[str] = None, dns_prefix: Optional[str] = None, - agent_pool_profiles: Optional[List["ManagedClusterAgentPoolProfile"]] = None, - linux_profile: Optional["ContainerServiceLinuxProfile"] = None, - windows_profile: Optional["ManagedClusterWindowsProfile"] = None, - service_principal_profile: Optional["ManagedClusterServicePrincipalProfile"] = None, - addon_profiles: Optional[Dict[str, "ManagedClusterAddonProfile"]] = None, + agent_pool_profiles: Optional[List["_models.ManagedClusterAgentPoolProfile"]] = None, + linux_profile: Optional["_models.ContainerServiceLinuxProfile"] = None, + windows_profile: Optional["_models.ManagedClusterWindowsProfile"] = None, + service_principal_profile: Optional["_models.ManagedClusterServicePrincipalProfile"] = None, + addon_profiles: Optional[Dict[str, "_models.ManagedClusterAddonProfile"]] = None, node_resource_group: Optional[str] = None, enable_rbac: Optional[bool] = None, enable_pod_security_policy: Optional[bool] = None, - network_profile: Optional["ContainerServiceNetworkProfile"] = None, - aad_profile: Optional["ManagedClusterAADProfile"] = None, - auto_scaler_profile: Optional["ManagedClusterPropertiesAutoScalerProfile"] = None, - api_server_access_profile: Optional["ManagedClusterAPIServerAccessProfile"] = None, + network_profile: Optional["_models.ContainerServiceNetworkProfile"] = None, + aad_profile: Optional["_models.ManagedClusterAADProfile"] = None, + auto_scaler_profile: Optional["_models.ManagedClusterPropertiesAutoScalerProfile"] = None, + api_server_access_profile: Optional["_models.ManagedClusterAPIServerAccessProfile"] = None, disk_encryption_set_id: Optional[str] = None, - identity_profile: Optional[Dict[str, "ManagedClusterPropertiesIdentityProfileValue"]] = None, + identity_profile: Optional[Dict[str, "_models.ManagedClusterPropertiesIdentityProfileValue"]] = None, **kwargs ): """ @@ -789,7 +790,7 @@ def __init__( code: Optional[str] = None, message: Optional[str] = None, target: Optional[str] = None, - details: Optional[List["CloudErrorBody"]] = None, + details: Optional[List["_models.CloudErrorBody"]] = None, **kwargs ): """ @@ -833,7 +834,7 @@ class ContainerServiceDiagnosticsProfile(msrest.serialization.Model): def __init__( self, *, - vm_diagnostics: "ContainerServiceVMDiagnostics", + vm_diagnostics: "_models.ContainerServiceVMDiagnostics", **kwargs ): """ @@ -870,7 +871,7 @@ def __init__( self, *, admin_username: str, - ssh: "ContainerServiceSshConfiguration", + ssh: "_models.ContainerServiceSshConfiguration", **kwargs ): """ @@ -893,17 +894,17 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar count: Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, - and 5. The default value is 1. Possible values include: 1, 3, 5. Default value: "1". + and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". :vartype count: int or ~azure.mgmt.containerservice.v2020_03_01.models.Count :ivar dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. :vartype dns_prefix: str - :ivar vm_size: Required. Size of agent VMs. Possible values include: "Standard_A1", - "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", - "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", - "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", - "Standard_A8m_v2", "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", - "Standard_B8ms", "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", - "Standard_D12", "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", + :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", + "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", + "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", + "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", "Standard_B8ms", + "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", "Standard_D12", + "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", "Standard_D13_v2_Promo", "Standard_D14", "Standard_D14_v2", "Standard_D14_v2_Promo", "Standard_D15_v2", "Standard_D16_v3", "Standard_D16s_v3", "Standard_D1_v2", "Standard_D2", "Standard_D2_v2", "Standard_D2_v2_Promo", "Standard_D2_v3", "Standard_D2s_v3", "Standard_D3", @@ -948,7 +949,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): :vartype first_consecutive_static_ip: str :ivar storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Possible values include: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". :vartype storage_profile: str or ~azure.mgmt.containerservice.v2020_03_01.models.ContainerServiceStorageProfileTypes :ivar fqdn: FQDN for the master pool. @@ -977,27 +978,27 @@ def __init__( self, *, dns_prefix: str, - vm_size: Union[str, "ContainerServiceVMSizeTypes"], - count: Optional[Union[int, "Count"]] = 1, + vm_size: Union[str, "_models.ContainerServiceVMSizeTypes"], + count: Optional[Union[int, "_models.Count"]] = 1, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, first_consecutive_static_ip: Optional[str] = "10.240.255.5", - storage_profile: Optional[Union[str, "ContainerServiceStorageProfileTypes"]] = None, + storage_profile: Optional[Union[str, "_models.ContainerServiceStorageProfileTypes"]] = None, **kwargs ): """ :keyword count: Number of masters (VMs) in the container service cluster. Allowed values are 1, - 3, and 5. The default value is 1. Possible values include: 1, 3, 5. Default value: "1". + 3, and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". :paramtype count: int or ~azure.mgmt.containerservice.v2020_03_01.models.Count :keyword dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. :paramtype dns_prefix: str - :keyword vm_size: Required. Size of agent VMs. Possible values include: "Standard_A1", - "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", - "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", - "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", - "Standard_A8m_v2", "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", - "Standard_B8ms", "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", - "Standard_D12", "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", + :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", + "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", + "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", + "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", "Standard_B8ms", + "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", "Standard_D12", + "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", "Standard_D13_v2_Promo", "Standard_D14", "Standard_D14_v2", "Standard_D14_v2_Promo", "Standard_D15_v2", "Standard_D16_v3", "Standard_D16s_v3", "Standard_D1_v2", "Standard_D2", "Standard_D2_v2", "Standard_D2_v2_Promo", "Standard_D2_v3", "Standard_D2s_v3", "Standard_D3", @@ -1042,7 +1043,7 @@ def __init__( :paramtype first_consecutive_static_ip: str :keyword storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Possible values include: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". :paramtype storage_profile: str or ~azure.mgmt.containerservice.v2020_03_01.models.ContainerServiceStorageProfileTypes """ @@ -1060,13 +1061,13 @@ def __init__( class ContainerServiceNetworkProfile(msrest.serialization.Model): """Profile of network configuration. - :ivar network_plugin: Network plugin used for building Kubernetes network. Possible values - include: "azure", "kubenet". Default value: "kubenet". + :ivar network_plugin: Network plugin used for building Kubernetes network. Known values are: + "azure", "kubenet". Default value: "kubenet". :vartype network_plugin: str or ~azure.mgmt.containerservice.v2020_03_01.models.NetworkPlugin - :ivar network_policy: Network policy used for building Kubernetes network. Possible values - include: "calico", "azure". + :ivar network_policy: Network policy used for building Kubernetes network. Known values are: + "calico", "azure". :vartype network_policy: str or ~azure.mgmt.containerservice.v2020_03_01.models.NetworkPolicy - :ivar network_mode: Network mode used for building Kubernetes network. Possible values include: + :ivar network_mode: Network mode used for building Kubernetes network. Known values are: "transparent", "bridge". :vartype network_mode: str or ~azure.mgmt.containerservice.v2020_03_01.models.NetworkMode :ivar pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. @@ -1080,11 +1081,11 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): :ivar docker_bridge_cidr: A CIDR notation IP range assigned to the Docker bridge network. It must not overlap with any Subnet IP ranges or the Kubernetes service address range. :vartype docker_bridge_cidr: str - :ivar outbound_type: The outbound (egress) routing method. Possible values include: - "loadBalancer", "userDefinedRouting". Default value: "loadBalancer". + :ivar outbound_type: The outbound (egress) routing method. Known values are: "loadBalancer", + "userDefinedRouting". Default value: "loadBalancer". :vartype outbound_type: str or ~azure.mgmt.containerservice.v2020_03_01.models.OutboundType - :ivar load_balancer_sku: The load balancer sku for the managed cluster. Possible values - include: "standard", "basic". + :ivar load_balancer_sku: The load balancer sku for the managed cluster. Known values are: + "standard", "basic". :vartype load_balancer_sku: str or ~azure.mgmt.containerservice.v2020_03_01.models.LoadBalancerSku :ivar load_balancer_profile: Profile of the cluster load balancer. @@ -1115,27 +1116,27 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): def __init__( self, *, - network_plugin: Optional[Union[str, "NetworkPlugin"]] = "kubenet", - network_policy: Optional[Union[str, "NetworkPolicy"]] = None, - network_mode: Optional[Union[str, "NetworkMode"]] = None, + network_plugin: Optional[Union[str, "_models.NetworkPlugin"]] = "kubenet", + network_policy: Optional[Union[str, "_models.NetworkPolicy"]] = None, + network_mode: Optional[Union[str, "_models.NetworkMode"]] = None, pod_cidr: Optional[str] = "10.244.0.0/16", service_cidr: Optional[str] = "10.0.0.0/16", dns_service_ip: Optional[str] = "10.0.0.10", docker_bridge_cidr: Optional[str] = "172.17.0.1/16", - outbound_type: Optional[Union[str, "OutboundType"]] = "loadBalancer", - load_balancer_sku: Optional[Union[str, "LoadBalancerSku"]] = None, - load_balancer_profile: Optional["ManagedClusterLoadBalancerProfile"] = None, + outbound_type: Optional[Union[str, "_models.OutboundType"]] = "loadBalancer", + load_balancer_sku: Optional[Union[str, "_models.LoadBalancerSku"]] = None, + load_balancer_profile: Optional["_models.ManagedClusterLoadBalancerProfile"] = None, **kwargs ): """ - :keyword network_plugin: Network plugin used for building Kubernetes network. Possible values - include: "azure", "kubenet". Default value: "kubenet". + :keyword network_plugin: Network plugin used for building Kubernetes network. Known values are: + "azure", "kubenet". Default value: "kubenet". :paramtype network_plugin: str or ~azure.mgmt.containerservice.v2020_03_01.models.NetworkPlugin - :keyword network_policy: Network policy used for building Kubernetes network. Possible values - include: "calico", "azure". + :keyword network_policy: Network policy used for building Kubernetes network. Known values are: + "calico", "azure". :paramtype network_policy: str or ~azure.mgmt.containerservice.v2020_03_01.models.NetworkPolicy - :keyword network_mode: Network mode used for building Kubernetes network. Possible values - include: "transparent", "bridge". + :keyword network_mode: Network mode used for building Kubernetes network. Known values are: + "transparent", "bridge". :paramtype network_mode: str or ~azure.mgmt.containerservice.v2020_03_01.models.NetworkMode :keyword pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :paramtype pod_cidr: str @@ -1148,11 +1149,11 @@ def __init__( :keyword docker_bridge_cidr: A CIDR notation IP range assigned to the Docker bridge network. It must not overlap with any Subnet IP ranges or the Kubernetes service address range. :paramtype docker_bridge_cidr: str - :keyword outbound_type: The outbound (egress) routing method. Possible values include: - "loadBalancer", "userDefinedRouting". Default value: "loadBalancer". + :keyword outbound_type: The outbound (egress) routing method. Known values are: "loadBalancer", + "userDefinedRouting". Default value: "loadBalancer". :paramtype outbound_type: str or ~azure.mgmt.containerservice.v2020_03_01.models.OutboundType - :keyword load_balancer_sku: The load balancer sku for the managed cluster. Possible values - include: "standard", "basic". + :keyword load_balancer_sku: The load balancer sku for the managed cluster. Known values are: + "standard", "basic". :paramtype load_balancer_sku: str or ~azure.mgmt.containerservice.v2020_03_01.models.LoadBalancerSku :keyword load_balancer_profile: Profile of the cluster load balancer. @@ -1194,7 +1195,7 @@ class ContainerServiceSshConfiguration(msrest.serialization.Model): def __init__( self, *, - public_keys: List["ContainerServiceSshPublicKey"], + public_keys: List["_models.ContainerServiceSshPublicKey"], **kwargs ): """ @@ -1514,25 +1515,25 @@ def __init__( self, *, location: str, - identity: Optional["ManagedClusterIdentity"] = None, + identity: Optional["_models.ManagedClusterIdentity"] = None, kubernetes_version: Optional[str] = None, dns_prefix: Optional[str] = None, - agent_pool_profiles: Optional[List["ManagedClusterAgentPoolProfile"]] = None, - linux_profile: Optional["ContainerServiceLinuxProfile"] = None, - windows_profile: Optional["ManagedClusterWindowsProfile"] = None, - service_principal_profile: Optional["ManagedClusterServicePrincipalProfile"] = None, - addon_profiles: Optional[Dict[str, "ManagedClusterAddonProfile"]] = None, + agent_pool_profiles: Optional[List["_models.ManagedClusterAgentPoolProfile"]] = None, + linux_profile: Optional["_models.ContainerServiceLinuxProfile"] = None, + windows_profile: Optional["_models.ManagedClusterWindowsProfile"] = None, + service_principal_profile: Optional["_models.ManagedClusterServicePrincipalProfile"] = None, + addon_profiles: Optional[Dict[str, "_models.ManagedClusterAddonProfile"]] = None, node_resource_group: Optional[str] = None, enable_rbac: Optional[bool] = None, enable_pod_security_policy: Optional[bool] = None, - network_profile: Optional["ContainerServiceNetworkProfile"] = None, - aad_profile: Optional["ManagedClusterAADProfile"] = None, - auto_scaler_profile: Optional["ManagedClusterPropertiesAutoScalerProfile"] = None, - api_server_access_profile: Optional["ManagedClusterAPIServerAccessProfile"] = None, + network_profile: Optional["_models.ContainerServiceNetworkProfile"] = None, + aad_profile: Optional["_models.ManagedClusterAADProfile"] = None, + auto_scaler_profile: Optional["_models.ManagedClusterPropertiesAutoScalerProfile"] = None, + api_server_access_profile: Optional["_models.ManagedClusterAPIServerAccessProfile"] = None, disk_encryption_set_id: Optional[str] = None, - identity_profile: Optional[Dict[str, "ManagedClusterPropertiesIdentityProfileValue"]] = None, + identity_profile: Optional[Dict[str, "_models.ManagedClusterPropertiesIdentityProfileValue"]] = None, tags: Optional[Dict[str, str]] = None, - sku: Optional["ManagedClusterSKU"] = None, + sku: Optional["_models.ManagedClusterSKU"] = None, **kwargs ): """ @@ -1871,7 +1872,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): range of 0 to 100 (inclusive) for user pools and in the range of 1 to 100 (inclusive) for system pools. The default value is 1. :vartype count: int - :ivar vm_size: Size of agent VMs. Possible values include: "Standard_A1", "Standard_A10", + :ivar vm_size: Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -1920,7 +1921,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2020_03_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -1928,11 +1929,10 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :vartype min_count: int :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool - :ivar type: AgentPoolType represents types of an agent pool. Possible values include: + :ivar type: AgentPoolType represents types of an agent pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2020_03_01.models.AgentPoolType - :ivar mode: AgentPoolMode represents mode of an agent pool. Possible values include: "System", - "User". + :ivar mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", "User". :vartype mode: str or ~azure.mgmt.containerservice.v2020_03_01.models.AgentPoolMode :ivar orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -1946,12 +1946,12 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar enable_node_public_ip: Enable public IP for nodes. :vartype enable_node_public_ip: bool :ivar scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Possible values include: "Spot", "Low", "Regular". Default value: + priority. Default to regular. Known values are: "Spot", "Low", "Regular". Default value: "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_03_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy - for Spot or low priority virtual machine scale set. Default to Delete. Possible values include: + for Spot or low priority virtual machine scale set. Default to Delete. Known values are: "Delete", "Deallocate". Default value: "Delete". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_03_01.models.ScaleSetEvictionPolicy @@ -2002,21 +2002,21 @@ def __init__( self, *, count: Optional[int] = None, - vm_size: Optional[Union[str, "ContainerServiceVMSizeTypes"]] = None, + vm_size: Optional[Union[str, "_models.ContainerServiceVMSizeTypes"]] = None, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - type: Optional[Union[str, "AgentPoolType"]] = None, - mode: Optional[Union[str, "AgentPoolMode"]] = None, + type: Optional[Union[str, "_models.AgentPoolType"]] = None, + mode: Optional[Union[str, "_models.AgentPoolMode"]] = None, orchestrator_version: Optional[str] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, - scale_set_priority: Optional[Union[str, "ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", spot_max_price: Optional[float] = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, @@ -2028,7 +2028,7 @@ def __init__( range of 0 to 100 (inclusive) for user pools and in the range of 1 to 100 (inclusive) for system pools. The default value is 1. :paramtype count: int - :keyword vm_size: Size of agent VMs. Possible values include: "Standard_A1", "Standard_A10", + :keyword vm_size: Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -2077,7 +2077,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2020_03_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -2085,11 +2085,11 @@ def __init__( :paramtype min_count: int :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool - :keyword type: AgentPoolType represents types of an agent pool. Possible values include: + :keyword type: AgentPoolType represents types of an agent pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2020_03_01.models.AgentPoolType - :keyword mode: AgentPoolMode represents mode of an agent pool. Possible values include: - "System", "User". + :keyword mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", + "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2020_03_01.models.AgentPoolMode :keyword orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -2100,13 +2100,13 @@ def __init__( :keyword enable_node_public_ip: Enable public IP for nodes. :paramtype enable_node_public_ip: bool :keyword scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Possible values include: "Spot", "Low", "Regular". Default value: + priority. Default to regular. Known values are: "Spot", "Low", "Regular". Default value: "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_03_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction - policy for Spot or low priority virtual machine scale set. Default to Delete. Possible values - include: "Delete", "Deallocate". Default value: "Delete". + policy for Spot or low priority virtual machine scale set. Default to Delete. Known values are: + "Delete", "Deallocate". Default value: "Delete". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_03_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: SpotMaxPrice to be used to specify the maximum price you are willing @@ -2157,7 +2157,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): range of 0 to 100 (inclusive) for user pools and in the range of 1 to 100 (inclusive) for system pools. The default value is 1. :vartype count: int - :ivar vm_size: Size of agent VMs. Possible values include: "Standard_A1", "Standard_A10", + :ivar vm_size: Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -2206,7 +2206,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2020_03_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -2214,11 +2214,10 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :vartype min_count: int :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool - :ivar type: AgentPoolType represents types of an agent pool. Possible values include: + :ivar type: AgentPoolType represents types of an agent pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2020_03_01.models.AgentPoolType - :ivar mode: AgentPoolMode represents mode of an agent pool. Possible values include: "System", - "User". + :ivar mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", "User". :vartype mode: str or ~azure.mgmt.containerservice.v2020_03_01.models.AgentPoolMode :ivar orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -2232,12 +2231,12 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar enable_node_public_ip: Enable public IP for nodes. :vartype enable_node_public_ip: bool :ivar scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Possible values include: "Spot", "Low", "Regular". Default value: + priority. Default to regular. Known values are: "Spot", "Low", "Regular". Default value: "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_03_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy - for Spot or low priority virtual machine scale set. Default to Delete. Possible values include: + for Spot or low priority virtual machine scale set. Default to Delete. Known values are: "Delete", "Deallocate". Default value: "Delete". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_03_01.models.ScaleSetEvictionPolicy @@ -2294,21 +2293,21 @@ def __init__( *, name: str, count: Optional[int] = None, - vm_size: Optional[Union[str, "ContainerServiceVMSizeTypes"]] = None, + vm_size: Optional[Union[str, "_models.ContainerServiceVMSizeTypes"]] = None, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - type: Optional[Union[str, "AgentPoolType"]] = None, - mode: Optional[Union[str, "AgentPoolMode"]] = None, + type: Optional[Union[str, "_models.AgentPoolType"]] = None, + mode: Optional[Union[str, "_models.AgentPoolMode"]] = None, orchestrator_version: Optional[str] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, - scale_set_priority: Optional[Union[str, "ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", spot_max_price: Optional[float] = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, @@ -2320,7 +2319,7 @@ def __init__( range of 0 to 100 (inclusive) for user pools and in the range of 1 to 100 (inclusive) for system pools. The default value is 1. :paramtype count: int - :keyword vm_size: Size of agent VMs. Possible values include: "Standard_A1", "Standard_A10", + :keyword vm_size: Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -2369,7 +2368,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2020_03_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -2377,11 +2376,11 @@ def __init__( :paramtype min_count: int :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool - :keyword type: AgentPoolType represents types of an agent pool. Possible values include: + :keyword type: AgentPoolType represents types of an agent pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2020_03_01.models.AgentPoolType - :keyword mode: AgentPoolMode represents mode of an agent pool. Possible values include: - "System", "User". + :keyword mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", + "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2020_03_01.models.AgentPoolMode :keyword orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -2392,13 +2391,13 @@ def __init__( :keyword enable_node_public_ip: Enable public IP for nodes. :paramtype enable_node_public_ip: bool :keyword scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Possible values include: "Spot", "Low", "Regular". Default value: + priority. Default to regular. Known values are: "Spot", "Low", "Regular". Default value: "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_03_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction - policy for Spot or low priority virtual machine scale set. Default to Delete. Possible values - include: "Delete", "Deallocate". Default value: "Delete". + policy for Spot or low priority virtual machine scale set. Default to Delete. Known values are: + "Delete", "Deallocate". Default value: "Delete". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_03_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: SpotMaxPrice to be used to specify the maximum price you are willing @@ -2467,7 +2466,7 @@ class ManagedClusterIdentity(msrest.serialization.Model): :ivar type: The type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ resource group in agent nodes. Type 'None' will not use MSI for the managed cluster, - service principal will be used instead. Possible values include: "SystemAssigned", "None". + service principal will be used instead. Known values are: "SystemAssigned", "None". :vartype type: str or ~azure.mgmt.containerservice.v2020_03_01.models.ResourceIdentityType """ @@ -2485,15 +2484,14 @@ class ManagedClusterIdentity(msrest.serialization.Model): def __init__( self, *, - type: Optional[Union[str, "ResourceIdentityType"]] = None, + type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, **kwargs ): """ :keyword type: The type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ resource group in agent nodes. Type 'None' will not use MSI for the managed - cluster, service principal will be used instead. Possible values include: "SystemAssigned", - "None". + cluster, service principal will be used instead. Known values are: "SystemAssigned", "None". :paramtype type: str or ~azure.mgmt.containerservice.v2020_03_01.models.ResourceIdentityType """ super(ManagedClusterIdentity, self).__init__(**kwargs) @@ -2525,7 +2523,7 @@ class ManagedClusterListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["ManagedCluster"]] = None, + value: Optional[List["_models.ManagedCluster"]] = None, **kwargs ): """ @@ -2579,10 +2577,10 @@ class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): def __init__( self, *, - managed_outbound_i_ps: Optional["ManagedClusterLoadBalancerProfileManagedOutboundIPs"] = None, - outbound_ip_prefixes: Optional["ManagedClusterLoadBalancerProfileOutboundIPPrefixes"] = None, - outbound_i_ps: Optional["ManagedClusterLoadBalancerProfileOutboundIPs"] = None, - effective_outbound_i_ps: Optional[List["ResourceReference"]] = None, + managed_outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileManagedOutboundIPs"] = None, + outbound_ip_prefixes: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPPrefixes"] = None, + outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPs"] = None, + effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, allocated_outbound_ports: Optional[int] = 0, idle_timeout_in_minutes: Optional[int] = 30, **kwargs @@ -2665,7 +2663,7 @@ class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.M def __init__( self, *, - public_ip_prefixes: Optional[List["ResourceReference"]] = None, + public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, **kwargs ): """ @@ -2691,7 +2689,7 @@ class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): def __init__( self, *, - public_i_ps: Optional[List["ResourceReference"]] = None, + public_i_ps: Optional[List["_models.ResourceReference"]] = None, **kwargs ): """ @@ -2712,7 +2710,7 @@ class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): :ivar name: Pool name. :vartype name: str :ivar os_type: Required. OsType to be used to specify os type. Choose from Linux and Windows. - Default to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2020_03_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -2735,9 +2733,9 @@ def __init__( self, *, kubernetes_version: str, - os_type: Union[str, "OSType"] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", name: Optional[str] = None, - upgrades: Optional[List["ManagedClusterPoolUpgradeProfileUpgradesItem"]] = None, + upgrades: Optional[List["_models.ManagedClusterPoolUpgradeProfileUpgradesItem"]] = None, **kwargs ): """ @@ -2746,7 +2744,7 @@ def __init__( :keyword name: Pool name. :paramtype name: str :keyword os_type: Required. OsType to be used to specify os type. Choose from Linux and - Windows. Default to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Windows. Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2020_03_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: @@ -2949,9 +2947,9 @@ def __init__( class ManagedClusterSKU(msrest.serialization.Model): """ManagedClusterSKU. - :ivar name: Name of a managed cluster SKU. Possible values include: "Basic". + :ivar name: Name of a managed cluster SKU. Known values are: "Basic". :vartype name: str or ~azure.mgmt.containerservice.v2020_03_01.models.ManagedClusterSKUName - :ivar tier: Tier of a managed cluster SKU. Possible values include: "Paid", "Free". + :ivar tier: Tier of a managed cluster SKU. Known values are: "Paid", "Free". :vartype tier: str or ~azure.mgmt.containerservice.v2020_03_01.models.ManagedClusterSKUTier """ @@ -2963,14 +2961,14 @@ class ManagedClusterSKU(msrest.serialization.Model): def __init__( self, *, - name: Optional[Union[str, "ManagedClusterSKUName"]] = None, - tier: Optional[Union[str, "ManagedClusterSKUTier"]] = None, + name: Optional[Union[str, "_models.ManagedClusterSKUName"]] = None, + tier: Optional[Union[str, "_models.ManagedClusterSKUTier"]] = None, **kwargs ): """ - :keyword name: Name of a managed cluster SKU. Possible values include: "Basic". + :keyword name: Name of a managed cluster SKU. Known values are: "Basic". :paramtype name: str or ~azure.mgmt.containerservice.v2020_03_01.models.ManagedClusterSKUName - :keyword tier: Tier of a managed cluster SKU. Possible values include: "Paid", "Free". + :keyword tier: Tier of a managed cluster SKU. Known values are: "Paid", "Free". :paramtype tier: str or ~azure.mgmt.containerservice.v2020_03_01.models.ManagedClusterSKUTier """ super(ManagedClusterSKU, self).__init__(**kwargs) @@ -3019,8 +3017,8 @@ class ManagedClusterUpgradeProfile(msrest.serialization.Model): def __init__( self, *, - control_plane_profile: "ManagedClusterPoolUpgradeProfile", - agent_pool_profiles: List["ManagedClusterPoolUpgradeProfile"], + control_plane_profile: "_models.ManagedClusterPoolUpgradeProfile", + agent_pool_profiles: List["_models.ManagedClusterPoolUpgradeProfile"], **kwargs ): """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/models/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/models/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/operations/__init__.py index 5aac40228eec..403c0174f052 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/operations/__init__.py @@ -10,8 +10,13 @@ from ._managed_clusters_operations import ManagedClustersOperations from ._agent_pools_operations import AgentPoolsOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'Operations', 'ManagedClustersOperations', 'AgentPoolsOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/operations/_agent_pools_operations.py index d865bed88cc8..7340d4418472 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/operations/_agent_pools_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -35,9 +35,12 @@ def build_list_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools") # pylint: disable=line-too-long path_format_arguments = { @@ -49,18 +52,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -72,9 +73,12 @@ def build_get_request( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -87,18 +91,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -109,14 +111,17 @@ def build_create_or_update_request_initial( resource_name: str, agent_pool_name: str, *, - json: JSONType = None, + json: Optional[_models.AgentPool] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-03-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -129,20 +134,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -156,9 +159,12 @@ def build_delete_request_initial( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -171,18 +177,16 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -194,9 +198,12 @@ def build_get_upgrade_profile_request( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default") # pylint: disable=line-too-long path_format_arguments = { @@ -209,18 +216,16 @@ def build_get_upgrade_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -231,9 +236,12 @@ def build_get_available_agent_pool_versions_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions") # pylint: disable=line-too-long path_format_arguments = { @@ -245,42 +253,38 @@ def build_get_available_agent_pool_versions_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class AgentPoolsOperations(object): - """AgentPoolsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class AgentPoolsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2020_03_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2020_03_01.ContainerServiceClient`'s + :attr:`agent_pools` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -288,7 +292,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Iterable["_models.AgentPoolListResult"]: + ) -> Iterable[_models.AgentPoolListResult]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. The operation returns properties @@ -304,13 +308,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_03_01.models.AgentPoolListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -320,9 +327,11 @@ def prepare_request(next_link=None): resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -332,9 +341,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -374,7 +385,7 @@ def get( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPool": + ) -> _models.AgentPool: """Gets the agent pool. Gets the details of the agent pool by managed cluster and resource group. @@ -390,13 +401,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2020_03_01.models.AgentPool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] request = build_get_request( @@ -406,11 +420,13 @@ def get( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -436,17 +452,20 @@ def _create_or_update_initial( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> "_models.AgentPool": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] + ) -> _models.AgentPool: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] _json = self._serialize.body(parameters, 'AgentPool') @@ -459,11 +478,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -494,9 +515,9 @@ def begin_create_or_update( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> LROPoller["_models.AgentPool"]: + ) -> LROPoller[_models.AgentPool]: """Creates or updates an agent pool. Creates or updates an agent pool in the specified managed cluster. @@ -522,17 +543,20 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_03_01.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, @@ -540,20 +564,27 @@ def begin_create_or_update( 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): - response = pipeline_response.http_response deserialized = self._deserialize('AgentPool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -573,13 +604,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements agent_pool_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -589,11 +623,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -640,21 +676,26 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-03-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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) @@ -664,8 +705,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -685,7 +732,7 @@ def get_upgrade_profile( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPoolUpgradeProfile": + ) -> _models.AgentPoolUpgradeProfile: """Gets upgrade profile for an agent pool. Gets the details of the upgrade profile for an agent pool with a specified resource group and @@ -702,13 +749,16 @@ def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2020_03_01.models.AgentPoolUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] request = build_get_upgrade_profile_request( @@ -718,11 +768,13 @@ def get_upgrade_profile( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -749,7 +801,7 @@ def get_available_agent_pool_versions( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.AgentPoolAvailableVersions": + ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported versions for the specified agent pool. Gets a list of supported versions for the specified agent pool. @@ -763,13 +815,16 @@ def get_available_agent_pool_versions( :rtype: ~azure.mgmt.containerservice.v2020_03_01.models.AgentPoolAvailableVersions :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolAvailableVersions"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] request = build_get_available_agent_pool_versions_request( @@ -778,11 +833,13 @@ def get_available_agent_pool_versions( resource_name=resource_name, api_version=api_version, template_url=self.get_available_agent_pool_versions.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/operations/_managed_clusters_operations.py index d9264f957add..e4555d18389a 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/operations/_managed_clusters_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -33,9 +33,12 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters") path_format_arguments = { @@ -45,18 +48,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -66,9 +67,12 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters") # pylint: disable=line-too-long path_format_arguments = { @@ -79,18 +83,16 @@ def build_list_by_resource_group_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -101,9 +103,12 @@ def build_get_upgrade_profile_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default") # pylint: disable=line-too-long path_format_arguments = { @@ -115,18 +120,16 @@ def build_get_upgrade_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -138,9 +141,12 @@ def build_get_access_profile_request( role_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -153,18 +159,16 @@ def build_get_access_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -175,9 +179,12 @@ def build_list_cluster_admin_credentials_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -189,18 +196,16 @@ def build_list_cluster_admin_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -211,9 +216,12 @@ def build_list_cluster_user_credentials_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -225,18 +233,16 @@ def build_list_cluster_user_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -247,9 +253,12 @@ def build_list_cluster_monitoring_user_credentials_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -261,18 +270,16 @@ def build_list_cluster_monitoring_user_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -283,9 +290,12 @@ def build_get_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -297,18 +307,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -318,14 +326,17 @@ def build_create_or_update_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedCluster] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-03-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -337,20 +348,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -362,14 +371,17 @@ def build_update_tags_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.TagsObject] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-03-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -381,20 +393,18 @@ def build_update_tags_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -407,9 +417,12 @@ def build_delete_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -421,18 +434,16 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -442,14 +453,17 @@ def build_reset_service_principal_profile_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedClusterServicePrincipalProfile] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-03-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile") # pylint: disable=line-too-long path_format_arguments = { @@ -461,20 +475,18 @@ def build_reset_service_principal_profile_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -486,14 +498,17 @@ def build_reset_aad_profile_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedClusterAADProfile] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-03-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile") # pylint: disable=line-too-long path_format_arguments = { @@ -505,20 +520,18 @@ def build_reset_aad_profile_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -531,9 +544,12 @@ def build_rotate_cluster_certificates_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates") # pylint: disable=line-too-long path_format_arguments = { @@ -545,48 +561,44 @@ def build_rotate_cluster_certificates_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class ManagedClustersOperations(object): - """ManagedClustersOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ManagedClustersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2020_03_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2020_03_01.ContainerServiceClient`'s + :attr:`managed_clusters` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> Iterable["_models.ManagedClusterListResult"]: + ) -> Iterable[_models.ManagedClusterListResult]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. The operation returns properties @@ -599,13 +611,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_03_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -613,9 +628,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -623,9 +640,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -663,7 +682,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.ManagedClusterListResult"]: + ) -> Iterable[_models.ManagedClusterListResult]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. The operation returns @@ -678,13 +697,16 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_03_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -693,9 +715,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -704,9 +728,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -745,7 +771,7 @@ def get_upgrade_profile( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedClusterUpgradeProfile": + ) -> _models.ManagedClusterUpgradeProfile: """Gets upgrade profile for a managed cluster. Gets the details of the upgrade profile for a managed cluster with a specified resource group @@ -760,13 +786,16 @@ def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2020_03_01.models.ManagedClusterUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] request = build_get_upgrade_profile_request( @@ -775,11 +804,13 @@ def get_upgrade_profile( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -807,7 +838,7 @@ def get_access_profile( resource_name: str, role_name: str, **kwargs: Any - ) -> "_models.ManagedClusterAccessProfile": + ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. Gets the accessProfile for the specified role name of the managed cluster with a specified @@ -824,13 +855,16 @@ def get_access_profile( :rtype: ~azure.mgmt.containerservice.v2020_03_01.models.ManagedClusterAccessProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterAccessProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] request = build_get_access_profile_request( @@ -840,11 +874,13 @@ def get_access_profile( role_name=role_name, api_version=api_version, template_url=self.get_access_profile.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -871,7 +907,7 @@ def list_cluster_admin_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster admin credential of a managed cluster. Gets cluster admin credential of the managed cluster with a specified resource group and name. @@ -885,13 +921,16 @@ def list_cluster_admin_credentials( :rtype: ~azure.mgmt.containerservice.v2020_03_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_admin_credentials_request( @@ -900,11 +939,13 @@ def list_cluster_admin_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_admin_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -931,7 +972,7 @@ def list_cluster_user_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster user credential of a managed cluster. Gets cluster user credential of the managed cluster with a specified resource group and name. @@ -945,13 +986,16 @@ def list_cluster_user_credentials( :rtype: ~azure.mgmt.containerservice.v2020_03_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_user_credentials_request( @@ -960,11 +1004,13 @@ def list_cluster_user_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -991,7 +1037,7 @@ def list_cluster_monitoring_user_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster monitoring user credential of a managed cluster. Gets cluster monitoring user credential of the managed cluster with a specified resource group @@ -1006,13 +1052,16 @@ def list_cluster_monitoring_user_credentials( :rtype: ~azure.mgmt.containerservice.v2020_03_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_monitoring_user_credentials_request( @@ -1021,11 +1070,13 @@ def list_cluster_monitoring_user_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1052,7 +1103,7 @@ def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedCluster": + ) -> _models.ManagedCluster: """Gets a managed cluster. Gets the details of the managed cluster with a specified resource group and name. @@ -1066,13 +1117,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2020_03_01.models.ManagedCluster :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] request = build_get_request( @@ -1081,11 +1135,13 @@ def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1110,17 +1166,20 @@ def _create_or_update_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2020-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'ManagedCluster') @@ -1132,11 +1191,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1166,9 +1227,9 @@ def begin_create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> LROPoller["_models.ManagedCluster"]: + ) -> LROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. Creates or updates a managed cluster with the specified configuration for agents and Kubernetes @@ -1194,37 +1255,47 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_03_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1241,17 +1312,20 @@ def _update_tags_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'TagsObject') @@ -1263,11 +1337,13 @@ def _update_tags_initial( content_type=content_type, json=_json, template_url=self._update_tags_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1293,9 +1369,9 @@ def begin_update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> LROPoller["_models.ManagedCluster"]: + ) -> LROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates a managed cluster with the specified tags. @@ -1320,37 +1396,47 @@ def begin_update_tags( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_03_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._update_tags_initial( + raw_result = self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1369,13 +1455,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -1384,11 +1473,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1432,20 +1523,25 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-03-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_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) @@ -1455,8 +1551,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1473,17 +1575,20 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2020-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') @@ -1495,11 +1600,13 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re content_type=content_type, json=_json, template_url=self._reset_service_principal_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1521,7 +1628,7 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> LROPoller[None]: """Reset Service Principal Profile of a managed cluster. @@ -1548,23 +1655,28 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._reset_service_principal_profile_initial( + raw_result = self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1574,8 +1686,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1592,17 +1710,20 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2020-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') @@ -1614,11 +1735,13 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement content_type=content_type, json=_json, template_url=self._reset_aad_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1640,7 +1763,7 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> LROPoller[None]: """Reset AAD Profile of a managed cluster. @@ -1666,23 +1789,28 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._reset_aad_profile_initial( + raw_result = self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1692,8 +1820,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1712,13 +1846,16 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_rotate_cluster_certificates_request_initial( @@ -1727,11 +1864,13 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return resource_name=resource_name, api_version=api_version, template_url=self._rotate_cluster_certificates_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1775,20 +1914,25 @@ def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-st :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-03-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._rotate_cluster_certificates_initial( + raw_result = self._rotate_cluster_certificates_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) @@ -1798,8 +1942,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/operations/_operations.py index 2d73a6ef9ef0..4a174c2bb327 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/operations/_operations.py @@ -16,6 +16,7 @@ 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 @@ -29,55 +30,54 @@ def build_list_request( **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.ContainerService/operations") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class Operations(object): - """Operations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2020_03_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2020_03_01.ContainerServiceClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> Iterable["_models.OperationListResult"]: + ) -> Iterable[_models.OperationListResult]: """Gets a list of compute operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -86,31 +86,38 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_03_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_03_01/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/__init__.py index 53c675bd95e2..37a5f9e02e6f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._container_service_client import ContainerServiceClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['ContainerServiceClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/_container_service_client.py index c19752099210..5453f317a26f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/_container_service_client.py @@ -60,9 +60,15 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.managed_clusters = ManagedClustersOperations(self._client, self._config, self._serialize, self._deserialize) - self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_clusters = ManagedClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.agent_pools = AgentPoolsOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/aio/__init__.py index 53c675bd95e2..37a5f9e02e6f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/aio/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/aio/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._container_service_client import ContainerServiceClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['ContainerServiceClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/aio/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/aio/_container_service_client.py index 3fa14a8ba33f..fb7557c25e9a 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/aio/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/aio/_container_service_client.py @@ -61,9 +61,15 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.managed_clusters = ManagedClustersOperations(self._client, self._config, self._serialize, self._deserialize) - self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_clusters = ManagedClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.agent_pools = AgentPoolsOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/aio/operations/__init__.py index 5aac40228eec..403c0174f052 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/aio/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/aio/operations/__init__.py @@ -10,8 +10,13 @@ from ._managed_clusters_operations import ManagedClustersOperations from ._agent_pools_operations import AgentPoolsOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'Operations', 'ManagedClustersOperations', 'AgentPoolsOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/aio/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/aio/operations/_agent_pools_operations.py index ef4a0968349a..897f100993ea 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/aio/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/aio/operations/_agent_pools_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. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ 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 @@ -26,26 +27,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class AgentPoolsOperations: - """AgentPoolsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2020_04_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2020_04_01.aio.ContainerServiceClient`'s + :attr:`agent_pools` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -53,7 +52,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> AsyncIterable["_models.AgentPoolListResult"]: + ) -> AsyncIterable[_models.AgentPoolListResult]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. The operation returns properties @@ -69,13 +68,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_04_01.models.AgentPoolListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-04-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -85,9 +87,11 @@ def prepare_request(next_link=None): resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -97,9 +101,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -139,7 +145,7 @@ async def get( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPool": + ) -> _models.AgentPool: """Gets the agent pool. Gets the details of the agent pool by managed cluster and resource group. @@ -155,13 +161,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2020_04_01.models.AgentPool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-04-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] request = build_get_request( @@ -171,11 +180,13 @@ async def get( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -201,17 +212,20 @@ async def _create_or_update_initial( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> "_models.AgentPool": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] + ) -> _models.AgentPool: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2020-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] _json = self._serialize.body(parameters, 'AgentPool') @@ -224,11 +238,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -259,9 +275,9 @@ async def begin_create_or_update( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> AsyncLROPoller["_models.AgentPool"]: + ) -> AsyncLROPoller[_models.AgentPool]: """Creates or updates an agent pool. Creates or updates an agent pool in the specified managed cluster. @@ -288,17 +304,20 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_04_01.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, @@ -306,20 +325,27 @@ async def begin_create_or_update( 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): - response = pipeline_response.http_response deserialized = self._deserialize('AgentPool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -339,13 +365,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements agent_pool_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-04-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -355,11 +384,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -406,21 +437,26 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-04-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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) @@ -430,8 +466,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -451,7 +493,7 @@ async def get_upgrade_profile( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPoolUpgradeProfile": + ) -> _models.AgentPoolUpgradeProfile: """Gets upgrade profile for an agent pool. Gets the details of the upgrade profile for an agent pool with a specified resource group and @@ -468,13 +510,16 @@ async def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2020_04_01.models.AgentPoolUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-04-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] request = build_get_upgrade_profile_request( @@ -484,11 +529,13 @@ async def get_upgrade_profile( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -515,7 +562,7 @@ async def get_available_agent_pool_versions( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.AgentPoolAvailableVersions": + ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported versions for the specified agent pool. Gets a list of supported versions for the specified agent pool. @@ -529,13 +576,16 @@ async def get_available_agent_pool_versions( :rtype: ~azure.mgmt.containerservice.v2020_04_01.models.AgentPoolAvailableVersions :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolAvailableVersions"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-04-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] request = build_get_available_agent_pool_versions_request( @@ -544,11 +594,13 @@ async def get_available_agent_pool_versions( resource_name=resource_name, api_version=api_version, template_url=self.get_available_agent_pool_versions.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/aio/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/aio/operations/_managed_clusters_operations.py index a9902f18feab..f253c07eccc3 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/aio/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/aio/operations/_managed_clusters_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. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ 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 @@ -26,32 +27,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ManagedClustersOperations: - """ManagedClustersOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2020_04_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2020_04_01.aio.ContainerServiceClient`'s + :attr:`managed_clusters` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.ManagedClusterListResult"]: + ) -> AsyncIterable[_models.ManagedClusterListResult]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. The operation returns properties @@ -64,13 +63,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_04_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-04-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -78,9 +80,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -88,9 +92,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -128,7 +134,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ManagedClusterListResult"]: + ) -> AsyncIterable[_models.ManagedClusterListResult]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. The operation returns @@ -143,13 +149,16 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_04_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-04-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -158,9 +167,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -169,9 +180,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -210,7 +223,7 @@ async def get_upgrade_profile( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedClusterUpgradeProfile": + ) -> _models.ManagedClusterUpgradeProfile: """Gets upgrade profile for a managed cluster. Gets the details of the upgrade profile for a managed cluster with a specified resource group @@ -225,13 +238,16 @@ async def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2020_04_01.models.ManagedClusterUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-04-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] request = build_get_upgrade_profile_request( @@ -240,11 +256,13 @@ async def get_upgrade_profile( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -272,7 +290,7 @@ async def get_access_profile( resource_name: str, role_name: str, **kwargs: Any - ) -> "_models.ManagedClusterAccessProfile": + ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. Gets the accessProfile for the specified role name of the managed cluster with a specified @@ -293,13 +311,16 @@ async def get_access_profile( :rtype: ~azure.mgmt.containerservice.v2020_04_01.models.ManagedClusterAccessProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterAccessProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-04-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] request = build_get_access_profile_request( @@ -309,11 +330,13 @@ async def get_access_profile( role_name=role_name, api_version=api_version, template_url=self.get_access_profile.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -340,7 +363,7 @@ async def list_cluster_admin_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster admin credential of a managed cluster. Gets cluster admin credential of the managed cluster with a specified resource group and name. @@ -354,13 +377,16 @@ async def list_cluster_admin_credentials( :rtype: ~azure.mgmt.containerservice.v2020_04_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-04-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_admin_credentials_request( @@ -369,11 +395,13 @@ async def list_cluster_admin_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_admin_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -400,7 +428,7 @@ async def list_cluster_user_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster user credential of a managed cluster. Gets cluster user credential of the managed cluster with a specified resource group and name. @@ -414,13 +442,16 @@ async def list_cluster_user_credentials( :rtype: ~azure.mgmt.containerservice.v2020_04_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-04-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_user_credentials_request( @@ -429,11 +460,13 @@ async def list_cluster_user_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -460,7 +493,7 @@ async def list_cluster_monitoring_user_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster monitoring user credential of a managed cluster. Gets cluster monitoring user credential of the managed cluster with a specified resource group @@ -475,13 +508,16 @@ async def list_cluster_monitoring_user_credentials( :rtype: ~azure.mgmt.containerservice.v2020_04_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-04-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_monitoring_user_credentials_request( @@ -490,11 +526,13 @@ async def list_cluster_monitoring_user_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -521,7 +559,7 @@ async def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedCluster": + ) -> _models.ManagedCluster: """Gets a managed cluster. Gets the details of the managed cluster with a specified resource group and name. @@ -535,13 +573,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2020_04_01.models.ManagedCluster :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-04-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] request = build_get_request( @@ -550,11 +591,13 @@ async def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -579,17 +622,20 @@ async def _create_or_update_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2020-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'ManagedCluster') @@ -601,11 +647,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -635,9 +683,9 @@ async def begin_create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> AsyncLROPoller["_models.ManagedCluster"]: + ) -> AsyncLROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. Creates or updates a managed cluster with the specified configuration for agents and Kubernetes @@ -663,37 +711,47 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_04_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -710,17 +768,20 @@ async def _update_tags_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'TagsObject') @@ -732,11 +793,13 @@ async def _update_tags_initial( content_type=content_type, json=_json, template_url=self._update_tags_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -762,9 +825,9 @@ async def begin_update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> AsyncLROPoller["_models.ManagedCluster"]: + ) -> AsyncLROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates a managed cluster with the specified tags. @@ -789,37 +852,47 @@ async def begin_update_tags( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_04_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._update_tags_initial( + raw_result = await self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -838,13 +911,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-04-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -853,11 +929,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -901,20 +979,25 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-04-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_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) @@ -924,8 +1007,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -942,17 +1031,20 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2020-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') @@ -964,11 +1056,13 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist content_type=content_type, json=_json, template_url=self._reset_service_principal_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -990,7 +1084,7 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> AsyncLROPoller[None]: """Reset Service Principal Profile of a managed cluster. @@ -1017,23 +1111,28 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._reset_service_principal_profile_initial( + raw_result = await self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1043,8 +1142,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1061,17 +1166,20 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') @@ -1083,11 +1191,13 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta content_type=content_type, json=_json, template_url=self._reset_aad_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1109,7 +1219,7 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> AsyncLROPoller[None]: """Reset AAD Profile of a managed cluster. @@ -1135,23 +1245,28 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._reset_aad_profile_initial( + raw_result = await self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1161,8 +1276,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1181,13 +1302,16 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-04-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_rotate_cluster_certificates_request_initial( @@ -1196,11 +1320,13 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- resource_name=resource_name, api_version=api_version, template_url=self._rotate_cluster_certificates_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1244,20 +1370,25 @@ async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-ret :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-04-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._rotate_cluster_certificates_initial( + raw_result = await self._rotate_cluster_certificates_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) @@ -1267,8 +1398,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/aio/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/aio/operations/_operations.py index 0017bbca448d..75d4196ea8f7 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/aio/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/aio/operations/_operations.py @@ -14,6 +14,7 @@ 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 @@ -23,32 +24,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class Operations: - """Operations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2020_04_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2020_04_01.aio.ContainerServiceClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.OperationListResult"]: + ) -> AsyncIterable[_models.OperationListResult]: """Gets a list of compute operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -57,31 +56,38 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_04_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-04-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/aio/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/aio/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/models/__init__.py index 60aa30eba452..56476cc49a88 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/models/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/models/__init__.py @@ -73,7 +73,9 @@ ScaleSetEvictionPolicy, ScaleSetPriority, ) - +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'AgentPool', 'AgentPoolAvailableVersions', @@ -139,3 +141,5 @@ 'ScaleSetEvictionPolicy', 'ScaleSetPriority', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/models/_container_service_client_enums.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/models/_container_service_client_enums.py index 8003b6350d2f..2d070cb2ffce 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/models/_container_service_client_enums.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/models/_container_service_client_enums.py @@ -7,25 +7,24 @@ # -------------------------------------------------------------------------- from enum import Enum -from six import with_metaclass from azure.core import CaseInsensitiveEnumMeta -class AgentPoolMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class AgentPoolMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """AgentPoolMode represents mode of an agent pool. """ SYSTEM = "System" USER = "User" -class AgentPoolType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class AgentPoolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """AgentPoolType represents types of an agent pool. """ VIRTUAL_MACHINE_SCALE_SETS = "VirtualMachineScaleSets" AVAILABILITY_SET = "AvailabilitySet" -class ContainerServiceStorageProfileTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the orchestrator choice. """ @@ -33,7 +32,7 @@ class ContainerServiceStorageProfileTypes(with_metaclass(CaseInsensitiveEnumMeta STORAGE_ACCOUNT = "StorageAccount" MANAGED_DISKS = "ManagedDisks" -class ContainerServiceVMSizeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Size of agent VMs. """ @@ -212,7 +211,7 @@ class ContainerServiceVMSizeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, E STANDARD_NV24 = "Standard_NV24" STANDARD_NV6 = "Standard_NV6" -class Count(with_metaclass(CaseInsensitiveEnumMeta, int, Enum)): +class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): """Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, and 5. The default value is 1. """ @@ -221,62 +220,62 @@ class Count(with_metaclass(CaseInsensitiveEnumMeta, int, Enum)): THREE = 3 FIVE = 5 -class LoadBalancerSku(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class LoadBalancerSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The load balancer sku for the managed cluster. """ STANDARD = "standard" BASIC = "basic" -class ManagedClusterSKUName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ManagedClusterSKUName(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Name of a managed cluster SKU. """ BASIC = "Basic" -class ManagedClusterSKUTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ManagedClusterSKUTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Tier of a managed cluster SKU. """ PAID = "Paid" FREE = "Free" -class NetworkMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Network mode used for building Kubernetes network. """ TRANSPARENT = "transparent" BRIDGE = "bridge" -class NetworkPlugin(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkPlugin(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Network plugin used for building Kubernetes network. """ AZURE = "azure" KUBENET = "kubenet" -class NetworkPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Network policy used for building Kubernetes network. """ CALICO = "calico" AZURE = "azure" -class OSType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux. """ LINUX = "Linux" WINDOWS = "Windows" -class OutboundType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OutboundType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The outbound (egress) routing method. """ LOAD_BALANCER = "loadBalancer" USER_DEFINED_ROUTING = "userDefinedRouting" -class ResourceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ resource group in agent nodes. Type 'None' will not use MSI for the managed cluster, service @@ -286,7 +285,7 @@ class ResourceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): SYSTEM_ASSIGNED = "SystemAssigned" NONE = "None" -class ScaleSetEvictionPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ScaleSetEvictionPolicy to be used to specify eviction policy for Spot virtual machine scale set. Default to Delete. """ @@ -294,7 +293,7 @@ class ScaleSetEvictionPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)) DELETE = "Delete" DEALLOCATE = "Deallocate" -class ScaleSetPriority(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ScaleSetPriority(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ScaleSetPriority to be used to specify virtual machine scale set priority. Default to regular. """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/models/_models_py3.py index 340eb7273d6a..74f512963268 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/models/_models_py3.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/models/_models_py3.py @@ -6,11 +6,13 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Dict, List, Optional, Union +from typing import Dict, List, Optional, TYPE_CHECKING, Union import msrest.serialization -from ._container_service_client_enums import * +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + import __init__ as _models class SubResource(msrest.serialization.Model): @@ -67,7 +69,7 @@ class AgentPool(SubResource): range of 0 to 100 (inclusive) for user pools and in the range of 1 to 100 (inclusive) for system pools. The default value is 1. :vartype count: int - :ivar vm_size: Size of agent VMs. Possible values include: "Standard_A1", "Standard_A10", + :ivar vm_size: Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -116,7 +118,7 @@ class AgentPool(SubResource): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2020_04_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -124,12 +126,11 @@ class AgentPool(SubResource): :vartype min_count: int :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool - :ivar type_properties_type: AgentPoolType represents types of an agent pool. Possible values - include: "VirtualMachineScaleSets", "AvailabilitySet". + :ivar type_properties_type: AgentPoolType represents types of an agent pool. Known values are: + "VirtualMachineScaleSets", "AvailabilitySet". :vartype type_properties_type: str or ~azure.mgmt.containerservice.v2020_04_01.models.AgentPoolType - :ivar mode: AgentPoolMode represents mode of an agent pool. Possible values include: "System", - "User". + :ivar mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", "User". :vartype mode: str or ~azure.mgmt.containerservice.v2020_04_01.models.AgentPoolMode :ivar orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -148,12 +149,11 @@ class AgentPool(SubResource): :ivar enable_node_public_ip: Enable public IP for nodes. :vartype enable_node_public_ip: bool :ivar scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Possible values include: "Spot", "Regular". Default value: - "Regular". + priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_04_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy - for Spot virtual machine scale set. Default to Delete. Possible values include: "Delete", + for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", "Deallocate". Default value: "Delete". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_04_01.models.ScaleSetEvictionPolicy @@ -212,23 +212,23 @@ def __init__( self, *, count: Optional[int] = None, - vm_size: Optional[Union[str, "ContainerServiceVMSizeTypes"]] = None, + vm_size: Optional[Union[str, "_models.ContainerServiceVMSizeTypes"]] = None, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - type_properties_type: Optional[Union[str, "AgentPoolType"]] = None, - mode: Optional[Union[str, "AgentPoolMode"]] = None, + type_properties_type: Optional[Union[str, "_models.AgentPoolType"]] = None, + mode: Optional[Union[str, "_models.AgentPoolMode"]] = None, orchestrator_version: Optional[str] = None, node_image_version: Optional[str] = None, - upgrade_settings: Optional["AgentPoolUpgradeSettings"] = None, + upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, - scale_set_priority: Optional[Union[str, "ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", spot_max_price: Optional[float] = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, @@ -240,7 +240,7 @@ def __init__( range of 0 to 100 (inclusive) for user pools and in the range of 1 to 100 (inclusive) for system pools. The default value is 1. :paramtype count: int - :keyword vm_size: Size of agent VMs. Possible values include: "Standard_A1", "Standard_A10", + :keyword vm_size: Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -289,7 +289,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2020_04_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -297,12 +297,12 @@ def __init__( :paramtype min_count: int :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool - :keyword type_properties_type: AgentPoolType represents types of an agent pool. Possible values - include: "VirtualMachineScaleSets", "AvailabilitySet". + :keyword type_properties_type: AgentPoolType represents types of an agent pool. Known values + are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type_properties_type: str or ~azure.mgmt.containerservice.v2020_04_01.models.AgentPoolType - :keyword mode: AgentPoolMode represents mode of an agent pool. Possible values include: - "System", "User". + :keyword mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", + "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2020_04_01.models.AgentPoolMode :keyword orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -318,13 +318,12 @@ def __init__( :keyword enable_node_public_ip: Enable public IP for nodes. :paramtype enable_node_public_ip: bool :keyword scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Possible values include: "Spot", "Regular". Default value: - "Regular". + priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_04_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction - policy for Spot virtual machine scale set. Default to Delete. Possible values include: - "Delete", "Deallocate". Default value: "Delete". + policy for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", + "Deallocate". Default value: "Delete". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_04_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: SpotMaxPrice to be used to specify the maximum price you are willing @@ -398,7 +397,7 @@ class AgentPoolAvailableVersions(msrest.serialization.Model): def __init__( self, *, - agent_pool_versions: Optional[List["AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem"]] = None, + agent_pool_versions: Optional[List["_models.AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem"]] = None, **kwargs ): """ @@ -475,7 +474,7 @@ class AgentPoolListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["AgentPool"]] = None, + value: Optional[List["_models.AgentPool"]] = None, **kwargs ): """ @@ -503,7 +502,7 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): :ivar kubernetes_version: Required. Kubernetes version (major, minor, patch). :vartype kubernetes_version: str :ivar os_type: Required. OsType to be used to specify os type. Choose from Linux and Windows. - Default to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2020_04_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -535,8 +534,8 @@ def __init__( self, *, kubernetes_version: str, - os_type: Union[str, "OSType"] = "Linux", - upgrades: Optional[List["AgentPoolUpgradeProfilePropertiesUpgradesItem"]] = None, + os_type: Union[str, "_models.OSType"] = "Linux", + upgrades: Optional[List["_models.AgentPoolUpgradeProfilePropertiesUpgradesItem"]] = None, latest_node_image_version: Optional[str] = None, **kwargs ): @@ -544,7 +543,7 @@ def __init__( :keyword kubernetes_version: Required. Kubernetes version (major, minor, patch). :paramtype kubernetes_version: str :keyword os_type: Required. OsType to be used to specify os type. Choose from Linux and - Windows. Default to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Windows. Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2020_04_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: @@ -719,23 +718,23 @@ class BaseManagedCluster(msrest.serialization.Model): def __init__( self, *, - identity: Optional["ManagedClusterIdentity"] = None, + identity: Optional["_models.ManagedClusterIdentity"] = None, kubernetes_version: Optional[str] = None, dns_prefix: Optional[str] = None, - agent_pool_profiles: Optional[List["ManagedClusterAgentPoolProfile"]] = None, - linux_profile: Optional["ContainerServiceLinuxProfile"] = None, - windows_profile: Optional["ManagedClusterWindowsProfile"] = None, - service_principal_profile: Optional["ManagedClusterServicePrincipalProfile"] = None, - addon_profiles: Optional[Dict[str, "ManagedClusterAddonProfile"]] = None, + agent_pool_profiles: Optional[List["_models.ManagedClusterAgentPoolProfile"]] = None, + linux_profile: Optional["_models.ContainerServiceLinuxProfile"] = None, + windows_profile: Optional["_models.ManagedClusterWindowsProfile"] = None, + service_principal_profile: Optional["_models.ManagedClusterServicePrincipalProfile"] = None, + addon_profiles: Optional[Dict[str, "_models.ManagedClusterAddonProfile"]] = None, node_resource_group: Optional[str] = None, enable_rbac: Optional[bool] = None, enable_pod_security_policy: Optional[bool] = None, - network_profile: Optional["ContainerServiceNetworkProfile"] = None, - aad_profile: Optional["ManagedClusterAADProfile"] = None, - auto_scaler_profile: Optional["ManagedClusterPropertiesAutoScalerProfile"] = None, - api_server_access_profile: Optional["ManagedClusterAPIServerAccessProfile"] = None, + network_profile: Optional["_models.ContainerServiceNetworkProfile"] = None, + aad_profile: Optional["_models.ManagedClusterAADProfile"] = None, + auto_scaler_profile: Optional["_models.ManagedClusterPropertiesAutoScalerProfile"] = None, + api_server_access_profile: Optional["_models.ManagedClusterAPIServerAccessProfile"] = None, disk_encryption_set_id: Optional[str] = None, - identity_profile: Optional[Dict[str, "ManagedClusterPropertiesIdentityProfileValue"]] = None, + identity_profile: Optional[Dict[str, "_models.ManagedClusterPropertiesIdentityProfileValue"]] = None, **kwargs ): """ @@ -841,7 +840,7 @@ def __init__( code: Optional[str] = None, message: Optional[str] = None, target: Optional[str] = None, - details: Optional[List["CloudErrorBody"]] = None, + details: Optional[List["_models.CloudErrorBody"]] = None, **kwargs ): """ @@ -885,7 +884,7 @@ class ContainerServiceDiagnosticsProfile(msrest.serialization.Model): def __init__( self, *, - vm_diagnostics: "ContainerServiceVMDiagnostics", + vm_diagnostics: "_models.ContainerServiceVMDiagnostics", **kwargs ): """ @@ -922,7 +921,7 @@ def __init__( self, *, admin_username: str, - ssh: "ContainerServiceSshConfiguration", + ssh: "_models.ContainerServiceSshConfiguration", **kwargs ): """ @@ -945,17 +944,17 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar count: Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, - and 5. The default value is 1. Possible values include: 1, 3, 5. Default value: "1". + and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". :vartype count: int or ~azure.mgmt.containerservice.v2020_04_01.models.Count :ivar dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. :vartype dns_prefix: str - :ivar vm_size: Required. Size of agent VMs. Possible values include: "Standard_A1", - "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", - "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", - "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", - "Standard_A8m_v2", "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", - "Standard_B8ms", "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", - "Standard_D12", "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", + :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", + "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", + "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", + "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", "Standard_B8ms", + "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", "Standard_D12", + "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", "Standard_D13_v2_Promo", "Standard_D14", "Standard_D14_v2", "Standard_D14_v2_Promo", "Standard_D15_v2", "Standard_D16_v3", "Standard_D16s_v3", "Standard_D1_v2", "Standard_D2", "Standard_D2_v2", "Standard_D2_v2_Promo", "Standard_D2_v3", "Standard_D2s_v3", "Standard_D3", @@ -1000,7 +999,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): :vartype first_consecutive_static_ip: str :ivar storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Possible values include: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". :vartype storage_profile: str or ~azure.mgmt.containerservice.v2020_04_01.models.ContainerServiceStorageProfileTypes :ivar fqdn: FQDN for the master pool. @@ -1029,27 +1028,27 @@ def __init__( self, *, dns_prefix: str, - vm_size: Union[str, "ContainerServiceVMSizeTypes"], - count: Optional[Union[int, "Count"]] = 1, + vm_size: Union[str, "_models.ContainerServiceVMSizeTypes"], + count: Optional[Union[int, "_models.Count"]] = 1, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, first_consecutive_static_ip: Optional[str] = "10.240.255.5", - storage_profile: Optional[Union[str, "ContainerServiceStorageProfileTypes"]] = None, + storage_profile: Optional[Union[str, "_models.ContainerServiceStorageProfileTypes"]] = None, **kwargs ): """ :keyword count: Number of masters (VMs) in the container service cluster. Allowed values are 1, - 3, and 5. The default value is 1. Possible values include: 1, 3, 5. Default value: "1". + 3, and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". :paramtype count: int or ~azure.mgmt.containerservice.v2020_04_01.models.Count :keyword dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. :paramtype dns_prefix: str - :keyword vm_size: Required. Size of agent VMs. Possible values include: "Standard_A1", - "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", - "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", - "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", - "Standard_A8m_v2", "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", - "Standard_B8ms", "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", - "Standard_D12", "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", + :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", + "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", + "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", + "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", "Standard_B8ms", + "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", "Standard_D12", + "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", "Standard_D13_v2_Promo", "Standard_D14", "Standard_D14_v2", "Standard_D14_v2_Promo", "Standard_D15_v2", "Standard_D16_v3", "Standard_D16s_v3", "Standard_D1_v2", "Standard_D2", "Standard_D2_v2", "Standard_D2_v2_Promo", "Standard_D2_v3", "Standard_D2s_v3", "Standard_D3", @@ -1094,7 +1093,7 @@ def __init__( :paramtype first_consecutive_static_ip: str :keyword storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Possible values include: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". :paramtype storage_profile: str or ~azure.mgmt.containerservice.v2020_04_01.models.ContainerServiceStorageProfileTypes """ @@ -1112,13 +1111,13 @@ def __init__( class ContainerServiceNetworkProfile(msrest.serialization.Model): """Profile of network configuration. - :ivar network_plugin: Network plugin used for building Kubernetes network. Possible values - include: "azure", "kubenet". Default value: "kubenet". + :ivar network_plugin: Network plugin used for building Kubernetes network. Known values are: + "azure", "kubenet". Default value: "kubenet". :vartype network_plugin: str or ~azure.mgmt.containerservice.v2020_04_01.models.NetworkPlugin - :ivar network_policy: Network policy used for building Kubernetes network. Possible values - include: "calico", "azure". + :ivar network_policy: Network policy used for building Kubernetes network. Known values are: + "calico", "azure". :vartype network_policy: str or ~azure.mgmt.containerservice.v2020_04_01.models.NetworkPolicy - :ivar network_mode: Network mode used for building Kubernetes network. Possible values include: + :ivar network_mode: Network mode used for building Kubernetes network. Known values are: "transparent", "bridge". :vartype network_mode: str or ~azure.mgmt.containerservice.v2020_04_01.models.NetworkMode :ivar pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. @@ -1132,11 +1131,11 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): :ivar docker_bridge_cidr: A CIDR notation IP range assigned to the Docker bridge network. It must not overlap with any Subnet IP ranges or the Kubernetes service address range. :vartype docker_bridge_cidr: str - :ivar outbound_type: The outbound (egress) routing method. Possible values include: - "loadBalancer", "userDefinedRouting". Default value: "loadBalancer". + :ivar outbound_type: The outbound (egress) routing method. Known values are: "loadBalancer", + "userDefinedRouting". Default value: "loadBalancer". :vartype outbound_type: str or ~azure.mgmt.containerservice.v2020_04_01.models.OutboundType - :ivar load_balancer_sku: The load balancer sku for the managed cluster. Possible values - include: "standard", "basic". + :ivar load_balancer_sku: The load balancer sku for the managed cluster. Known values are: + "standard", "basic". :vartype load_balancer_sku: str or ~azure.mgmt.containerservice.v2020_04_01.models.LoadBalancerSku :ivar load_balancer_profile: Profile of the cluster load balancer. @@ -1167,27 +1166,27 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): def __init__( self, *, - network_plugin: Optional[Union[str, "NetworkPlugin"]] = "kubenet", - network_policy: Optional[Union[str, "NetworkPolicy"]] = None, - network_mode: Optional[Union[str, "NetworkMode"]] = None, + network_plugin: Optional[Union[str, "_models.NetworkPlugin"]] = "kubenet", + network_policy: Optional[Union[str, "_models.NetworkPolicy"]] = None, + network_mode: Optional[Union[str, "_models.NetworkMode"]] = None, pod_cidr: Optional[str] = "10.244.0.0/16", service_cidr: Optional[str] = "10.0.0.0/16", dns_service_ip: Optional[str] = "10.0.0.10", docker_bridge_cidr: Optional[str] = "172.17.0.1/16", - outbound_type: Optional[Union[str, "OutboundType"]] = "loadBalancer", - load_balancer_sku: Optional[Union[str, "LoadBalancerSku"]] = None, - load_balancer_profile: Optional["ManagedClusterLoadBalancerProfile"] = None, + outbound_type: Optional[Union[str, "_models.OutboundType"]] = "loadBalancer", + load_balancer_sku: Optional[Union[str, "_models.LoadBalancerSku"]] = None, + load_balancer_profile: Optional["_models.ManagedClusterLoadBalancerProfile"] = None, **kwargs ): """ - :keyword network_plugin: Network plugin used for building Kubernetes network. Possible values - include: "azure", "kubenet". Default value: "kubenet". + :keyword network_plugin: Network plugin used for building Kubernetes network. Known values are: + "azure", "kubenet". Default value: "kubenet". :paramtype network_plugin: str or ~azure.mgmt.containerservice.v2020_04_01.models.NetworkPlugin - :keyword network_policy: Network policy used for building Kubernetes network. Possible values - include: "calico", "azure". + :keyword network_policy: Network policy used for building Kubernetes network. Known values are: + "calico", "azure". :paramtype network_policy: str or ~azure.mgmt.containerservice.v2020_04_01.models.NetworkPolicy - :keyword network_mode: Network mode used for building Kubernetes network. Possible values - include: "transparent", "bridge". + :keyword network_mode: Network mode used for building Kubernetes network. Known values are: + "transparent", "bridge". :paramtype network_mode: str or ~azure.mgmt.containerservice.v2020_04_01.models.NetworkMode :keyword pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :paramtype pod_cidr: str @@ -1200,11 +1199,11 @@ def __init__( :keyword docker_bridge_cidr: A CIDR notation IP range assigned to the Docker bridge network. It must not overlap with any Subnet IP ranges or the Kubernetes service address range. :paramtype docker_bridge_cidr: str - :keyword outbound_type: The outbound (egress) routing method. Possible values include: - "loadBalancer", "userDefinedRouting". Default value: "loadBalancer". + :keyword outbound_type: The outbound (egress) routing method. Known values are: "loadBalancer", + "userDefinedRouting". Default value: "loadBalancer". :paramtype outbound_type: str or ~azure.mgmt.containerservice.v2020_04_01.models.OutboundType - :keyword load_balancer_sku: The load balancer sku for the managed cluster. Possible values - include: "standard", "basic". + :keyword load_balancer_sku: The load balancer sku for the managed cluster. Known values are: + "standard", "basic". :paramtype load_balancer_sku: str or ~azure.mgmt.containerservice.v2020_04_01.models.LoadBalancerSku :keyword load_balancer_profile: Profile of the cluster load balancer. @@ -1246,7 +1245,7 @@ class ContainerServiceSshConfiguration(msrest.serialization.Model): def __init__( self, *, - public_keys: List["ContainerServiceSshPublicKey"], + public_keys: List["_models.ContainerServiceSshPublicKey"], **kwargs ): """ @@ -1566,25 +1565,25 @@ def __init__( self, *, location: str, - identity: Optional["ManagedClusterIdentity"] = None, + identity: Optional["_models.ManagedClusterIdentity"] = None, kubernetes_version: Optional[str] = None, dns_prefix: Optional[str] = None, - agent_pool_profiles: Optional[List["ManagedClusterAgentPoolProfile"]] = None, - linux_profile: Optional["ContainerServiceLinuxProfile"] = None, - windows_profile: Optional["ManagedClusterWindowsProfile"] = None, - service_principal_profile: Optional["ManagedClusterServicePrincipalProfile"] = None, - addon_profiles: Optional[Dict[str, "ManagedClusterAddonProfile"]] = None, + agent_pool_profiles: Optional[List["_models.ManagedClusterAgentPoolProfile"]] = None, + linux_profile: Optional["_models.ContainerServiceLinuxProfile"] = None, + windows_profile: Optional["_models.ManagedClusterWindowsProfile"] = None, + service_principal_profile: Optional["_models.ManagedClusterServicePrincipalProfile"] = None, + addon_profiles: Optional[Dict[str, "_models.ManagedClusterAddonProfile"]] = None, node_resource_group: Optional[str] = None, enable_rbac: Optional[bool] = None, enable_pod_security_policy: Optional[bool] = None, - network_profile: Optional["ContainerServiceNetworkProfile"] = None, - aad_profile: Optional["ManagedClusterAADProfile"] = None, - auto_scaler_profile: Optional["ManagedClusterPropertiesAutoScalerProfile"] = None, - api_server_access_profile: Optional["ManagedClusterAPIServerAccessProfile"] = None, + network_profile: Optional["_models.ContainerServiceNetworkProfile"] = None, + aad_profile: Optional["_models.ManagedClusterAADProfile"] = None, + auto_scaler_profile: Optional["_models.ManagedClusterPropertiesAutoScalerProfile"] = None, + api_server_access_profile: Optional["_models.ManagedClusterAPIServerAccessProfile"] = None, disk_encryption_set_id: Optional[str] = None, - identity_profile: Optional[Dict[str, "ManagedClusterPropertiesIdentityProfileValue"]] = None, + identity_profile: Optional[Dict[str, "_models.ManagedClusterPropertiesIdentityProfileValue"]] = None, tags: Optional[Dict[str, str]] = None, - sku: Optional["ManagedClusterSKU"] = None, + sku: Optional["_models.ManagedClusterSKU"] = None, **kwargs ): """ @@ -1923,7 +1922,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): range of 0 to 100 (inclusive) for user pools and in the range of 1 to 100 (inclusive) for system pools. The default value is 1. :vartype count: int - :ivar vm_size: Size of agent VMs. Possible values include: "Standard_A1", "Standard_A10", + :ivar vm_size: Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -1972,7 +1971,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2020_04_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -1980,11 +1979,10 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :vartype min_count: int :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool - :ivar type: AgentPoolType represents types of an agent pool. Possible values include: + :ivar type: AgentPoolType represents types of an agent pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2020_04_01.models.AgentPoolType - :ivar mode: AgentPoolMode represents mode of an agent pool. Possible values include: "System", - "User". + :ivar mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", "User". :vartype mode: str or ~azure.mgmt.containerservice.v2020_04_01.models.AgentPoolMode :ivar orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -2003,12 +2001,11 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar enable_node_public_ip: Enable public IP for nodes. :vartype enable_node_public_ip: bool :ivar scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Possible values include: "Spot", "Regular". Default value: - "Regular". + priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_04_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy - for Spot virtual machine scale set. Default to Delete. Possible values include: "Delete", + for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", "Deallocate". Default value: "Delete". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_04_01.models.ScaleSetEvictionPolicy @@ -2061,23 +2058,23 @@ def __init__( self, *, count: Optional[int] = None, - vm_size: Optional[Union[str, "ContainerServiceVMSizeTypes"]] = None, + vm_size: Optional[Union[str, "_models.ContainerServiceVMSizeTypes"]] = None, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - type: Optional[Union[str, "AgentPoolType"]] = None, - mode: Optional[Union[str, "AgentPoolMode"]] = None, + type: Optional[Union[str, "_models.AgentPoolType"]] = None, + mode: Optional[Union[str, "_models.AgentPoolMode"]] = None, orchestrator_version: Optional[str] = None, node_image_version: Optional[str] = None, - upgrade_settings: Optional["AgentPoolUpgradeSettings"] = None, + upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, - scale_set_priority: Optional[Union[str, "ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", spot_max_price: Optional[float] = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, @@ -2089,7 +2086,7 @@ def __init__( range of 0 to 100 (inclusive) for user pools and in the range of 1 to 100 (inclusive) for system pools. The default value is 1. :paramtype count: int - :keyword vm_size: Size of agent VMs. Possible values include: "Standard_A1", "Standard_A10", + :keyword vm_size: Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -2138,7 +2135,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2020_04_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -2146,11 +2143,11 @@ def __init__( :paramtype min_count: int :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool - :keyword type: AgentPoolType represents types of an agent pool. Possible values include: + :keyword type: AgentPoolType represents types of an agent pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2020_04_01.models.AgentPoolType - :keyword mode: AgentPoolMode represents mode of an agent pool. Possible values include: - "System", "User". + :keyword mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", + "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2020_04_01.models.AgentPoolMode :keyword orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -2166,13 +2163,12 @@ def __init__( :keyword enable_node_public_ip: Enable public IP for nodes. :paramtype enable_node_public_ip: bool :keyword scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Possible values include: "Spot", "Regular". Default value: - "Regular". + priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_04_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction - policy for Spot virtual machine scale set. Default to Delete. Possible values include: - "Delete", "Deallocate". Default value: "Delete". + policy for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", + "Deallocate". Default value: "Delete". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_04_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: SpotMaxPrice to be used to specify the maximum price you are willing @@ -2225,7 +2221,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): range of 0 to 100 (inclusive) for user pools and in the range of 1 to 100 (inclusive) for system pools. The default value is 1. :vartype count: int - :ivar vm_size: Size of agent VMs. Possible values include: "Standard_A1", "Standard_A10", + :ivar vm_size: Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -2274,7 +2270,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2020_04_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -2282,11 +2278,10 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :vartype min_count: int :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool - :ivar type: AgentPoolType represents types of an agent pool. Possible values include: + :ivar type: AgentPoolType represents types of an agent pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2020_04_01.models.AgentPoolType - :ivar mode: AgentPoolMode represents mode of an agent pool. Possible values include: "System", - "User". + :ivar mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", "User". :vartype mode: str or ~azure.mgmt.containerservice.v2020_04_01.models.AgentPoolMode :ivar orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -2305,12 +2300,11 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar enable_node_public_ip: Enable public IP for nodes. :vartype enable_node_public_ip: bool :ivar scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Possible values include: "Spot", "Regular". Default value: - "Regular". + priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_04_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy - for Spot virtual machine scale set. Default to Delete. Possible values include: "Delete", + for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", "Deallocate". Default value: "Delete". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_04_01.models.ScaleSetEvictionPolicy @@ -2369,23 +2363,23 @@ def __init__( *, name: str, count: Optional[int] = None, - vm_size: Optional[Union[str, "ContainerServiceVMSizeTypes"]] = None, + vm_size: Optional[Union[str, "_models.ContainerServiceVMSizeTypes"]] = None, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - type: Optional[Union[str, "AgentPoolType"]] = None, - mode: Optional[Union[str, "AgentPoolMode"]] = None, + type: Optional[Union[str, "_models.AgentPoolType"]] = None, + mode: Optional[Union[str, "_models.AgentPoolMode"]] = None, orchestrator_version: Optional[str] = None, node_image_version: Optional[str] = None, - upgrade_settings: Optional["AgentPoolUpgradeSettings"] = None, + upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, - scale_set_priority: Optional[Union[str, "ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", spot_max_price: Optional[float] = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, @@ -2397,7 +2391,7 @@ def __init__( range of 0 to 100 (inclusive) for user pools and in the range of 1 to 100 (inclusive) for system pools. The default value is 1. :paramtype count: int - :keyword vm_size: Size of agent VMs. Possible values include: "Standard_A1", "Standard_A10", + :keyword vm_size: Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -2446,7 +2440,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2020_04_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -2454,11 +2448,11 @@ def __init__( :paramtype min_count: int :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool - :keyword type: AgentPoolType represents types of an agent pool. Possible values include: + :keyword type: AgentPoolType represents types of an agent pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2020_04_01.models.AgentPoolType - :keyword mode: AgentPoolMode represents mode of an agent pool. Possible values include: - "System", "User". + :keyword mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", + "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2020_04_01.models.AgentPoolMode :keyword orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -2474,13 +2468,12 @@ def __init__( :keyword enable_node_public_ip: Enable public IP for nodes. :paramtype enable_node_public_ip: bool :keyword scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Possible values include: "Spot", "Regular". Default value: - "Regular". + priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_04_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction - policy for Spot virtual machine scale set. Default to Delete. Possible values include: - "Delete", "Deallocate". Default value: "Delete". + policy for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", + "Deallocate". Default value: "Delete". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_04_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: SpotMaxPrice to be used to specify the maximum price you are willing @@ -2549,7 +2542,7 @@ class ManagedClusterIdentity(msrest.serialization.Model): :ivar type: The type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ resource group in agent nodes. Type 'None' will not use MSI for the managed cluster, - service principal will be used instead. Possible values include: "SystemAssigned", "None". + service principal will be used instead. Known values are: "SystemAssigned", "None". :vartype type: str or ~azure.mgmt.containerservice.v2020_04_01.models.ResourceIdentityType """ @@ -2567,15 +2560,14 @@ class ManagedClusterIdentity(msrest.serialization.Model): def __init__( self, *, - type: Optional[Union[str, "ResourceIdentityType"]] = None, + type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, **kwargs ): """ :keyword type: The type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ resource group in agent nodes. Type 'None' will not use MSI for the managed - cluster, service principal will be used instead. Possible values include: "SystemAssigned", - "None". + cluster, service principal will be used instead. Known values are: "SystemAssigned", "None". :paramtype type: str or ~azure.mgmt.containerservice.v2020_04_01.models.ResourceIdentityType """ super(ManagedClusterIdentity, self).__init__(**kwargs) @@ -2607,7 +2599,7 @@ class ManagedClusterListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["ManagedCluster"]] = None, + value: Optional[List["_models.ManagedCluster"]] = None, **kwargs ): """ @@ -2661,10 +2653,10 @@ class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): def __init__( self, *, - managed_outbound_i_ps: Optional["ManagedClusterLoadBalancerProfileManagedOutboundIPs"] = None, - outbound_ip_prefixes: Optional["ManagedClusterLoadBalancerProfileOutboundIPPrefixes"] = None, - outbound_i_ps: Optional["ManagedClusterLoadBalancerProfileOutboundIPs"] = None, - effective_outbound_i_ps: Optional[List["ResourceReference"]] = None, + managed_outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileManagedOutboundIPs"] = None, + outbound_ip_prefixes: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPPrefixes"] = None, + outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPs"] = None, + effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, allocated_outbound_ports: Optional[int] = 0, idle_timeout_in_minutes: Optional[int] = 30, **kwargs @@ -2747,7 +2739,7 @@ class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.M def __init__( self, *, - public_ip_prefixes: Optional[List["ResourceReference"]] = None, + public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, **kwargs ): """ @@ -2773,7 +2765,7 @@ class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): def __init__( self, *, - public_i_ps: Optional[List["ResourceReference"]] = None, + public_i_ps: Optional[List["_models.ResourceReference"]] = None, **kwargs ): """ @@ -2794,7 +2786,7 @@ class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): :ivar name: Pool name. :vartype name: str :ivar os_type: Required. OsType to be used to specify os type. Choose from Linux and Windows. - Default to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2020_04_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -2817,9 +2809,9 @@ def __init__( self, *, kubernetes_version: str, - os_type: Union[str, "OSType"] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", name: Optional[str] = None, - upgrades: Optional[List["ManagedClusterPoolUpgradeProfileUpgradesItem"]] = None, + upgrades: Optional[List["_models.ManagedClusterPoolUpgradeProfileUpgradesItem"]] = None, **kwargs ): """ @@ -2828,7 +2820,7 @@ def __init__( :keyword name: Pool name. :paramtype name: str :keyword os_type: Required. OsType to be used to specify os type. Choose from Linux and - Windows. Default to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Windows. Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2020_04_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: @@ -3031,9 +3023,9 @@ def __init__( class ManagedClusterSKU(msrest.serialization.Model): """ManagedClusterSKU. - :ivar name: Name of a managed cluster SKU. Possible values include: "Basic". + :ivar name: Name of a managed cluster SKU. Known values are: "Basic". :vartype name: str or ~azure.mgmt.containerservice.v2020_04_01.models.ManagedClusterSKUName - :ivar tier: Tier of a managed cluster SKU. Possible values include: "Paid", "Free". + :ivar tier: Tier of a managed cluster SKU. Known values are: "Paid", "Free". :vartype tier: str or ~azure.mgmt.containerservice.v2020_04_01.models.ManagedClusterSKUTier """ @@ -3045,14 +3037,14 @@ class ManagedClusterSKU(msrest.serialization.Model): def __init__( self, *, - name: Optional[Union[str, "ManagedClusterSKUName"]] = None, - tier: Optional[Union[str, "ManagedClusterSKUTier"]] = None, + name: Optional[Union[str, "_models.ManagedClusterSKUName"]] = None, + tier: Optional[Union[str, "_models.ManagedClusterSKUTier"]] = None, **kwargs ): """ - :keyword name: Name of a managed cluster SKU. Possible values include: "Basic". + :keyword name: Name of a managed cluster SKU. Known values are: "Basic". :paramtype name: str or ~azure.mgmt.containerservice.v2020_04_01.models.ManagedClusterSKUName - :keyword tier: Tier of a managed cluster SKU. Possible values include: "Paid", "Free". + :keyword tier: Tier of a managed cluster SKU. Known values are: "Paid", "Free". :paramtype tier: str or ~azure.mgmt.containerservice.v2020_04_01.models.ManagedClusterSKUTier """ super(ManagedClusterSKU, self).__init__(**kwargs) @@ -3101,8 +3093,8 @@ class ManagedClusterUpgradeProfile(msrest.serialization.Model): def __init__( self, *, - control_plane_profile: "ManagedClusterPoolUpgradeProfile", - agent_pool_profiles: List["ManagedClusterPoolUpgradeProfile"], + control_plane_profile: "_models.ManagedClusterPoolUpgradeProfile", + agent_pool_profiles: List["_models.ManagedClusterPoolUpgradeProfile"], **kwargs ): """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/models/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/models/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/operations/__init__.py index 5aac40228eec..403c0174f052 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/operations/__init__.py @@ -10,8 +10,13 @@ from ._managed_clusters_operations import ManagedClustersOperations from ._agent_pools_operations import AgentPoolsOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'Operations', 'ManagedClustersOperations', 'AgentPoolsOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/operations/_agent_pools_operations.py index 27bf0dd99957..58336626fb9d 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/operations/_agent_pools_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -35,9 +35,12 @@ def build_list_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-04-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools") # pylint: disable=line-too-long path_format_arguments = { @@ -49,18 +52,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -72,9 +73,12 @@ def build_get_request( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-04-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -87,18 +91,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -109,14 +111,17 @@ def build_create_or_update_request_initial( resource_name: str, agent_pool_name: str, *, - json: JSONType = None, + json: Optional[_models.AgentPool] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-04-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -129,20 +134,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -156,9 +159,12 @@ def build_delete_request_initial( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-04-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -171,18 +177,16 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -194,9 +198,12 @@ def build_get_upgrade_profile_request( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-04-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default") # pylint: disable=line-too-long path_format_arguments = { @@ -209,18 +216,16 @@ def build_get_upgrade_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -231,9 +236,12 @@ def build_get_available_agent_pool_versions_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-04-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions") # pylint: disable=line-too-long path_format_arguments = { @@ -245,42 +253,38 @@ def build_get_available_agent_pool_versions_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class AgentPoolsOperations(object): - """AgentPoolsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class AgentPoolsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2020_04_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2020_04_01.ContainerServiceClient`'s + :attr:`agent_pools` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -288,7 +292,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Iterable["_models.AgentPoolListResult"]: + ) -> Iterable[_models.AgentPoolListResult]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. The operation returns properties @@ -304,13 +308,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_04_01.models.AgentPoolListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-04-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -320,9 +327,11 @@ def prepare_request(next_link=None): resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -332,9 +341,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -374,7 +385,7 @@ def get( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPool": + ) -> _models.AgentPool: """Gets the agent pool. Gets the details of the agent pool by managed cluster and resource group. @@ -390,13 +401,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2020_04_01.models.AgentPool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-04-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] request = build_get_request( @@ -406,11 +420,13 @@ def get( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -436,17 +452,20 @@ def _create_or_update_initial( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> "_models.AgentPool": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] + ) -> _models.AgentPool: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] _json = self._serialize.body(parameters, 'AgentPool') @@ -459,11 +478,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -494,9 +515,9 @@ def begin_create_or_update( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> LROPoller["_models.AgentPool"]: + ) -> LROPoller[_models.AgentPool]: """Creates or updates an agent pool. Creates or updates an agent pool in the specified managed cluster. @@ -522,17 +543,20 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_04_01.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, @@ -540,20 +564,27 @@ def begin_create_or_update( 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): - response = pipeline_response.http_response deserialized = self._deserialize('AgentPool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -573,13 +604,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements agent_pool_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-04-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -589,11 +623,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -640,21 +676,26 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-04-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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) @@ -664,8 +705,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -685,7 +732,7 @@ def get_upgrade_profile( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPoolUpgradeProfile": + ) -> _models.AgentPoolUpgradeProfile: """Gets upgrade profile for an agent pool. Gets the details of the upgrade profile for an agent pool with a specified resource group and @@ -702,13 +749,16 @@ def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2020_04_01.models.AgentPoolUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-04-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] request = build_get_upgrade_profile_request( @@ -718,11 +768,13 @@ def get_upgrade_profile( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -749,7 +801,7 @@ def get_available_agent_pool_versions( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.AgentPoolAvailableVersions": + ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported versions for the specified agent pool. Gets a list of supported versions for the specified agent pool. @@ -763,13 +815,16 @@ def get_available_agent_pool_versions( :rtype: ~azure.mgmt.containerservice.v2020_04_01.models.AgentPoolAvailableVersions :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolAvailableVersions"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-04-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] request = build_get_available_agent_pool_versions_request( @@ -778,11 +833,13 @@ def get_available_agent_pool_versions( resource_name=resource_name, api_version=api_version, template_url=self.get_available_agent_pool_versions.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/operations/_managed_clusters_operations.py index c3c0f7b9a847..3241dd953a65 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/operations/_managed_clusters_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -33,9 +33,12 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-04-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters") path_format_arguments = { @@ -45,18 +48,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -66,9 +67,12 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-04-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters") # pylint: disable=line-too-long path_format_arguments = { @@ -79,18 +83,16 @@ def build_list_by_resource_group_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -101,9 +103,12 @@ def build_get_upgrade_profile_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-04-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default") # pylint: disable=line-too-long path_format_arguments = { @@ -115,18 +120,16 @@ def build_get_upgrade_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -138,9 +141,12 @@ def build_get_access_profile_request( role_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-04-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -153,18 +159,16 @@ def build_get_access_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -175,9 +179,12 @@ def build_list_cluster_admin_credentials_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-04-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -189,18 +196,16 @@ def build_list_cluster_admin_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -211,9 +216,12 @@ def build_list_cluster_user_credentials_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-04-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -225,18 +233,16 @@ def build_list_cluster_user_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -247,9 +253,12 @@ def build_list_cluster_monitoring_user_credentials_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-04-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -261,18 +270,16 @@ def build_list_cluster_monitoring_user_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -283,9 +290,12 @@ def build_get_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-04-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -297,18 +307,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -318,14 +326,17 @@ def build_create_or_update_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedCluster] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-04-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -337,20 +348,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -362,14 +371,17 @@ def build_update_tags_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.TagsObject] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-04-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -381,20 +393,18 @@ def build_update_tags_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -407,9 +417,12 @@ def build_delete_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-04-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -421,18 +434,16 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -442,14 +453,17 @@ def build_reset_service_principal_profile_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedClusterServicePrincipalProfile] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-04-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile") # pylint: disable=line-too-long path_format_arguments = { @@ -461,20 +475,18 @@ def build_reset_service_principal_profile_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -486,14 +498,17 @@ def build_reset_aad_profile_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedClusterAADProfile] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-04-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile") # pylint: disable=line-too-long path_format_arguments = { @@ -505,20 +520,18 @@ def build_reset_aad_profile_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -531,9 +544,12 @@ def build_rotate_cluster_certificates_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-04-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates") # pylint: disable=line-too-long path_format_arguments = { @@ -545,48 +561,44 @@ def build_rotate_cluster_certificates_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class ManagedClustersOperations(object): - """ManagedClustersOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ManagedClustersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2020_04_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2020_04_01.ContainerServiceClient`'s + :attr:`managed_clusters` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> Iterable["_models.ManagedClusterListResult"]: + ) -> Iterable[_models.ManagedClusterListResult]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. The operation returns properties @@ -599,13 +611,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_04_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-04-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -613,9 +628,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -623,9 +640,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -663,7 +682,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.ManagedClusterListResult"]: + ) -> Iterable[_models.ManagedClusterListResult]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. The operation returns @@ -678,13 +697,16 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_04_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-04-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -693,9 +715,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -704,9 +728,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -745,7 +771,7 @@ def get_upgrade_profile( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedClusterUpgradeProfile": + ) -> _models.ManagedClusterUpgradeProfile: """Gets upgrade profile for a managed cluster. Gets the details of the upgrade profile for a managed cluster with a specified resource group @@ -760,13 +786,16 @@ def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2020_04_01.models.ManagedClusterUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-04-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] request = build_get_upgrade_profile_request( @@ -775,11 +804,13 @@ def get_upgrade_profile( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -807,7 +838,7 @@ def get_access_profile( resource_name: str, role_name: str, **kwargs: Any - ) -> "_models.ManagedClusterAccessProfile": + ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. Gets the accessProfile for the specified role name of the managed cluster with a specified @@ -828,13 +859,16 @@ def get_access_profile( :rtype: ~azure.mgmt.containerservice.v2020_04_01.models.ManagedClusterAccessProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterAccessProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-04-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] request = build_get_access_profile_request( @@ -844,11 +878,13 @@ def get_access_profile( role_name=role_name, api_version=api_version, template_url=self.get_access_profile.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -875,7 +911,7 @@ def list_cluster_admin_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster admin credential of a managed cluster. Gets cluster admin credential of the managed cluster with a specified resource group and name. @@ -889,13 +925,16 @@ def list_cluster_admin_credentials( :rtype: ~azure.mgmt.containerservice.v2020_04_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-04-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_admin_credentials_request( @@ -904,11 +943,13 @@ def list_cluster_admin_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_admin_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -935,7 +976,7 @@ def list_cluster_user_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster user credential of a managed cluster. Gets cluster user credential of the managed cluster with a specified resource group and name. @@ -949,13 +990,16 @@ def list_cluster_user_credentials( :rtype: ~azure.mgmt.containerservice.v2020_04_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-04-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_user_credentials_request( @@ -964,11 +1008,13 @@ def list_cluster_user_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -995,7 +1041,7 @@ def list_cluster_monitoring_user_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster monitoring user credential of a managed cluster. Gets cluster monitoring user credential of the managed cluster with a specified resource group @@ -1010,13 +1056,16 @@ def list_cluster_monitoring_user_credentials( :rtype: ~azure.mgmt.containerservice.v2020_04_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-04-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_monitoring_user_credentials_request( @@ -1025,11 +1074,13 @@ def list_cluster_monitoring_user_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1056,7 +1107,7 @@ def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedCluster": + ) -> _models.ManagedCluster: """Gets a managed cluster. Gets the details of the managed cluster with a specified resource group and name. @@ -1070,13 +1121,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2020_04_01.models.ManagedCluster :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-04-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] request = build_get_request( @@ -1085,11 +1139,13 @@ def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1114,17 +1170,20 @@ def _create_or_update_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2020-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'ManagedCluster') @@ -1136,11 +1195,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1170,9 +1231,9 @@ def begin_create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> LROPoller["_models.ManagedCluster"]: + ) -> LROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. Creates or updates a managed cluster with the specified configuration for agents and Kubernetes @@ -1198,37 +1259,47 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_04_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1245,17 +1316,20 @@ def _update_tags_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'TagsObject') @@ -1267,11 +1341,13 @@ def _update_tags_initial( content_type=content_type, json=_json, template_url=self._update_tags_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1297,9 +1373,9 @@ def begin_update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> LROPoller["_models.ManagedCluster"]: + ) -> LROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates a managed cluster with the specified tags. @@ -1324,37 +1400,47 @@ def begin_update_tags( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_04_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._update_tags_initial( + raw_result = self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1373,13 +1459,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-04-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -1388,11 +1477,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1436,20 +1527,25 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-04-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_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) @@ -1459,8 +1555,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1477,17 +1579,20 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2020-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') @@ -1499,11 +1604,13 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re content_type=content_type, json=_json, template_url=self._reset_service_principal_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1525,7 +1632,7 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> LROPoller[None]: """Reset Service Principal Profile of a managed cluster. @@ -1552,23 +1659,28 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._reset_service_principal_profile_initial( + raw_result = self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1578,8 +1690,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1596,17 +1714,20 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2020-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') @@ -1618,11 +1739,13 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement content_type=content_type, json=_json, template_url=self._reset_aad_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1644,7 +1767,7 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> LROPoller[None]: """Reset AAD Profile of a managed cluster. @@ -1670,23 +1793,28 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._reset_aad_profile_initial( + raw_result = self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1696,8 +1824,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1716,13 +1850,16 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-04-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_rotate_cluster_certificates_request_initial( @@ -1731,11 +1868,13 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return resource_name=resource_name, api_version=api_version, template_url=self._rotate_cluster_certificates_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1779,20 +1918,25 @@ def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-st :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-04-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._rotate_cluster_certificates_initial( + raw_result = self._rotate_cluster_certificates_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) @@ -1802,8 +1946,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/operations/_operations.py index ee7fd83dbbbf..8302dbe34877 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/operations/_operations.py @@ -16,6 +16,7 @@ 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 @@ -29,55 +30,54 @@ def build_list_request( **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-04-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.ContainerService/operations") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class Operations(object): - """Operations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2020_04_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2020_04_01.ContainerServiceClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> Iterable["_models.OperationListResult"]: + ) -> Iterable[_models.OperationListResult]: """Gets a list of compute operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -86,31 +86,38 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_04_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-04-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/__init__.py index 53c675bd95e2..37a5f9e02e6f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._container_service_client import ContainerServiceClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['ContainerServiceClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/_container_service_client.py index 7fc0116d3af1..90ba5f3b4303 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/_container_service_client.py @@ -63,10 +63,18 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.managed_clusters = ManagedClustersOperations(self._client, self._config, self._serialize, self._deserialize) - self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_clusters = ManagedClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.agent_pools = AgentPoolsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/aio/__init__.py index 53c675bd95e2..37a5f9e02e6f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/aio/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/aio/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._container_service_client import ContainerServiceClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['ContainerServiceClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/aio/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/aio/_container_service_client.py index f96c9893c1c7..1654eaafb8e5 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/aio/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/aio/_container_service_client.py @@ -64,10 +64,18 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.managed_clusters = ManagedClustersOperations(self._client, self._config, self._serialize, self._deserialize) - self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_clusters = ManagedClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.agent_pools = AgentPoolsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/aio/operations/__init__.py index fdbf34a0f841..9ef6890a9e03 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/aio/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/aio/operations/__init__.py @@ -11,9 +11,14 @@ from ._agent_pools_operations import AgentPoolsOperations from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'Operations', 'ManagedClustersOperations', 'AgentPoolsOperations', 'PrivateEndpointConnectionsOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/aio/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/aio/operations/_agent_pools_operations.py index c2fa346920c8..e25792974a42 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/aio/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/aio/operations/_agent_pools_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. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ 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 @@ -26,26 +27,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class AgentPoolsOperations: - """AgentPoolsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2020_06_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2020_06_01.aio.ContainerServiceClient`'s + :attr:`agent_pools` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -53,7 +52,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> AsyncIterable["_models.AgentPoolListResult"]: + ) -> AsyncIterable[_models.AgentPoolListResult]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. The operation returns properties @@ -69,13 +68,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_06_01.models.AgentPoolListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-06-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -85,9 +87,11 @@ def prepare_request(next_link=None): resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -97,9 +101,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -139,7 +145,7 @@ async def get( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPool": + ) -> _models.AgentPool: """Gets the agent pool. Gets the details of the agent pool by managed cluster and resource group. @@ -155,13 +161,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2020_06_01.models.AgentPool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-06-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] request = build_get_request( @@ -171,11 +180,13 @@ async def get( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -201,17 +212,20 @@ async def _create_or_update_initial( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> "_models.AgentPool": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] + ) -> _models.AgentPool: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2020-06-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] _json = self._serialize.body(parameters, 'AgentPool') @@ -224,11 +238,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -259,9 +275,9 @@ async def begin_create_or_update( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> AsyncLROPoller["_models.AgentPool"]: + ) -> AsyncLROPoller[_models.AgentPool]: """Creates or updates an agent pool. Creates or updates an agent pool in the specified managed cluster. @@ -288,17 +304,20 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_06_01.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-06-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, @@ -306,20 +325,27 @@ async def begin_create_or_update( 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): - response = pipeline_response.http_response deserialized = self._deserialize('AgentPool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -339,13 +365,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements agent_pool_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-06-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -355,11 +384,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -406,21 +437,26 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-06-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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) @@ -430,8 +466,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -451,7 +493,7 @@ async def get_upgrade_profile( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPoolUpgradeProfile": + ) -> _models.AgentPoolUpgradeProfile: """Gets upgrade profile for an agent pool. Gets the details of the upgrade profile for an agent pool with a specified resource group and @@ -468,13 +510,16 @@ async def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2020_06_01.models.AgentPoolUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-06-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] request = build_get_upgrade_profile_request( @@ -484,11 +529,13 @@ async def get_upgrade_profile( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -515,7 +562,7 @@ async def get_available_agent_pool_versions( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.AgentPoolAvailableVersions": + ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported versions for the specified agent pool. Gets a list of supported versions for the specified agent pool. @@ -529,13 +576,16 @@ async def get_available_agent_pool_versions( :rtype: ~azure.mgmt.containerservice.v2020_06_01.models.AgentPoolAvailableVersions :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolAvailableVersions"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-06-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] request = build_get_available_agent_pool_versions_request( @@ -544,11 +594,13 @@ async def get_available_agent_pool_versions( resource_name=resource_name, api_version=api_version, template_url=self.get_available_agent_pool_versions.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/aio/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/aio/operations/_managed_clusters_operations.py index c7614b58ae53..749378b6ae80 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/aio/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/aio/operations/_managed_clusters_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. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ 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 @@ -26,32 +27,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ManagedClustersOperations: - """ManagedClustersOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2020_06_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2020_06_01.aio.ContainerServiceClient`'s + :attr:`managed_clusters` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.ManagedClusterListResult"]: + ) -> AsyncIterable[_models.ManagedClusterListResult]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. The operation returns properties @@ -64,13 +63,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_06_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-06-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -78,9 +80,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -88,9 +92,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -128,7 +134,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ManagedClusterListResult"]: + ) -> AsyncIterable[_models.ManagedClusterListResult]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. The operation returns @@ -143,13 +149,16 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_06_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-06-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -158,9 +167,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -169,9 +180,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -210,7 +223,7 @@ async def get_upgrade_profile( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedClusterUpgradeProfile": + ) -> _models.ManagedClusterUpgradeProfile: """Gets upgrade profile for a managed cluster. Gets the details of the upgrade profile for a managed cluster with a specified resource group @@ -225,13 +238,16 @@ async def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2020_06_01.models.ManagedClusterUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-06-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] request = build_get_upgrade_profile_request( @@ -240,11 +256,13 @@ async def get_upgrade_profile( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -272,7 +290,7 @@ async def get_access_profile( resource_name: str, role_name: str, **kwargs: Any - ) -> "_models.ManagedClusterAccessProfile": + ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. Gets the accessProfile for the specified role name of the managed cluster with a specified @@ -293,13 +311,16 @@ async def get_access_profile( :rtype: ~azure.mgmt.containerservice.v2020_06_01.models.ManagedClusterAccessProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterAccessProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-06-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] request = build_get_access_profile_request( @@ -309,11 +330,13 @@ async def get_access_profile( role_name=role_name, api_version=api_version, template_url=self.get_access_profile.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -340,7 +363,7 @@ async def list_cluster_admin_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster admin credential of a managed cluster. Gets cluster admin credential of the managed cluster with a specified resource group and name. @@ -354,13 +377,16 @@ async def list_cluster_admin_credentials( :rtype: ~azure.mgmt.containerservice.v2020_06_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-06-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_admin_credentials_request( @@ -369,11 +395,13 @@ async def list_cluster_admin_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_admin_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -400,7 +428,7 @@ async def list_cluster_user_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster user credential of a managed cluster. Gets cluster user credential of the managed cluster with a specified resource group and name. @@ -414,13 +442,16 @@ async def list_cluster_user_credentials( :rtype: ~azure.mgmt.containerservice.v2020_06_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-06-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_user_credentials_request( @@ -429,11 +460,13 @@ async def list_cluster_user_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -460,7 +493,7 @@ async def list_cluster_monitoring_user_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster monitoring user credential of a managed cluster. Gets cluster monitoring user credential of the managed cluster with a specified resource group @@ -475,13 +508,16 @@ async def list_cluster_monitoring_user_credentials( :rtype: ~azure.mgmt.containerservice.v2020_06_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-06-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_monitoring_user_credentials_request( @@ -490,11 +526,13 @@ async def list_cluster_monitoring_user_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -521,7 +559,7 @@ async def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedCluster": + ) -> _models.ManagedCluster: """Gets a managed cluster. Gets the details of the managed cluster with a specified resource group and name. @@ -535,13 +573,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2020_06_01.models.ManagedCluster :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-06-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] request = build_get_request( @@ -550,11 +591,13 @@ async def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -579,17 +622,20 @@ async def _create_or_update_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2020-06-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'ManagedCluster') @@ -601,11 +647,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -635,9 +683,9 @@ async def begin_create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> AsyncLROPoller["_models.ManagedCluster"]: + ) -> AsyncLROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. Creates or updates a managed cluster with the specified configuration for agents and Kubernetes @@ -663,37 +711,47 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_06_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-06-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -710,17 +768,20 @@ async def _update_tags_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-06-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'TagsObject') @@ -732,11 +793,13 @@ async def _update_tags_initial( content_type=content_type, json=_json, template_url=self._update_tags_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -762,9 +825,9 @@ async def begin_update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> AsyncLROPoller["_models.ManagedCluster"]: + ) -> AsyncLROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates a managed cluster with the specified tags. @@ -789,37 +852,47 @@ async def begin_update_tags( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_06_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-06-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._update_tags_initial( + raw_result = await self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -838,13 +911,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-06-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -853,11 +929,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -901,20 +979,25 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-06-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_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) @@ -924,8 +1007,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -942,17 +1031,20 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2020-06-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') @@ -964,11 +1056,13 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist content_type=content_type, json=_json, template_url=self._reset_service_principal_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -990,7 +1084,7 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> AsyncLROPoller[None]: """Reset Service Principal Profile of a managed cluster. @@ -1017,23 +1111,28 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-06-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._reset_service_principal_profile_initial( + raw_result = await self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1043,8 +1142,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1061,17 +1166,20 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-06-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') @@ -1083,11 +1191,13 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta content_type=content_type, json=_json, template_url=self._reset_aad_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1109,7 +1219,7 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> AsyncLROPoller[None]: """Reset AAD Profile of a managed cluster. @@ -1135,23 +1245,28 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-06-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._reset_aad_profile_initial( + raw_result = await self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1161,8 +1276,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1181,13 +1302,16 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-06-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_rotate_cluster_certificates_request_initial( @@ -1196,11 +1320,13 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- resource_name=resource_name, api_version=api_version, template_url=self._rotate_cluster_certificates_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1244,20 +1370,25 @@ async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-ret :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-06-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._rotate_cluster_certificates_initial( + raw_result = await self._rotate_cluster_certificates_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) @@ -1267,8 +1398,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/aio/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/aio/operations/_operations.py index 1b04f2e87e4a..221ad62cb953 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/aio/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/aio/operations/_operations.py @@ -14,6 +14,7 @@ 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 @@ -23,32 +24,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class Operations: - """Operations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2020_06_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2020_06_01.aio.ContainerServiceClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.OperationListResult"]: + ) -> AsyncIterable[_models.OperationListResult]: """Gets a list of compute operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -57,31 +56,38 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_06_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-06-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/aio/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/aio/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/aio/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/aio/operations/_private_endpoint_connections_operations.py index e91846bfc179..b1c492445c60 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/aio/operations/_private_endpoint_connections_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -14,6 +14,7 @@ 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 @@ -24,26 +25,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class PrivateEndpointConnectionsOperations: - """PrivateEndpointConnectionsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2020_06_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2020_06_01.aio.ContainerServiceClient`'s + :attr:`private_endpoint_connections` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -51,7 +50,7 @@ async def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnectionListResult": + ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. Gets a list of private endpoint connections in the specified managed cluster. The operation @@ -66,13 +65,16 @@ async def list( :rtype: ~azure.mgmt.containerservice.v2020_06_01.models.PrivateEndpointConnectionListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-06-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] request = build_list_request( @@ -81,11 +83,13 @@ async def list( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -113,7 +117,7 @@ async def get( resource_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Gets the private endpoint connection. Gets the details of the private endpoint connection by managed cluster and resource group. @@ -129,13 +133,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2020_06_01.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-06-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] request = build_get_request( @@ -145,11 +152,13 @@ async def get( private_endpoint_connection_name=private_endpoint_connection_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -176,9 +185,9 @@ async def update( resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - parameters: "_models.PrivateEndpointConnection", + parameters: _models.PrivateEndpointConnection, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. Updates a private endpoint connection in the specified managed cluster. @@ -196,14 +205,17 @@ async def update( :rtype: ~azure.mgmt.containerservice.v2020_06_01.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2020-06-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] _json = self._serialize.body(parameters, 'PrivateEndpointConnection') @@ -216,11 +228,13 @@ async def update( content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -248,13 +262,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-06-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -264,11 +281,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name=private_endpoint_connection_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -315,21 +334,26 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-06-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -339,8 +363,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/models/__init__.py index f1841221e822..fd094911ee92 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/models/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/models/__init__.py @@ -80,7 +80,9 @@ ScaleSetEvictionPolicy, ScaleSetPriority, ) - +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'AgentPool', 'AgentPoolAvailableVersions', @@ -153,3 +155,5 @@ 'ScaleSetEvictionPolicy', 'ScaleSetPriority', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/models/_container_service_client_enums.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/models/_container_service_client_enums.py index bd1e8fe8fe40..a2ea966b17c8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/models/_container_service_client_enums.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/models/_container_service_client_enums.py @@ -7,25 +7,24 @@ # -------------------------------------------------------------------------- from enum import Enum -from six import with_metaclass from azure.core import CaseInsensitiveEnumMeta -class AgentPoolMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class AgentPoolMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """AgentPoolMode represents mode of an agent pool. """ SYSTEM = "System" USER = "User" -class AgentPoolType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class AgentPoolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """AgentPoolType represents types of an agent pool. """ VIRTUAL_MACHINE_SCALE_SETS = "VirtualMachineScaleSets" AVAILABILITY_SET = "AvailabilitySet" -class ConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The private link service connection status. """ @@ -34,7 +33,7 @@ class ConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): REJECTED = "Rejected" DISCONNECTED = "Disconnected" -class ContainerServiceStorageProfileTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the orchestrator choice. """ @@ -42,7 +41,7 @@ class ContainerServiceStorageProfileTypes(with_metaclass(CaseInsensitiveEnumMeta STORAGE_ACCOUNT = "StorageAccount" MANAGED_DISKS = "ManagedDisks" -class ContainerServiceVMSizeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Size of agent VMs. """ @@ -221,7 +220,7 @@ class ContainerServiceVMSizeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, E STANDARD_NV24 = "Standard_NV24" STANDARD_NV6 = "Standard_NV6" -class Count(with_metaclass(CaseInsensitiveEnumMeta, int, Enum)): +class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): """Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, and 5. The default value is 1. """ @@ -230,62 +229,62 @@ class Count(with_metaclass(CaseInsensitiveEnumMeta, int, Enum)): THREE = 3 FIVE = 5 -class LoadBalancerSku(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class LoadBalancerSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The load balancer sku for the managed cluster. """ STANDARD = "standard" BASIC = "basic" -class ManagedClusterSKUName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ManagedClusterSKUName(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Name of a managed cluster SKU. """ BASIC = "Basic" -class ManagedClusterSKUTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ManagedClusterSKUTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Tier of a managed cluster SKU. """ PAID = "Paid" FREE = "Free" -class NetworkMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Network mode used for building Kubernetes network. """ TRANSPARENT = "transparent" BRIDGE = "bridge" -class NetworkPlugin(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkPlugin(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Network plugin used for building Kubernetes network. """ AZURE = "azure" KUBENET = "kubenet" -class NetworkPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Network policy used for building Kubernetes network. """ CALICO = "calico" AZURE = "azure" -class OSType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux. """ LINUX = "Linux" WINDOWS = "Windows" -class OutboundType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OutboundType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The outbound (egress) routing method. """ LOAD_BALANCER = "loadBalancer" USER_DEFINED_ROUTING = "userDefinedRouting" -class PrivateEndpointConnectionProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class PrivateEndpointConnectionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The current provisioning state. """ @@ -294,7 +293,7 @@ class PrivateEndpointConnectionProvisioningState(with_metaclass(CaseInsensitiveE DELETING = "Deleting" FAILED = "Failed" -class ResourceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ resource group in agent nodes. Type 'None' will not use MSI for the managed cluster, service @@ -305,7 +304,7 @@ class ResourceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): USER_ASSIGNED = "UserAssigned" NONE = "None" -class ScaleSetEvictionPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ScaleSetEvictionPolicy to be used to specify eviction policy for Spot virtual machine scale set. Default to Delete. """ @@ -313,7 +312,7 @@ class ScaleSetEvictionPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)) DELETE = "Delete" DEALLOCATE = "Deallocate" -class ScaleSetPriority(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ScaleSetPriority(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ScaleSetPriority to be used to specify virtual machine scale set priority. Default to regular. """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/models/_models_py3.py index 5e62a6691607..2d89a734ab29 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/models/_models_py3.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/models/_models_py3.py @@ -6,11 +6,13 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Dict, List, Optional, Union +from typing import Dict, List, Optional, TYPE_CHECKING, Union import msrest.serialization -from ._container_service_client_enums import * +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + import __init__ as _models class SubResource(msrest.serialization.Model): @@ -67,7 +69,7 @@ class AgentPool(SubResource): range of 0 to 100 (inclusive) for user pools and in the range of 1 to 100 (inclusive) for system pools. The default value is 1. :vartype count: int - :ivar vm_size: Size of agent VMs. Possible values include: "Standard_A1", "Standard_A10", + :ivar vm_size: Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -116,7 +118,7 @@ class AgentPool(SubResource): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2020_06_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -124,12 +126,11 @@ class AgentPool(SubResource): :vartype min_count: int :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool - :ivar type_properties_type: AgentPoolType represents types of an agent pool. Possible values - include: "VirtualMachineScaleSets", "AvailabilitySet". + :ivar type_properties_type: AgentPoolType represents types of an agent pool. Known values are: + "VirtualMachineScaleSets", "AvailabilitySet". :vartype type_properties_type: str or ~azure.mgmt.containerservice.v2020_06_01.models.AgentPoolType - :ivar mode: AgentPoolMode represents mode of an agent pool. Possible values include: "System", - "User". + :ivar mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", "User". :vartype mode: str or ~azure.mgmt.containerservice.v2020_06_01.models.AgentPoolMode :ivar orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -148,12 +149,11 @@ class AgentPool(SubResource): :ivar enable_node_public_ip: Enable public IP for nodes. :vartype enable_node_public_ip: bool :ivar scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Possible values include: "Spot", "Regular". Default value: - "Regular". + priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_06_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy - for Spot virtual machine scale set. Default to Delete. Possible values include: "Delete", + for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", "Deallocate". Default value: "Delete". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_06_01.models.ScaleSetEvictionPolicy @@ -215,23 +215,23 @@ def __init__( self, *, count: Optional[int] = None, - vm_size: Optional[Union[str, "ContainerServiceVMSizeTypes"]] = None, + vm_size: Optional[Union[str, "_models.ContainerServiceVMSizeTypes"]] = None, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - type_properties_type: Optional[Union[str, "AgentPoolType"]] = None, - mode: Optional[Union[str, "AgentPoolMode"]] = None, + type_properties_type: Optional[Union[str, "_models.AgentPoolType"]] = None, + mode: Optional[Union[str, "_models.AgentPoolMode"]] = None, orchestrator_version: Optional[str] = None, node_image_version: Optional[str] = None, - upgrade_settings: Optional["AgentPoolUpgradeSettings"] = None, + upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, - scale_set_priority: Optional[Union[str, "ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", spot_max_price: Optional[float] = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, @@ -244,7 +244,7 @@ def __init__( range of 0 to 100 (inclusive) for user pools and in the range of 1 to 100 (inclusive) for system pools. The default value is 1. :paramtype count: int - :keyword vm_size: Size of agent VMs. Possible values include: "Standard_A1", "Standard_A10", + :keyword vm_size: Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -293,7 +293,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2020_06_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -301,12 +301,12 @@ def __init__( :paramtype min_count: int :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool - :keyword type_properties_type: AgentPoolType represents types of an agent pool. Possible values - include: "VirtualMachineScaleSets", "AvailabilitySet". + :keyword type_properties_type: AgentPoolType represents types of an agent pool. Known values + are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type_properties_type: str or ~azure.mgmt.containerservice.v2020_06_01.models.AgentPoolType - :keyword mode: AgentPoolMode represents mode of an agent pool. Possible values include: - "System", "User". + :keyword mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", + "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2020_06_01.models.AgentPoolMode :keyword orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -322,13 +322,12 @@ def __init__( :keyword enable_node_public_ip: Enable public IP for nodes. :paramtype enable_node_public_ip: bool :keyword scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Possible values include: "Spot", "Regular". Default value: - "Regular". + priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_06_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction - policy for Spot virtual machine scale set. Default to Delete. Possible values include: - "Delete", "Deallocate". Default value: "Delete". + policy for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", + "Deallocate". Default value: "Delete". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_06_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: SpotMaxPrice to be used to specify the maximum price you are willing @@ -405,7 +404,7 @@ class AgentPoolAvailableVersions(msrest.serialization.Model): def __init__( self, *, - agent_pool_versions: Optional[List["AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem"]] = None, + agent_pool_versions: Optional[List["_models.AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem"]] = None, **kwargs ): """ @@ -482,7 +481,7 @@ class AgentPoolListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["AgentPool"]] = None, + value: Optional[List["_models.AgentPool"]] = None, **kwargs ): """ @@ -510,7 +509,7 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): :ivar kubernetes_version: Required. Kubernetes version (major, minor, patch). :vartype kubernetes_version: str :ivar os_type: Required. OsType to be used to specify os type. Choose from Linux and Windows. - Default to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2020_06_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -542,8 +541,8 @@ def __init__( self, *, kubernetes_version: str, - os_type: Union[str, "OSType"] = "Linux", - upgrades: Optional[List["AgentPoolUpgradeProfilePropertiesUpgradesItem"]] = None, + os_type: Union[str, "_models.OSType"] = "Linux", + upgrades: Optional[List["_models.AgentPoolUpgradeProfilePropertiesUpgradesItem"]] = None, latest_node_image_version: Optional[str] = None, **kwargs ): @@ -551,7 +550,7 @@ def __init__( :keyword kubernetes_version: Required. Kubernetes version (major, minor, patch). :paramtype kubernetes_version: str :keyword os_type: Required. OsType to be used to specify os type. Choose from Linux and - Windows. Default to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Windows. Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2020_06_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: @@ -726,23 +725,23 @@ class BaseManagedCluster(msrest.serialization.Model): def __init__( self, *, - identity: Optional["ManagedClusterIdentity"] = None, + identity: Optional["_models.ManagedClusterIdentity"] = None, kubernetes_version: Optional[str] = None, dns_prefix: Optional[str] = None, - agent_pool_profiles: Optional[List["ManagedClusterAgentPoolProfile"]] = None, - linux_profile: Optional["ContainerServiceLinuxProfile"] = None, - windows_profile: Optional["ManagedClusterWindowsProfile"] = None, - service_principal_profile: Optional["ManagedClusterServicePrincipalProfile"] = None, - addon_profiles: Optional[Dict[str, "ManagedClusterAddonProfile"]] = None, + agent_pool_profiles: Optional[List["_models.ManagedClusterAgentPoolProfile"]] = None, + linux_profile: Optional["_models.ContainerServiceLinuxProfile"] = None, + windows_profile: Optional["_models.ManagedClusterWindowsProfile"] = None, + service_principal_profile: Optional["_models.ManagedClusterServicePrincipalProfile"] = None, + addon_profiles: Optional[Dict[str, "_models.ManagedClusterAddonProfile"]] = None, node_resource_group: Optional[str] = None, enable_rbac: Optional[bool] = None, enable_pod_security_policy: Optional[bool] = None, - network_profile: Optional["ContainerServiceNetworkProfile"] = None, - aad_profile: Optional["ManagedClusterAADProfile"] = None, - auto_scaler_profile: Optional["ManagedClusterPropertiesAutoScalerProfile"] = None, - api_server_access_profile: Optional["ManagedClusterAPIServerAccessProfile"] = None, + network_profile: Optional["_models.ContainerServiceNetworkProfile"] = None, + aad_profile: Optional["_models.ManagedClusterAADProfile"] = None, + auto_scaler_profile: Optional["_models.ManagedClusterPropertiesAutoScalerProfile"] = None, + api_server_access_profile: Optional["_models.ManagedClusterAPIServerAccessProfile"] = None, disk_encryption_set_id: Optional[str] = None, - identity_profile: Optional[Dict[str, "ManagedClusterPropertiesIdentityProfileValue"]] = None, + identity_profile: Optional[Dict[str, "_models.ManagedClusterPropertiesIdentityProfileValue"]] = None, **kwargs ): """ @@ -848,7 +847,7 @@ def __init__( code: Optional[str] = None, message: Optional[str] = None, target: Optional[str] = None, - details: Optional[List["CloudErrorBody"]] = None, + details: Optional[List["_models.CloudErrorBody"]] = None, **kwargs ): """ @@ -892,7 +891,7 @@ class ContainerServiceDiagnosticsProfile(msrest.serialization.Model): def __init__( self, *, - vm_diagnostics: "ContainerServiceVMDiagnostics", + vm_diagnostics: "_models.ContainerServiceVMDiagnostics", **kwargs ): """ @@ -929,7 +928,7 @@ def __init__( self, *, admin_username: str, - ssh: "ContainerServiceSshConfiguration", + ssh: "_models.ContainerServiceSshConfiguration", **kwargs ): """ @@ -952,17 +951,17 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar count: Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, - and 5. The default value is 1. Possible values include: 1, 3, 5. Default value: "1". + and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". :vartype count: int or ~azure.mgmt.containerservice.v2020_06_01.models.Count :ivar dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. :vartype dns_prefix: str - :ivar vm_size: Required. Size of agent VMs. Possible values include: "Standard_A1", - "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", - "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", - "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", - "Standard_A8m_v2", "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", - "Standard_B8ms", "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", - "Standard_D12", "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", + :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", + "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", + "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", + "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", "Standard_B8ms", + "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", "Standard_D12", + "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", "Standard_D13_v2_Promo", "Standard_D14", "Standard_D14_v2", "Standard_D14_v2_Promo", "Standard_D15_v2", "Standard_D16_v3", "Standard_D16s_v3", "Standard_D1_v2", "Standard_D2", "Standard_D2_v2", "Standard_D2_v2_Promo", "Standard_D2_v3", "Standard_D2s_v3", "Standard_D3", @@ -1007,7 +1006,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): :vartype first_consecutive_static_ip: str :ivar storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Possible values include: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". :vartype storage_profile: str or ~azure.mgmt.containerservice.v2020_06_01.models.ContainerServiceStorageProfileTypes :ivar fqdn: FQDN for the master pool. @@ -1036,27 +1035,27 @@ def __init__( self, *, dns_prefix: str, - vm_size: Union[str, "ContainerServiceVMSizeTypes"], - count: Optional[Union[int, "Count"]] = 1, + vm_size: Union[str, "_models.ContainerServiceVMSizeTypes"], + count: Optional[Union[int, "_models.Count"]] = 1, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, first_consecutive_static_ip: Optional[str] = "10.240.255.5", - storage_profile: Optional[Union[str, "ContainerServiceStorageProfileTypes"]] = None, + storage_profile: Optional[Union[str, "_models.ContainerServiceStorageProfileTypes"]] = None, **kwargs ): """ :keyword count: Number of masters (VMs) in the container service cluster. Allowed values are 1, - 3, and 5. The default value is 1. Possible values include: 1, 3, 5. Default value: "1". + 3, and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". :paramtype count: int or ~azure.mgmt.containerservice.v2020_06_01.models.Count :keyword dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. :paramtype dns_prefix: str - :keyword vm_size: Required. Size of agent VMs. Possible values include: "Standard_A1", - "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", - "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", - "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", - "Standard_A8m_v2", "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", - "Standard_B8ms", "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", - "Standard_D12", "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", + :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", + "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", + "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", + "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", "Standard_B8ms", + "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", "Standard_D12", + "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", "Standard_D13_v2_Promo", "Standard_D14", "Standard_D14_v2", "Standard_D14_v2_Promo", "Standard_D15_v2", "Standard_D16_v3", "Standard_D16s_v3", "Standard_D1_v2", "Standard_D2", "Standard_D2_v2", "Standard_D2_v2_Promo", "Standard_D2_v3", "Standard_D2s_v3", "Standard_D3", @@ -1101,7 +1100,7 @@ def __init__( :paramtype first_consecutive_static_ip: str :keyword storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Possible values include: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". :paramtype storage_profile: str or ~azure.mgmt.containerservice.v2020_06_01.models.ContainerServiceStorageProfileTypes """ @@ -1119,13 +1118,13 @@ def __init__( class ContainerServiceNetworkProfile(msrest.serialization.Model): """Profile of network configuration. - :ivar network_plugin: Network plugin used for building Kubernetes network. Possible values - include: "azure", "kubenet". Default value: "kubenet". + :ivar network_plugin: Network plugin used for building Kubernetes network. Known values are: + "azure", "kubenet". Default value: "kubenet". :vartype network_plugin: str or ~azure.mgmt.containerservice.v2020_06_01.models.NetworkPlugin - :ivar network_policy: Network policy used for building Kubernetes network. Possible values - include: "calico", "azure". + :ivar network_policy: Network policy used for building Kubernetes network. Known values are: + "calico", "azure". :vartype network_policy: str or ~azure.mgmt.containerservice.v2020_06_01.models.NetworkPolicy - :ivar network_mode: Network mode used for building Kubernetes network. Possible values include: + :ivar network_mode: Network mode used for building Kubernetes network. Known values are: "transparent", "bridge". :vartype network_mode: str or ~azure.mgmt.containerservice.v2020_06_01.models.NetworkMode :ivar pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. @@ -1139,11 +1138,11 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): :ivar docker_bridge_cidr: A CIDR notation IP range assigned to the Docker bridge network. It must not overlap with any Subnet IP ranges or the Kubernetes service address range. :vartype docker_bridge_cidr: str - :ivar outbound_type: The outbound (egress) routing method. Possible values include: - "loadBalancer", "userDefinedRouting". Default value: "loadBalancer". + :ivar outbound_type: The outbound (egress) routing method. Known values are: "loadBalancer", + "userDefinedRouting". Default value: "loadBalancer". :vartype outbound_type: str or ~azure.mgmt.containerservice.v2020_06_01.models.OutboundType - :ivar load_balancer_sku: The load balancer sku for the managed cluster. Possible values - include: "standard", "basic". + :ivar load_balancer_sku: The load balancer sku for the managed cluster. Known values are: + "standard", "basic". :vartype load_balancer_sku: str or ~azure.mgmt.containerservice.v2020_06_01.models.LoadBalancerSku :ivar load_balancer_profile: Profile of the cluster load balancer. @@ -1174,27 +1173,27 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): def __init__( self, *, - network_plugin: Optional[Union[str, "NetworkPlugin"]] = "kubenet", - network_policy: Optional[Union[str, "NetworkPolicy"]] = None, - network_mode: Optional[Union[str, "NetworkMode"]] = None, + network_plugin: Optional[Union[str, "_models.NetworkPlugin"]] = "kubenet", + network_policy: Optional[Union[str, "_models.NetworkPolicy"]] = None, + network_mode: Optional[Union[str, "_models.NetworkMode"]] = None, pod_cidr: Optional[str] = "10.244.0.0/16", service_cidr: Optional[str] = "10.0.0.0/16", dns_service_ip: Optional[str] = "10.0.0.10", docker_bridge_cidr: Optional[str] = "172.17.0.1/16", - outbound_type: Optional[Union[str, "OutboundType"]] = "loadBalancer", - load_balancer_sku: Optional[Union[str, "LoadBalancerSku"]] = None, - load_balancer_profile: Optional["ManagedClusterLoadBalancerProfile"] = None, + outbound_type: Optional[Union[str, "_models.OutboundType"]] = "loadBalancer", + load_balancer_sku: Optional[Union[str, "_models.LoadBalancerSku"]] = None, + load_balancer_profile: Optional["_models.ManagedClusterLoadBalancerProfile"] = None, **kwargs ): """ - :keyword network_plugin: Network plugin used for building Kubernetes network. Possible values - include: "azure", "kubenet". Default value: "kubenet". + :keyword network_plugin: Network plugin used for building Kubernetes network. Known values are: + "azure", "kubenet". Default value: "kubenet". :paramtype network_plugin: str or ~azure.mgmt.containerservice.v2020_06_01.models.NetworkPlugin - :keyword network_policy: Network policy used for building Kubernetes network. Possible values - include: "calico", "azure". + :keyword network_policy: Network policy used for building Kubernetes network. Known values are: + "calico", "azure". :paramtype network_policy: str or ~azure.mgmt.containerservice.v2020_06_01.models.NetworkPolicy - :keyword network_mode: Network mode used for building Kubernetes network. Possible values - include: "transparent", "bridge". + :keyword network_mode: Network mode used for building Kubernetes network. Known values are: + "transparent", "bridge". :paramtype network_mode: str or ~azure.mgmt.containerservice.v2020_06_01.models.NetworkMode :keyword pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :paramtype pod_cidr: str @@ -1207,11 +1206,11 @@ def __init__( :keyword docker_bridge_cidr: A CIDR notation IP range assigned to the Docker bridge network. It must not overlap with any Subnet IP ranges or the Kubernetes service address range. :paramtype docker_bridge_cidr: str - :keyword outbound_type: The outbound (egress) routing method. Possible values include: - "loadBalancer", "userDefinedRouting". Default value: "loadBalancer". + :keyword outbound_type: The outbound (egress) routing method. Known values are: "loadBalancer", + "userDefinedRouting". Default value: "loadBalancer". :paramtype outbound_type: str or ~azure.mgmt.containerservice.v2020_06_01.models.OutboundType - :keyword load_balancer_sku: The load balancer sku for the managed cluster. Possible values - include: "standard", "basic". + :keyword load_balancer_sku: The load balancer sku for the managed cluster. Known values are: + "standard", "basic". :paramtype load_balancer_sku: str or ~azure.mgmt.containerservice.v2020_06_01.models.LoadBalancerSku :keyword load_balancer_profile: Profile of the cluster load balancer. @@ -1253,7 +1252,7 @@ class ContainerServiceSshConfiguration(msrest.serialization.Model): def __init__( self, *, - public_keys: List["ContainerServiceSshPublicKey"], + public_keys: List["_models.ContainerServiceSshPublicKey"], **kwargs ): """ @@ -1573,25 +1572,25 @@ def __init__( self, *, location: str, - identity: Optional["ManagedClusterIdentity"] = None, + identity: Optional["_models.ManagedClusterIdentity"] = None, kubernetes_version: Optional[str] = None, dns_prefix: Optional[str] = None, - agent_pool_profiles: Optional[List["ManagedClusterAgentPoolProfile"]] = None, - linux_profile: Optional["ContainerServiceLinuxProfile"] = None, - windows_profile: Optional["ManagedClusterWindowsProfile"] = None, - service_principal_profile: Optional["ManagedClusterServicePrincipalProfile"] = None, - addon_profiles: Optional[Dict[str, "ManagedClusterAddonProfile"]] = None, + agent_pool_profiles: Optional[List["_models.ManagedClusterAgentPoolProfile"]] = None, + linux_profile: Optional["_models.ContainerServiceLinuxProfile"] = None, + windows_profile: Optional["_models.ManagedClusterWindowsProfile"] = None, + service_principal_profile: Optional["_models.ManagedClusterServicePrincipalProfile"] = None, + addon_profiles: Optional[Dict[str, "_models.ManagedClusterAddonProfile"]] = None, node_resource_group: Optional[str] = None, enable_rbac: Optional[bool] = None, enable_pod_security_policy: Optional[bool] = None, - network_profile: Optional["ContainerServiceNetworkProfile"] = None, - aad_profile: Optional["ManagedClusterAADProfile"] = None, - auto_scaler_profile: Optional["ManagedClusterPropertiesAutoScalerProfile"] = None, - api_server_access_profile: Optional["ManagedClusterAPIServerAccessProfile"] = None, + network_profile: Optional["_models.ContainerServiceNetworkProfile"] = None, + aad_profile: Optional["_models.ManagedClusterAADProfile"] = None, + auto_scaler_profile: Optional["_models.ManagedClusterPropertiesAutoScalerProfile"] = None, + api_server_access_profile: Optional["_models.ManagedClusterAPIServerAccessProfile"] = None, disk_encryption_set_id: Optional[str] = None, - identity_profile: Optional[Dict[str, "ManagedClusterPropertiesIdentityProfileValue"]] = None, + identity_profile: Optional[Dict[str, "_models.ManagedClusterPropertiesIdentityProfileValue"]] = None, tags: Optional[Dict[str, str]] = None, - sku: Optional["ManagedClusterSKU"] = None, + sku: Optional["_models.ManagedClusterSKU"] = None, **kwargs ): """ @@ -1937,7 +1936,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): range of 0 to 100 (inclusive) for user pools and in the range of 1 to 100 (inclusive) for system pools. The default value is 1. :vartype count: int - :ivar vm_size: Size of agent VMs. Possible values include: "Standard_A1", "Standard_A10", + :ivar vm_size: Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -1986,7 +1985,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2020_06_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -1994,11 +1993,10 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :vartype min_count: int :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool - :ivar type: AgentPoolType represents types of an agent pool. Possible values include: + :ivar type: AgentPoolType represents types of an agent pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2020_06_01.models.AgentPoolType - :ivar mode: AgentPoolMode represents mode of an agent pool. Possible values include: "System", - "User". + :ivar mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", "User". :vartype mode: str or ~azure.mgmt.containerservice.v2020_06_01.models.AgentPoolMode :ivar orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -2017,12 +2015,11 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar enable_node_public_ip: Enable public IP for nodes. :vartype enable_node_public_ip: bool :ivar scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Possible values include: "Spot", "Regular". Default value: - "Regular". + priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_06_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy - for Spot virtual machine scale set. Default to Delete. Possible values include: "Delete", + for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", "Deallocate". Default value: "Delete". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_06_01.models.ScaleSetEvictionPolicy @@ -2078,23 +2075,23 @@ def __init__( self, *, count: Optional[int] = None, - vm_size: Optional[Union[str, "ContainerServiceVMSizeTypes"]] = None, + vm_size: Optional[Union[str, "_models.ContainerServiceVMSizeTypes"]] = None, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - type: Optional[Union[str, "AgentPoolType"]] = None, - mode: Optional[Union[str, "AgentPoolMode"]] = None, + type: Optional[Union[str, "_models.AgentPoolType"]] = None, + mode: Optional[Union[str, "_models.AgentPoolMode"]] = None, orchestrator_version: Optional[str] = None, node_image_version: Optional[str] = None, - upgrade_settings: Optional["AgentPoolUpgradeSettings"] = None, + upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, - scale_set_priority: Optional[Union[str, "ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", spot_max_price: Optional[float] = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, @@ -2107,7 +2104,7 @@ def __init__( range of 0 to 100 (inclusive) for user pools and in the range of 1 to 100 (inclusive) for system pools. The default value is 1. :paramtype count: int - :keyword vm_size: Size of agent VMs. Possible values include: "Standard_A1", "Standard_A10", + :keyword vm_size: Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -2156,7 +2153,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2020_06_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -2164,11 +2161,11 @@ def __init__( :paramtype min_count: int :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool - :keyword type: AgentPoolType represents types of an agent pool. Possible values include: + :keyword type: AgentPoolType represents types of an agent pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2020_06_01.models.AgentPoolType - :keyword mode: AgentPoolMode represents mode of an agent pool. Possible values include: - "System", "User". + :keyword mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", + "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2020_06_01.models.AgentPoolMode :keyword orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -2184,13 +2181,12 @@ def __init__( :keyword enable_node_public_ip: Enable public IP for nodes. :paramtype enable_node_public_ip: bool :keyword scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Possible values include: "Spot", "Regular". Default value: - "Regular". + priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_06_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction - policy for Spot virtual machine scale set. Default to Delete. Possible values include: - "Delete", "Deallocate". Default value: "Delete". + policy for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", + "Deallocate". Default value: "Delete". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_06_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: SpotMaxPrice to be used to specify the maximum price you are willing @@ -2246,7 +2242,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): range of 0 to 100 (inclusive) for user pools and in the range of 1 to 100 (inclusive) for system pools. The default value is 1. :vartype count: int - :ivar vm_size: Size of agent VMs. Possible values include: "Standard_A1", "Standard_A10", + :ivar vm_size: Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -2295,7 +2291,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2020_06_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -2303,11 +2299,10 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :vartype min_count: int :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool - :ivar type: AgentPoolType represents types of an agent pool. Possible values include: + :ivar type: AgentPoolType represents types of an agent pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2020_06_01.models.AgentPoolType - :ivar mode: AgentPoolMode represents mode of an agent pool. Possible values include: "System", - "User". + :ivar mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", "User". :vartype mode: str or ~azure.mgmt.containerservice.v2020_06_01.models.AgentPoolMode :ivar orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -2326,12 +2321,11 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar enable_node_public_ip: Enable public IP for nodes. :vartype enable_node_public_ip: bool :ivar scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Possible values include: "Spot", "Regular". Default value: - "Regular". + priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_06_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy - for Spot virtual machine scale set. Default to Delete. Possible values include: "Delete", + for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", "Deallocate". Default value: "Delete". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_06_01.models.ScaleSetEvictionPolicy @@ -2393,23 +2387,23 @@ def __init__( *, name: str, count: Optional[int] = None, - vm_size: Optional[Union[str, "ContainerServiceVMSizeTypes"]] = None, + vm_size: Optional[Union[str, "_models.ContainerServiceVMSizeTypes"]] = None, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - type: Optional[Union[str, "AgentPoolType"]] = None, - mode: Optional[Union[str, "AgentPoolMode"]] = None, + type: Optional[Union[str, "_models.AgentPoolType"]] = None, + mode: Optional[Union[str, "_models.AgentPoolMode"]] = None, orchestrator_version: Optional[str] = None, node_image_version: Optional[str] = None, - upgrade_settings: Optional["AgentPoolUpgradeSettings"] = None, + upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, - scale_set_priority: Optional[Union[str, "ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", spot_max_price: Optional[float] = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, @@ -2422,7 +2416,7 @@ def __init__( range of 0 to 100 (inclusive) for user pools and in the range of 1 to 100 (inclusive) for system pools. The default value is 1. :paramtype count: int - :keyword vm_size: Size of agent VMs. Possible values include: "Standard_A1", "Standard_A10", + :keyword vm_size: Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -2471,7 +2465,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2020_06_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -2479,11 +2473,11 @@ def __init__( :paramtype min_count: int :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool - :keyword type: AgentPoolType represents types of an agent pool. Possible values include: + :keyword type: AgentPoolType represents types of an agent pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2020_06_01.models.AgentPoolType - :keyword mode: AgentPoolMode represents mode of an agent pool. Possible values include: - "System", "User". + :keyword mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", + "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2020_06_01.models.AgentPoolMode :keyword orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -2499,13 +2493,12 @@ def __init__( :keyword enable_node_public_ip: Enable public IP for nodes. :paramtype enable_node_public_ip: bool :keyword scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Possible values include: "Spot", "Regular". Default value: - "Regular". + priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_06_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction - policy for Spot virtual machine scale set. Default to Delete. Possible values include: - "Delete", "Deallocate". Default value: "Delete". + policy for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", + "Deallocate". Default value: "Delete". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_06_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: SpotMaxPrice to be used to specify the maximum price you are willing @@ -2576,8 +2569,8 @@ class ManagedClusterIdentity(msrest.serialization.Model): :ivar type: The type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ resource group in agent nodes. Type 'None' will not use MSI for the managed cluster, - service principal will be used instead. Possible values include: "SystemAssigned", - "UserAssigned", "None". + service principal will be used instead. Known values are: "SystemAssigned", "UserAssigned", + "None". :vartype type: str or ~azure.mgmt.containerservice.v2020_06_01.models.ResourceIdentityType :ivar user_assigned_identities: The user identity associated with the managed cluster. This identity will be used in control plane and only one user assigned identity is allowed. The user @@ -2602,15 +2595,15 @@ class ManagedClusterIdentity(msrest.serialization.Model): def __init__( self, *, - type: Optional[Union[str, "ResourceIdentityType"]] = None, - user_assigned_identities: Optional[Dict[str, "ManagedClusterIdentityUserAssignedIdentitiesValue"]] = None, + type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, + user_assigned_identities: Optional[Dict[str, "_models.ManagedClusterIdentityUserAssignedIdentitiesValue"]] = None, **kwargs ): """ :keyword type: The type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ resource group in agent nodes. Type 'None' will not use MSI for the managed - cluster, service principal will be used instead. Possible values include: "SystemAssigned", + cluster, service principal will be used instead. Known values are: "SystemAssigned", "UserAssigned", "None". :paramtype type: str or ~azure.mgmt.containerservice.v2020_06_01.models.ResourceIdentityType :keyword user_assigned_identities: The user identity associated with the managed cluster. This @@ -2682,7 +2675,7 @@ class ManagedClusterListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["ManagedCluster"]] = None, + value: Optional[List["_models.ManagedCluster"]] = None, **kwargs ): """ @@ -2736,10 +2729,10 @@ class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): def __init__( self, *, - managed_outbound_i_ps: Optional["ManagedClusterLoadBalancerProfileManagedOutboundIPs"] = None, - outbound_ip_prefixes: Optional["ManagedClusterLoadBalancerProfileOutboundIPPrefixes"] = None, - outbound_i_ps: Optional["ManagedClusterLoadBalancerProfileOutboundIPs"] = None, - effective_outbound_i_ps: Optional[List["ResourceReference"]] = None, + managed_outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileManagedOutboundIPs"] = None, + outbound_ip_prefixes: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPPrefixes"] = None, + outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPs"] = None, + effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, allocated_outbound_ports: Optional[int] = 0, idle_timeout_in_minutes: Optional[int] = 30, **kwargs @@ -2822,7 +2815,7 @@ class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.M def __init__( self, *, - public_ip_prefixes: Optional[List["ResourceReference"]] = None, + public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, **kwargs ): """ @@ -2848,7 +2841,7 @@ class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): def __init__( self, *, - public_i_ps: Optional[List["ResourceReference"]] = None, + public_i_ps: Optional[List["_models.ResourceReference"]] = None, **kwargs ): """ @@ -2869,7 +2862,7 @@ class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): :ivar name: Pool name. :vartype name: str :ivar os_type: Required. OsType to be used to specify os type. Choose from Linux and Windows. - Default to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2020_06_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -2892,9 +2885,9 @@ def __init__( self, *, kubernetes_version: str, - os_type: Union[str, "OSType"] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", name: Optional[str] = None, - upgrades: Optional[List["ManagedClusterPoolUpgradeProfileUpgradesItem"]] = None, + upgrades: Optional[List["_models.ManagedClusterPoolUpgradeProfileUpgradesItem"]] = None, **kwargs ): """ @@ -2903,7 +2896,7 @@ def __init__( :keyword name: Pool name. :paramtype name: str :keyword os_type: Required. OsType to be used to specify os type. Choose from Linux and - Windows. Default to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Windows. Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2020_06_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: @@ -3106,9 +3099,9 @@ def __init__( class ManagedClusterSKU(msrest.serialization.Model): """ManagedClusterSKU. - :ivar name: Name of a managed cluster SKU. Possible values include: "Basic". + :ivar name: Name of a managed cluster SKU. Known values are: "Basic". :vartype name: str or ~azure.mgmt.containerservice.v2020_06_01.models.ManagedClusterSKUName - :ivar tier: Tier of a managed cluster SKU. Possible values include: "Paid", "Free". + :ivar tier: Tier of a managed cluster SKU. Known values are: "Paid", "Free". :vartype tier: str or ~azure.mgmt.containerservice.v2020_06_01.models.ManagedClusterSKUTier """ @@ -3120,14 +3113,14 @@ class ManagedClusterSKU(msrest.serialization.Model): def __init__( self, *, - name: Optional[Union[str, "ManagedClusterSKUName"]] = None, - tier: Optional[Union[str, "ManagedClusterSKUTier"]] = None, + name: Optional[Union[str, "_models.ManagedClusterSKUName"]] = None, + tier: Optional[Union[str, "_models.ManagedClusterSKUTier"]] = None, **kwargs ): """ - :keyword name: Name of a managed cluster SKU. Possible values include: "Basic". + :keyword name: Name of a managed cluster SKU. Known values are: "Basic". :paramtype name: str or ~azure.mgmt.containerservice.v2020_06_01.models.ManagedClusterSKUName - :keyword tier: Tier of a managed cluster SKU. Possible values include: "Paid", "Free". + :keyword tier: Tier of a managed cluster SKU. Known values are: "Paid", "Free". :paramtype tier: str or ~azure.mgmt.containerservice.v2020_06_01.models.ManagedClusterSKUTier """ super(ManagedClusterSKU, self).__init__(**kwargs) @@ -3176,8 +3169,8 @@ class ManagedClusterUpgradeProfile(msrest.serialization.Model): def __init__( self, *, - control_plane_profile: "ManagedClusterPoolUpgradeProfile", - agent_pool_profiles: List["ManagedClusterPoolUpgradeProfile"], + control_plane_profile: "_models.ManagedClusterPoolUpgradeProfile", + agent_pool_profiles: List["_models.ManagedClusterPoolUpgradeProfile"], **kwargs ): """ @@ -3374,7 +3367,7 @@ class PrivateEndpointConnection(msrest.serialization.Model): :vartype name: str :ivar type: The resource type. :vartype type: str - :ivar provisioning_state: The current provisioning state. Possible values include: "Succeeded", + :ivar provisioning_state: The current provisioning state. Known values are: "Succeeded", "Creating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2020_06_01.models.PrivateEndpointConnectionProvisioningState @@ -3405,8 +3398,8 @@ class PrivateEndpointConnection(msrest.serialization.Model): def __init__( self, *, - private_endpoint: Optional["PrivateEndpoint"] = None, - private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, + private_endpoint: Optional["_models.PrivateEndpoint"] = None, + private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionState"] = None, **kwargs ): """ @@ -3440,7 +3433,7 @@ class PrivateEndpointConnectionListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["PrivateEndpointConnection"]] = None, + value: Optional[List["_models.PrivateEndpointConnection"]] = None, **kwargs ): """ @@ -3455,7 +3448,7 @@ def __init__( class PrivateLinkServiceConnectionState(msrest.serialization.Model): """The state of a private link service connection. - :ivar status: The private link service connection status. Possible values include: "Pending", + :ivar status: The private link service connection status. Known values are: "Pending", "Approved", "Rejected", "Disconnected". :vartype status: str or ~azure.mgmt.containerservice.v2020_06_01.models.ConnectionStatus :ivar description: The private link service connection description. @@ -3470,13 +3463,13 @@ class PrivateLinkServiceConnectionState(msrest.serialization.Model): def __init__( self, *, - status: Optional[Union[str, "ConnectionStatus"]] = None, + status: Optional[Union[str, "_models.ConnectionStatus"]] = None, description: Optional[str] = None, **kwargs ): """ - :keyword status: The private link service connection status. Possible values include: - "Pending", "Approved", "Rejected", "Disconnected". + :keyword status: The private link service connection status. Known values are: "Pending", + "Approved", "Rejected", "Disconnected". :paramtype status: str or ~azure.mgmt.containerservice.v2020_06_01.models.ConnectionStatus :keyword description: The private link service connection description. :paramtype description: str diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/models/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/models/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/operations/__init__.py index fdbf34a0f841..9ef6890a9e03 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/operations/__init__.py @@ -11,9 +11,14 @@ from ._agent_pools_operations import AgentPoolsOperations from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'Operations', 'ManagedClustersOperations', 'AgentPoolsOperations', 'PrivateEndpointConnectionsOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/operations/_agent_pools_operations.py index 783e51cdf62a..edb6a6f65953 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/operations/_agent_pools_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -35,9 +35,12 @@ def build_list_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-06-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools") # pylint: disable=line-too-long path_format_arguments = { @@ -49,18 +52,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -72,9 +73,12 @@ def build_get_request( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-06-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -87,18 +91,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -109,14 +111,17 @@ def build_create_or_update_request_initial( resource_name: str, agent_pool_name: str, *, - json: JSONType = None, + json: Optional[_models.AgentPool] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-06-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -129,20 +134,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -156,9 +159,12 @@ def build_delete_request_initial( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-06-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -171,18 +177,16 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -194,9 +198,12 @@ def build_get_upgrade_profile_request( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-06-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default") # pylint: disable=line-too-long path_format_arguments = { @@ -209,18 +216,16 @@ def build_get_upgrade_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -231,9 +236,12 @@ def build_get_available_agent_pool_versions_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-06-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions") # pylint: disable=line-too-long path_format_arguments = { @@ -245,42 +253,38 @@ def build_get_available_agent_pool_versions_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class AgentPoolsOperations(object): - """AgentPoolsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class AgentPoolsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2020_06_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2020_06_01.ContainerServiceClient`'s + :attr:`agent_pools` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -288,7 +292,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Iterable["_models.AgentPoolListResult"]: + ) -> Iterable[_models.AgentPoolListResult]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. The operation returns properties @@ -304,13 +308,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_06_01.models.AgentPoolListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-06-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -320,9 +327,11 @@ def prepare_request(next_link=None): resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -332,9 +341,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -374,7 +385,7 @@ def get( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPool": + ) -> _models.AgentPool: """Gets the agent pool. Gets the details of the agent pool by managed cluster and resource group. @@ -390,13 +401,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2020_06_01.models.AgentPool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-06-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] request = build_get_request( @@ -406,11 +420,13 @@ def get( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -436,17 +452,20 @@ def _create_or_update_initial( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> "_models.AgentPool": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] + ) -> _models.AgentPool: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-06-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] _json = self._serialize.body(parameters, 'AgentPool') @@ -459,11 +478,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -494,9 +515,9 @@ def begin_create_or_update( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> LROPoller["_models.AgentPool"]: + ) -> LROPoller[_models.AgentPool]: """Creates or updates an agent pool. Creates or updates an agent pool in the specified managed cluster. @@ -522,17 +543,20 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_06_01.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-06-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, @@ -540,20 +564,27 @@ def begin_create_or_update( 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): - response = pipeline_response.http_response deserialized = self._deserialize('AgentPool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -573,13 +604,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements agent_pool_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-06-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -589,11 +623,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -640,21 +676,26 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-06-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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) @@ -664,8 +705,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -685,7 +732,7 @@ def get_upgrade_profile( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPoolUpgradeProfile": + ) -> _models.AgentPoolUpgradeProfile: """Gets upgrade profile for an agent pool. Gets the details of the upgrade profile for an agent pool with a specified resource group and @@ -702,13 +749,16 @@ def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2020_06_01.models.AgentPoolUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-06-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] request = build_get_upgrade_profile_request( @@ -718,11 +768,13 @@ def get_upgrade_profile( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -749,7 +801,7 @@ def get_available_agent_pool_versions( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.AgentPoolAvailableVersions": + ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported versions for the specified agent pool. Gets a list of supported versions for the specified agent pool. @@ -763,13 +815,16 @@ def get_available_agent_pool_versions( :rtype: ~azure.mgmt.containerservice.v2020_06_01.models.AgentPoolAvailableVersions :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolAvailableVersions"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-06-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] request = build_get_available_agent_pool_versions_request( @@ -778,11 +833,13 @@ def get_available_agent_pool_versions( resource_name=resource_name, api_version=api_version, template_url=self.get_available_agent_pool_versions.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/operations/_managed_clusters_operations.py index 1989c213adcd..62bb702f62c8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/operations/_managed_clusters_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -33,9 +33,12 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-06-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters") path_format_arguments = { @@ -45,18 +48,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -66,9 +67,12 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-06-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters") # pylint: disable=line-too-long path_format_arguments = { @@ -79,18 +83,16 @@ def build_list_by_resource_group_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -101,9 +103,12 @@ def build_get_upgrade_profile_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-06-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default") # pylint: disable=line-too-long path_format_arguments = { @@ -115,18 +120,16 @@ def build_get_upgrade_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -138,9 +141,12 @@ def build_get_access_profile_request( role_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-06-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -153,18 +159,16 @@ def build_get_access_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -175,9 +179,12 @@ def build_list_cluster_admin_credentials_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-06-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -189,18 +196,16 @@ def build_list_cluster_admin_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -211,9 +216,12 @@ def build_list_cluster_user_credentials_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-06-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -225,18 +233,16 @@ def build_list_cluster_user_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -247,9 +253,12 @@ def build_list_cluster_monitoring_user_credentials_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-06-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -261,18 +270,16 @@ def build_list_cluster_monitoring_user_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -283,9 +290,12 @@ def build_get_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-06-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -297,18 +307,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -318,14 +326,17 @@ def build_create_or_update_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedCluster] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-06-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -337,20 +348,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -362,14 +371,17 @@ def build_update_tags_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.TagsObject] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-06-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -381,20 +393,18 @@ def build_update_tags_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -407,9 +417,12 @@ def build_delete_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-06-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -421,18 +434,16 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -442,14 +453,17 @@ def build_reset_service_principal_profile_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedClusterServicePrincipalProfile] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-06-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile") # pylint: disable=line-too-long path_format_arguments = { @@ -461,20 +475,18 @@ def build_reset_service_principal_profile_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -486,14 +498,17 @@ def build_reset_aad_profile_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedClusterAADProfile] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-06-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile") # pylint: disable=line-too-long path_format_arguments = { @@ -505,20 +520,18 @@ def build_reset_aad_profile_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -531,9 +544,12 @@ def build_rotate_cluster_certificates_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-06-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates") # pylint: disable=line-too-long path_format_arguments = { @@ -545,48 +561,44 @@ def build_rotate_cluster_certificates_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class ManagedClustersOperations(object): - """ManagedClustersOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ManagedClustersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2020_06_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2020_06_01.ContainerServiceClient`'s + :attr:`managed_clusters` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> Iterable["_models.ManagedClusterListResult"]: + ) -> Iterable[_models.ManagedClusterListResult]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. The operation returns properties @@ -599,13 +611,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_06_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-06-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -613,9 +628,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -623,9 +640,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -663,7 +682,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.ManagedClusterListResult"]: + ) -> Iterable[_models.ManagedClusterListResult]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. The operation returns @@ -678,13 +697,16 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_06_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-06-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -693,9 +715,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -704,9 +728,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -745,7 +771,7 @@ def get_upgrade_profile( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedClusterUpgradeProfile": + ) -> _models.ManagedClusterUpgradeProfile: """Gets upgrade profile for a managed cluster. Gets the details of the upgrade profile for a managed cluster with a specified resource group @@ -760,13 +786,16 @@ def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2020_06_01.models.ManagedClusterUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-06-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] request = build_get_upgrade_profile_request( @@ -775,11 +804,13 @@ def get_upgrade_profile( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -807,7 +838,7 @@ def get_access_profile( resource_name: str, role_name: str, **kwargs: Any - ) -> "_models.ManagedClusterAccessProfile": + ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. Gets the accessProfile for the specified role name of the managed cluster with a specified @@ -828,13 +859,16 @@ def get_access_profile( :rtype: ~azure.mgmt.containerservice.v2020_06_01.models.ManagedClusterAccessProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterAccessProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-06-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] request = build_get_access_profile_request( @@ -844,11 +878,13 @@ def get_access_profile( role_name=role_name, api_version=api_version, template_url=self.get_access_profile.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -875,7 +911,7 @@ def list_cluster_admin_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster admin credential of a managed cluster. Gets cluster admin credential of the managed cluster with a specified resource group and name. @@ -889,13 +925,16 @@ def list_cluster_admin_credentials( :rtype: ~azure.mgmt.containerservice.v2020_06_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-06-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_admin_credentials_request( @@ -904,11 +943,13 @@ def list_cluster_admin_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_admin_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -935,7 +976,7 @@ def list_cluster_user_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster user credential of a managed cluster. Gets cluster user credential of the managed cluster with a specified resource group and name. @@ -949,13 +990,16 @@ def list_cluster_user_credentials( :rtype: ~azure.mgmt.containerservice.v2020_06_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-06-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_user_credentials_request( @@ -964,11 +1008,13 @@ def list_cluster_user_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -995,7 +1041,7 @@ def list_cluster_monitoring_user_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster monitoring user credential of a managed cluster. Gets cluster monitoring user credential of the managed cluster with a specified resource group @@ -1010,13 +1056,16 @@ def list_cluster_monitoring_user_credentials( :rtype: ~azure.mgmt.containerservice.v2020_06_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-06-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_monitoring_user_credentials_request( @@ -1025,11 +1074,13 @@ def list_cluster_monitoring_user_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1056,7 +1107,7 @@ def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedCluster": + ) -> _models.ManagedCluster: """Gets a managed cluster. Gets the details of the managed cluster with a specified resource group and name. @@ -1070,13 +1121,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2020_06_01.models.ManagedCluster :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-06-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] request = build_get_request( @@ -1085,11 +1139,13 @@ def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1114,17 +1170,20 @@ def _create_or_update_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2020-06-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'ManagedCluster') @@ -1136,11 +1195,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1170,9 +1231,9 @@ def begin_create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> LROPoller["_models.ManagedCluster"]: + ) -> LROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. Creates or updates a managed cluster with the specified configuration for agents and Kubernetes @@ -1198,37 +1259,47 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_06_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-06-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1245,17 +1316,20 @@ def _update_tags_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-06-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'TagsObject') @@ -1267,11 +1341,13 @@ def _update_tags_initial( content_type=content_type, json=_json, template_url=self._update_tags_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1297,9 +1373,9 @@ def begin_update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> LROPoller["_models.ManagedCluster"]: + ) -> LROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates a managed cluster with the specified tags. @@ -1324,37 +1400,47 @@ def begin_update_tags( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_06_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-06-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._update_tags_initial( + raw_result = self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1373,13 +1459,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-06-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -1388,11 +1477,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1436,20 +1527,25 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-06-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_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) @@ -1459,8 +1555,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1477,17 +1579,20 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2020-06-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') @@ -1499,11 +1604,13 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re content_type=content_type, json=_json, template_url=self._reset_service_principal_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1525,7 +1632,7 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> LROPoller[None]: """Reset Service Principal Profile of a managed cluster. @@ -1552,23 +1659,28 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-06-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._reset_service_principal_profile_initial( + raw_result = self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1578,8 +1690,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1596,17 +1714,20 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2020-06-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') @@ -1618,11 +1739,13 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement content_type=content_type, json=_json, template_url=self._reset_aad_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1644,7 +1767,7 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> LROPoller[None]: """Reset AAD Profile of a managed cluster. @@ -1670,23 +1793,28 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-06-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._reset_aad_profile_initial( + raw_result = self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1696,8 +1824,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1716,13 +1850,16 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-06-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_rotate_cluster_certificates_request_initial( @@ -1731,11 +1868,13 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return resource_name=resource_name, api_version=api_version, template_url=self._rotate_cluster_certificates_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1779,20 +1918,25 @@ def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-st :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-06-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._rotate_cluster_certificates_initial( + raw_result = self._rotate_cluster_certificates_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) @@ -1802,8 +1946,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/operations/_operations.py index d464074da94a..7d1a57187b59 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/operations/_operations.py @@ -16,6 +16,7 @@ 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 @@ -29,55 +30,54 @@ def build_list_request( **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-06-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.ContainerService/operations") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class Operations(object): - """Operations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2020_06_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2020_06_01.ContainerServiceClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> Iterable["_models.OperationListResult"]: + ) -> Iterable[_models.OperationListResult]: """Gets a list of compute operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -86,31 +86,38 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_06_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-06-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/operations/_private_endpoint_connections_operations.py index 828e4b04672c..557dbb933621 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_06_01/operations/_private_endpoint_connections_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast from msrest import Serializer @@ -16,13 +16,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -34,9 +34,12 @@ def build_list_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-06-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections") # pylint: disable=line-too-long path_format_arguments = { @@ -48,18 +51,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -71,9 +72,12 @@ def build_get_request( private_endpoint_connection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-06-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -86,18 +90,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -108,14 +110,17 @@ def build_update_request( resource_name: str, private_endpoint_connection_name: str, *, - json: JSONType = None, + json: Optional[_models.PrivateEndpointConnection] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-06-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -128,20 +133,18 @@ def build_update_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -155,9 +158,12 @@ def build_delete_request_initial( private_endpoint_connection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-06-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -170,42 +176,38 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class PrivateEndpointConnectionsOperations(object): - """PrivateEndpointConnectionsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class PrivateEndpointConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2020_06_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2020_06_01.ContainerServiceClient`'s + :attr:`private_endpoint_connections` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -213,7 +215,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnectionListResult": + ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. Gets a list of private endpoint connections in the specified managed cluster. The operation @@ -228,13 +230,16 @@ def list( :rtype: ~azure.mgmt.containerservice.v2020_06_01.models.PrivateEndpointConnectionListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-06-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] request = build_list_request( @@ -243,11 +248,13 @@ def list( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -275,7 +282,7 @@ def get( resource_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Gets the private endpoint connection. Gets the details of the private endpoint connection by managed cluster and resource group. @@ -291,13 +298,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2020_06_01.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-06-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] request = build_get_request( @@ -307,11 +317,13 @@ def get( private_endpoint_connection_name=private_endpoint_connection_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -338,9 +350,9 @@ def update( resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - parameters: "_models.PrivateEndpointConnection", + parameters: _models.PrivateEndpointConnection, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. Updates a private endpoint connection in the specified managed cluster. @@ -358,14 +370,17 @@ def update( :rtype: ~azure.mgmt.containerservice.v2020_06_01.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-06-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] _json = self._serialize.body(parameters, 'PrivateEndpointConnection') @@ -378,11 +393,13 @@ def update( content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -410,13 +427,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-06-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -426,11 +446,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name=private_endpoint_connection_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -477,21 +499,26 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-06-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-06-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -501,8 +528,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/__init__.py index 53c675bd95e2..37a5f9e02e6f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._container_service_client import ContainerServiceClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['ContainerServiceClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/_container_service_client.py index 94e74cb3ee2b..d081c9189e72 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/_container_service_client.py @@ -63,10 +63,18 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.managed_clusters = ManagedClustersOperations(self._client, self._config, self._serialize, self._deserialize) - self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_clusters = ManagedClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.agent_pools = AgentPoolsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/aio/__init__.py index 53c675bd95e2..37a5f9e02e6f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/aio/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/aio/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._container_service_client import ContainerServiceClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['ContainerServiceClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/aio/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/aio/_container_service_client.py index 1907763e14e5..6a79a0e958c0 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/aio/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/aio/_container_service_client.py @@ -64,10 +64,18 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.managed_clusters = ManagedClustersOperations(self._client, self._config, self._serialize, self._deserialize) - self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_clusters = ManagedClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.agent_pools = AgentPoolsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/aio/operations/__init__.py index fdbf34a0f841..9ef6890a9e03 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/aio/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/aio/operations/__init__.py @@ -11,9 +11,14 @@ from ._agent_pools_operations import AgentPoolsOperations from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'Operations', 'ManagedClustersOperations', 'AgentPoolsOperations', 'PrivateEndpointConnectionsOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/aio/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/aio/operations/_agent_pools_operations.py index 64b13800b4c7..4db150fe871e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/aio/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/aio/operations/_agent_pools_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. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ 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 @@ -26,26 +27,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class AgentPoolsOperations: - """AgentPoolsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2020_07_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2020_07_01.aio.ContainerServiceClient`'s + :attr:`agent_pools` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -53,7 +52,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> AsyncIterable["_models.AgentPoolListResult"]: + ) -> AsyncIterable[_models.AgentPoolListResult]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. The operation returns properties @@ -69,13 +68,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_07_01.models.AgentPoolListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -85,9 +87,11 @@ def prepare_request(next_link=None): resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -97,9 +101,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -139,7 +145,7 @@ async def get( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPool": + ) -> _models.AgentPool: """Gets the agent pool. Gets the details of the agent pool by managed cluster and resource group. @@ -155,13 +161,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2020_07_01.models.AgentPool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-07-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] request = build_get_request( @@ -171,11 +180,13 @@ async def get( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -201,17 +212,20 @@ async def _create_or_update_initial( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> "_models.AgentPool": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] + ) -> _models.AgentPool: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] _json = self._serialize.body(parameters, 'AgentPool') @@ -224,11 +238,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -259,9 +275,9 @@ async def begin_create_or_update( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> AsyncLROPoller["_models.AgentPool"]: + ) -> AsyncLROPoller[_models.AgentPool]: """Creates or updates an agent pool. Creates or updates an agent pool in the specified managed cluster. @@ -288,17 +304,20 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_07_01.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, @@ -306,20 +325,27 @@ async def begin_create_or_update( 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): - response = pipeline_response.http_response deserialized = self._deserialize('AgentPool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -339,13 +365,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements agent_pool_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-07-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -355,11 +384,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -406,21 +437,26 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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) @@ -430,8 +466,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -451,7 +493,7 @@ async def get_upgrade_profile( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPoolUpgradeProfile": + ) -> _models.AgentPoolUpgradeProfile: """Gets upgrade profile for an agent pool. Gets the details of the upgrade profile for an agent pool with a specified resource group and @@ -468,13 +510,16 @@ async def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2020_07_01.models.AgentPoolUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-07-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] request = build_get_upgrade_profile_request( @@ -484,11 +529,13 @@ async def get_upgrade_profile( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -515,7 +562,7 @@ async def get_available_agent_pool_versions( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.AgentPoolAvailableVersions": + ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported versions for the specified agent pool. Gets a list of supported versions for the specified agent pool. @@ -529,13 +576,16 @@ async def get_available_agent_pool_versions( :rtype: ~azure.mgmt.containerservice.v2020_07_01.models.AgentPoolAvailableVersions :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolAvailableVersions"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-07-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] request = build_get_available_agent_pool_versions_request( @@ -544,11 +594,13 @@ async def get_available_agent_pool_versions( resource_name=resource_name, api_version=api_version, template_url=self.get_available_agent_pool_versions.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -575,14 +627,17 @@ async def _upgrade_node_image_version_initial( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> Optional["_models.AgentPool"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.AgentPool"]] + ) -> Optional[_models.AgentPool]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-07-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] request = build_upgrade_node_image_version_request_initial( @@ -592,11 +647,13 @@ async def _upgrade_node_image_version_initial( agent_pool_name=agent_pool_name, api_version=api_version, template_url=self._upgrade_node_image_version_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -626,7 +683,7 @@ async def begin_upgrade_node_image_version( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> AsyncLROPoller["_models.AgentPool"]: + ) -> AsyncLROPoller[_models.AgentPool]: """Upgrade node image version of an agent pool to the latest. Upgrade node image version of an agent pool to the latest. @@ -651,35 +708,45 @@ async def begin_upgrade_node_image_version( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_07_01.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._upgrade_node_image_version_initial( + raw_result = await self._upgrade_node_image_version_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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): - response = pipeline_response.http_response deserialized = self._deserialize('AgentPool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/aio/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/aio/operations/_managed_clusters_operations.py index 11772b232617..d8866572d965 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/aio/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/aio/operations/_managed_clusters_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. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ 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 @@ -26,32 +27,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ManagedClustersOperations: - """ManagedClustersOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2020_07_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2020_07_01.aio.ContainerServiceClient`'s + :attr:`managed_clusters` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.ManagedClusterListResult"]: + ) -> AsyncIterable[_models.ManagedClusterListResult]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. The operation returns properties @@ -64,13 +63,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_07_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -78,9 +80,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -88,9 +92,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -128,7 +134,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ManagedClusterListResult"]: + ) -> AsyncIterable[_models.ManagedClusterListResult]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. The operation returns @@ -143,13 +149,16 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_07_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -158,9 +167,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -169,9 +180,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -210,7 +223,7 @@ async def get_upgrade_profile( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedClusterUpgradeProfile": + ) -> _models.ManagedClusterUpgradeProfile: """Gets upgrade profile for a managed cluster. Gets the details of the upgrade profile for a managed cluster with a specified resource group @@ -225,13 +238,16 @@ async def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2020_07_01.models.ManagedClusterUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-07-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] request = build_get_upgrade_profile_request( @@ -240,11 +256,13 @@ async def get_upgrade_profile( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -272,7 +290,7 @@ async def get_access_profile( resource_name: str, role_name: str, **kwargs: Any - ) -> "_models.ManagedClusterAccessProfile": + ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. Gets the accessProfile for the specified role name of the managed cluster with a specified @@ -293,13 +311,16 @@ async def get_access_profile( :rtype: ~azure.mgmt.containerservice.v2020_07_01.models.ManagedClusterAccessProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterAccessProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-07-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] request = build_get_access_profile_request( @@ -309,11 +330,13 @@ async def get_access_profile( role_name=role_name, api_version=api_version, template_url=self.get_access_profile.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -340,7 +363,7 @@ async def list_cluster_admin_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster admin credential of a managed cluster. Gets cluster admin credential of the managed cluster with a specified resource group and name. @@ -354,13 +377,16 @@ async def list_cluster_admin_credentials( :rtype: ~azure.mgmt.containerservice.v2020_07_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-07-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_admin_credentials_request( @@ -369,11 +395,13 @@ async def list_cluster_admin_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_admin_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -400,7 +428,7 @@ async def list_cluster_user_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster user credential of a managed cluster. Gets cluster user credential of the managed cluster with a specified resource group and name. @@ -414,13 +442,16 @@ async def list_cluster_user_credentials( :rtype: ~azure.mgmt.containerservice.v2020_07_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-07-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_user_credentials_request( @@ -429,11 +460,13 @@ async def list_cluster_user_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -460,7 +493,7 @@ async def list_cluster_monitoring_user_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster monitoring user credential of a managed cluster. Gets cluster monitoring user credential of the managed cluster with a specified resource group @@ -475,13 +508,16 @@ async def list_cluster_monitoring_user_credentials( :rtype: ~azure.mgmt.containerservice.v2020_07_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-07-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_monitoring_user_credentials_request( @@ -490,11 +526,13 @@ async def list_cluster_monitoring_user_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -521,7 +559,7 @@ async def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedCluster": + ) -> _models.ManagedCluster: """Gets a managed cluster. Gets the details of the managed cluster with a specified resource group and name. @@ -535,13 +573,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2020_07_01.models.ManagedCluster :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-07-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] request = build_get_request( @@ -550,11 +591,13 @@ async def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -579,17 +622,20 @@ async def _create_or_update_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'ManagedCluster') @@ -601,11 +647,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -635,9 +683,9 @@ async def begin_create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> AsyncLROPoller["_models.ManagedCluster"]: + ) -> AsyncLROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. Creates or updates a managed cluster with the specified configuration for agents and Kubernetes @@ -663,37 +711,47 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_07_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -710,17 +768,20 @@ async def _update_tags_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'TagsObject') @@ -732,11 +793,13 @@ async def _update_tags_initial( content_type=content_type, json=_json, template_url=self._update_tags_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -762,9 +825,9 @@ async def begin_update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> AsyncLROPoller["_models.ManagedCluster"]: + ) -> AsyncLROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates a managed cluster with the specified tags. @@ -789,37 +852,47 @@ async def begin_update_tags( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_07_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._update_tags_initial( + raw_result = await self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -838,13 +911,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-07-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -853,11 +929,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -901,20 +979,25 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_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) @@ -924,8 +1007,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -942,17 +1031,20 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') @@ -964,11 +1056,13 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist content_type=content_type, json=_json, template_url=self._reset_service_principal_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -990,7 +1084,7 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> AsyncLROPoller[None]: """Reset Service Principal Profile of a managed cluster. @@ -1017,23 +1111,28 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._reset_service_principal_profile_initial( + raw_result = await self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1043,8 +1142,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1061,17 +1166,20 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') @@ -1083,11 +1191,13 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta content_type=content_type, json=_json, template_url=self._reset_aad_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1109,7 +1219,7 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> AsyncLROPoller[None]: """Reset AAD Profile of a managed cluster. @@ -1135,23 +1245,28 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._reset_aad_profile_initial( + raw_result = await self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1161,8 +1276,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1181,13 +1302,16 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-07-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_rotate_cluster_certificates_request_initial( @@ -1196,11 +1320,13 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- resource_name=resource_name, api_version=api_version, template_url=self._rotate_cluster_certificates_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1244,20 +1370,25 @@ async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-ret :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._rotate_cluster_certificates_initial( + raw_result = await self._rotate_cluster_certificates_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) @@ -1267,8 +1398,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/aio/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/aio/operations/_operations.py index e293d181cd49..7b2e40d5c252 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/aio/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/aio/operations/_operations.py @@ -14,6 +14,7 @@ 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 @@ -23,32 +24,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class Operations: - """Operations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2020_07_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2020_07_01.aio.ContainerServiceClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.OperationListResult"]: + ) -> AsyncIterable[_models.OperationListResult]: """Gets a list of compute operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -57,31 +56,38 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_07_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/aio/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/aio/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/aio/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/aio/operations/_private_endpoint_connections_operations.py index 6c28042dd99a..622697e7dff4 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/aio/operations/_private_endpoint_connections_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -14,6 +14,7 @@ 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 @@ -24,26 +25,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class PrivateEndpointConnectionsOperations: - """PrivateEndpointConnectionsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2020_07_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2020_07_01.aio.ContainerServiceClient`'s + :attr:`private_endpoint_connections` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -51,7 +50,7 @@ async def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnectionListResult": + ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. Gets a list of private endpoint connections in the specified managed cluster. The operation @@ -66,13 +65,16 @@ async def list( :rtype: ~azure.mgmt.containerservice.v2020_07_01.models.PrivateEndpointConnectionListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-07-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] request = build_list_request( @@ -81,11 +83,13 @@ async def list( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -113,7 +117,7 @@ async def get( resource_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Gets the private endpoint connection. Gets the details of the private endpoint connection by managed cluster and resource group. @@ -129,13 +133,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2020_07_01.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-07-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] request = build_get_request( @@ -145,11 +152,13 @@ async def get( private_endpoint_connection_name=private_endpoint_connection_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -176,9 +185,9 @@ async def update( resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - parameters: "_models.PrivateEndpointConnection", + parameters: _models.PrivateEndpointConnection, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. Updates a private endpoint connection in the specified managed cluster. @@ -196,14 +205,17 @@ async def update( :rtype: ~azure.mgmt.containerservice.v2020_07_01.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] _json = self._serialize.body(parameters, 'PrivateEndpointConnection') @@ -216,11 +228,13 @@ async def update( content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -248,13 +262,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-07-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -264,11 +281,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name=private_endpoint_connection_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -315,21 +334,26 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -339,8 +363,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/models/__init__.py index 542b46df1acc..fd24e398e7fa 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/models/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/models/__init__.py @@ -81,7 +81,9 @@ ScaleSetEvictionPolicy, ScaleSetPriority, ) - +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'AgentPool', 'AgentPoolAvailableVersions', @@ -155,3 +157,5 @@ 'ScaleSetEvictionPolicy', 'ScaleSetPriority', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/models/_container_service_client_enums.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/models/_container_service_client_enums.py index 5afa2e6523a3..28581c645ead 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/models/_container_service_client_enums.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/models/_container_service_client_enums.py @@ -7,25 +7,24 @@ # -------------------------------------------------------------------------- from enum import Enum -from six import with_metaclass from azure.core import CaseInsensitiveEnumMeta -class AgentPoolMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class AgentPoolMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """AgentPoolMode represents mode of an agent pool. """ SYSTEM = "System" USER = "User" -class AgentPoolType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class AgentPoolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """AgentPoolType represents types of an agent pool. """ VIRTUAL_MACHINE_SCALE_SETS = "VirtualMachineScaleSets" AVAILABILITY_SET = "AvailabilitySet" -class ConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The private link service connection status. """ @@ -34,7 +33,7 @@ class ConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): REJECTED = "Rejected" DISCONNECTED = "Disconnected" -class ContainerServiceStorageProfileTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the orchestrator choice. """ @@ -42,7 +41,7 @@ class ContainerServiceStorageProfileTypes(with_metaclass(CaseInsensitiveEnumMeta STORAGE_ACCOUNT = "StorageAccount" MANAGED_DISKS = "ManagedDisks" -class ContainerServiceVMSizeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Size of agent VMs. """ @@ -221,7 +220,7 @@ class ContainerServiceVMSizeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, E STANDARD_NV24 = "Standard_NV24" STANDARD_NV6 = "Standard_NV6" -class Count(with_metaclass(CaseInsensitiveEnumMeta, int, Enum)): +class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): """Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, and 5. The default value is 1. """ @@ -230,7 +229,7 @@ class Count(with_metaclass(CaseInsensitiveEnumMeta, int, Enum)): THREE = 3 FIVE = 5 -class LicenseType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class LicenseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The licenseType to use for Windows VMs. Windows_Server is used to enable Azure Hybrid User Benefits for Windows VMs. """ @@ -238,62 +237,62 @@ class LicenseType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): NONE = "None" WINDOWS_SERVER = "Windows_Server" -class LoadBalancerSku(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class LoadBalancerSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The load balancer sku for the managed cluster. """ STANDARD = "standard" BASIC = "basic" -class ManagedClusterSKUName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ManagedClusterSKUName(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Name of a managed cluster SKU. """ BASIC = "Basic" -class ManagedClusterSKUTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ManagedClusterSKUTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Tier of a managed cluster SKU. """ PAID = "Paid" FREE = "Free" -class NetworkMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Network mode used for building Kubernetes network. """ TRANSPARENT = "transparent" BRIDGE = "bridge" -class NetworkPlugin(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkPlugin(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Network plugin used for building Kubernetes network. """ AZURE = "azure" KUBENET = "kubenet" -class NetworkPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Network policy used for building Kubernetes network. """ CALICO = "calico" AZURE = "azure" -class OSType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux. """ LINUX = "Linux" WINDOWS = "Windows" -class OutboundType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OutboundType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The outbound (egress) routing method. """ LOAD_BALANCER = "loadBalancer" USER_DEFINED_ROUTING = "userDefinedRouting" -class PrivateEndpointConnectionProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class PrivateEndpointConnectionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The current provisioning state. """ @@ -302,7 +301,7 @@ class PrivateEndpointConnectionProvisioningState(with_metaclass(CaseInsensitiveE DELETING = "Deleting" FAILED = "Failed" -class ResourceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ resource group in agent nodes. Type 'None' will not use MSI for the managed cluster, service @@ -313,7 +312,7 @@ class ResourceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): USER_ASSIGNED = "UserAssigned" NONE = "None" -class ScaleSetEvictionPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ScaleSetEvictionPolicy to be used to specify eviction policy for Spot virtual machine scale set. Default to Delete. """ @@ -321,7 +320,7 @@ class ScaleSetEvictionPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)) DELETE = "Delete" DEALLOCATE = "Deallocate" -class ScaleSetPriority(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ScaleSetPriority(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ScaleSetPriority to be used to specify virtual machine scale set priority. Default to regular. """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/models/_models_py3.py index 4a7f2f56729d..d84b26c16881 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/models/_models_py3.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/models/_models_py3.py @@ -6,11 +6,13 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Dict, List, Optional, Union +from typing import Dict, List, Optional, TYPE_CHECKING, Union import msrest.serialization -from ._container_service_client_enums import * +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + import __init__ as _models class SubResource(msrest.serialization.Model): @@ -67,7 +69,7 @@ class AgentPool(SubResource): range of 0 to 100 (inclusive) for user pools and in the range of 1 to 100 (inclusive) for system pools. The default value is 1. :vartype count: int - :ivar vm_size: Size of agent VMs. Possible values include: "Standard_A1", "Standard_A10", + :ivar vm_size: Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -116,7 +118,7 @@ class AgentPool(SubResource): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2020_07_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -124,12 +126,11 @@ class AgentPool(SubResource): :vartype min_count: int :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool - :ivar type_properties_type: AgentPoolType represents types of an agent pool. Possible values - include: "VirtualMachineScaleSets", "AvailabilitySet". + :ivar type_properties_type: AgentPoolType represents types of an agent pool. Known values are: + "VirtualMachineScaleSets", "AvailabilitySet". :vartype type_properties_type: str or ~azure.mgmt.containerservice.v2020_07_01.models.AgentPoolType - :ivar mode: AgentPoolMode represents mode of an agent pool. Possible values include: "System", - "User". + :ivar mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", "User". :vartype mode: str or ~azure.mgmt.containerservice.v2020_07_01.models.AgentPoolMode :ivar orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -148,12 +149,11 @@ class AgentPool(SubResource): :ivar enable_node_public_ip: Enable public IP for nodes. :vartype enable_node_public_ip: bool :ivar scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Possible values include: "Spot", "Regular". Default value: - "Regular". + priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_07_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy - for Spot virtual machine scale set. Default to Delete. Possible values include: "Delete", + for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", "Deallocate". Default value: "Delete". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_07_01.models.ScaleSetEvictionPolicy @@ -216,22 +216,22 @@ def __init__( self, *, count: Optional[int] = None, - vm_size: Optional[Union[str, "ContainerServiceVMSizeTypes"]] = None, + vm_size: Optional[Union[str, "_models.ContainerServiceVMSizeTypes"]] = None, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - type_properties_type: Optional[Union[str, "AgentPoolType"]] = None, - mode: Optional[Union[str, "AgentPoolMode"]] = None, + type_properties_type: Optional[Union[str, "_models.AgentPoolType"]] = None, + mode: Optional[Union[str, "_models.AgentPoolMode"]] = None, orchestrator_version: Optional[str] = None, - upgrade_settings: Optional["AgentPoolUpgradeSettings"] = None, + upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, - scale_set_priority: Optional[Union[str, "ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", spot_max_price: Optional[float] = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, @@ -244,7 +244,7 @@ def __init__( range of 0 to 100 (inclusive) for user pools and in the range of 1 to 100 (inclusive) for system pools. The default value is 1. :paramtype count: int - :keyword vm_size: Size of agent VMs. Possible values include: "Standard_A1", "Standard_A10", + :keyword vm_size: Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -293,7 +293,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2020_07_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -301,12 +301,12 @@ def __init__( :paramtype min_count: int :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool - :keyword type_properties_type: AgentPoolType represents types of an agent pool. Possible values - include: "VirtualMachineScaleSets", "AvailabilitySet". + :keyword type_properties_type: AgentPoolType represents types of an agent pool. Known values + are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type_properties_type: str or ~azure.mgmt.containerservice.v2020_07_01.models.AgentPoolType - :keyword mode: AgentPoolMode represents mode of an agent pool. Possible values include: - "System", "User". + :keyword mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", + "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2020_07_01.models.AgentPoolMode :keyword orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -320,13 +320,12 @@ def __init__( :keyword enable_node_public_ip: Enable public IP for nodes. :paramtype enable_node_public_ip: bool :keyword scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Possible values include: "Spot", "Regular". Default value: - "Regular". + priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_07_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction - policy for Spot virtual machine scale set. Default to Delete. Possible values include: - "Delete", "Deallocate". Default value: "Delete". + policy for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", + "Deallocate". Default value: "Delete". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_07_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: SpotMaxPrice to be used to specify the maximum price you are willing @@ -403,7 +402,7 @@ class AgentPoolAvailableVersions(msrest.serialization.Model): def __init__( self, *, - agent_pool_versions: Optional[List["AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem"]] = None, + agent_pool_versions: Optional[List["_models.AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem"]] = None, **kwargs ): """ @@ -480,7 +479,7 @@ class AgentPoolListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["AgentPool"]] = None, + value: Optional[List["_models.AgentPool"]] = None, **kwargs ): """ @@ -508,7 +507,7 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): :ivar kubernetes_version: Required. Kubernetes version (major, minor, patch). :vartype kubernetes_version: str :ivar os_type: Required. OsType to be used to specify os type. Choose from Linux and Windows. - Default to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2020_07_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -540,8 +539,8 @@ def __init__( self, *, kubernetes_version: str, - os_type: Union[str, "OSType"] = "Linux", - upgrades: Optional[List["AgentPoolUpgradeProfilePropertiesUpgradesItem"]] = None, + os_type: Union[str, "_models.OSType"] = "Linux", + upgrades: Optional[List["_models.AgentPoolUpgradeProfilePropertiesUpgradesItem"]] = None, latest_node_image_version: Optional[str] = None, **kwargs ): @@ -549,7 +548,7 @@ def __init__( :keyword kubernetes_version: Required. Kubernetes version (major, minor, patch). :paramtype kubernetes_version: str :keyword os_type: Required. OsType to be used to specify os type. Choose from Linux and - Windows. Default to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Windows. Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2020_07_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: @@ -724,23 +723,23 @@ class BaseManagedCluster(msrest.serialization.Model): def __init__( self, *, - identity: Optional["ManagedClusterIdentity"] = None, + identity: Optional["_models.ManagedClusterIdentity"] = None, kubernetes_version: Optional[str] = None, dns_prefix: Optional[str] = None, - agent_pool_profiles: Optional[List["ManagedClusterAgentPoolProfile"]] = None, - linux_profile: Optional["ContainerServiceLinuxProfile"] = None, - windows_profile: Optional["ManagedClusterWindowsProfile"] = None, - service_principal_profile: Optional["ManagedClusterServicePrincipalProfile"] = None, - addon_profiles: Optional[Dict[str, "ManagedClusterAddonProfile"]] = None, + agent_pool_profiles: Optional[List["_models.ManagedClusterAgentPoolProfile"]] = None, + linux_profile: Optional["_models.ContainerServiceLinuxProfile"] = None, + windows_profile: Optional["_models.ManagedClusterWindowsProfile"] = None, + service_principal_profile: Optional["_models.ManagedClusterServicePrincipalProfile"] = None, + addon_profiles: Optional[Dict[str, "_models.ManagedClusterAddonProfile"]] = None, node_resource_group: Optional[str] = None, enable_rbac: Optional[bool] = None, enable_pod_security_policy: Optional[bool] = None, - network_profile: Optional["ContainerServiceNetworkProfile"] = None, - aad_profile: Optional["ManagedClusterAADProfile"] = None, - auto_scaler_profile: Optional["ManagedClusterPropertiesAutoScalerProfile"] = None, - api_server_access_profile: Optional["ManagedClusterAPIServerAccessProfile"] = None, + network_profile: Optional["_models.ContainerServiceNetworkProfile"] = None, + aad_profile: Optional["_models.ManagedClusterAADProfile"] = None, + auto_scaler_profile: Optional["_models.ManagedClusterPropertiesAutoScalerProfile"] = None, + api_server_access_profile: Optional["_models.ManagedClusterAPIServerAccessProfile"] = None, disk_encryption_set_id: Optional[str] = None, - identity_profile: Optional[Dict[str, "ManagedClusterPropertiesIdentityProfileValue"]] = None, + identity_profile: Optional[Dict[str, "_models.ManagedClusterPropertiesIdentityProfileValue"]] = None, **kwargs ): """ @@ -846,7 +845,7 @@ def __init__( code: Optional[str] = None, message: Optional[str] = None, target: Optional[str] = None, - details: Optional[List["CloudErrorBody"]] = None, + details: Optional[List["_models.CloudErrorBody"]] = None, **kwargs ): """ @@ -890,7 +889,7 @@ class ContainerServiceDiagnosticsProfile(msrest.serialization.Model): def __init__( self, *, - vm_diagnostics: "ContainerServiceVMDiagnostics", + vm_diagnostics: "_models.ContainerServiceVMDiagnostics", **kwargs ): """ @@ -927,7 +926,7 @@ def __init__( self, *, admin_username: str, - ssh: "ContainerServiceSshConfiguration", + ssh: "_models.ContainerServiceSshConfiguration", **kwargs ): """ @@ -950,17 +949,17 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar count: Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, - and 5. The default value is 1. Possible values include: 1, 3, 5. Default value: "1". + and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". :vartype count: int or ~azure.mgmt.containerservice.v2020_07_01.models.Count :ivar dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. :vartype dns_prefix: str - :ivar vm_size: Required. Size of agent VMs. Possible values include: "Standard_A1", - "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", - "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", - "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", - "Standard_A8m_v2", "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", - "Standard_B8ms", "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", - "Standard_D12", "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", + :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", + "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", + "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", + "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", "Standard_B8ms", + "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", "Standard_D12", + "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", "Standard_D13_v2_Promo", "Standard_D14", "Standard_D14_v2", "Standard_D14_v2_Promo", "Standard_D15_v2", "Standard_D16_v3", "Standard_D16s_v3", "Standard_D1_v2", "Standard_D2", "Standard_D2_v2", "Standard_D2_v2_Promo", "Standard_D2_v3", "Standard_D2s_v3", "Standard_D3", @@ -1005,7 +1004,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): :vartype first_consecutive_static_ip: str :ivar storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Possible values include: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". :vartype storage_profile: str or ~azure.mgmt.containerservice.v2020_07_01.models.ContainerServiceStorageProfileTypes :ivar fqdn: FQDN for the master pool. @@ -1034,27 +1033,27 @@ def __init__( self, *, dns_prefix: str, - vm_size: Union[str, "ContainerServiceVMSizeTypes"], - count: Optional[Union[int, "Count"]] = 1, + vm_size: Union[str, "_models.ContainerServiceVMSizeTypes"], + count: Optional[Union[int, "_models.Count"]] = 1, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, first_consecutive_static_ip: Optional[str] = "10.240.255.5", - storage_profile: Optional[Union[str, "ContainerServiceStorageProfileTypes"]] = None, + storage_profile: Optional[Union[str, "_models.ContainerServiceStorageProfileTypes"]] = None, **kwargs ): """ :keyword count: Number of masters (VMs) in the container service cluster. Allowed values are 1, - 3, and 5. The default value is 1. Possible values include: 1, 3, 5. Default value: "1". + 3, and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". :paramtype count: int or ~azure.mgmt.containerservice.v2020_07_01.models.Count :keyword dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. :paramtype dns_prefix: str - :keyword vm_size: Required. Size of agent VMs. Possible values include: "Standard_A1", - "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", - "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", - "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", - "Standard_A8m_v2", "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", - "Standard_B8ms", "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", - "Standard_D12", "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", + :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", + "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", + "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", + "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", "Standard_B8ms", + "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", "Standard_D12", + "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", "Standard_D13_v2_Promo", "Standard_D14", "Standard_D14_v2", "Standard_D14_v2_Promo", "Standard_D15_v2", "Standard_D16_v3", "Standard_D16s_v3", "Standard_D1_v2", "Standard_D2", "Standard_D2_v2", "Standard_D2_v2_Promo", "Standard_D2_v3", "Standard_D2s_v3", "Standard_D3", @@ -1099,7 +1098,7 @@ def __init__( :paramtype first_consecutive_static_ip: str :keyword storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Possible values include: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". :paramtype storage_profile: str or ~azure.mgmt.containerservice.v2020_07_01.models.ContainerServiceStorageProfileTypes """ @@ -1117,13 +1116,13 @@ def __init__( class ContainerServiceNetworkProfile(msrest.serialization.Model): """Profile of network configuration. - :ivar network_plugin: Network plugin used for building Kubernetes network. Possible values - include: "azure", "kubenet". Default value: "kubenet". + :ivar network_plugin: Network plugin used for building Kubernetes network. Known values are: + "azure", "kubenet". Default value: "kubenet". :vartype network_plugin: str or ~azure.mgmt.containerservice.v2020_07_01.models.NetworkPlugin - :ivar network_policy: Network policy used for building Kubernetes network. Possible values - include: "calico", "azure". + :ivar network_policy: Network policy used for building Kubernetes network. Known values are: + "calico", "azure". :vartype network_policy: str or ~azure.mgmt.containerservice.v2020_07_01.models.NetworkPolicy - :ivar network_mode: Network mode used for building Kubernetes network. Possible values include: + :ivar network_mode: Network mode used for building Kubernetes network. Known values are: "transparent", "bridge". :vartype network_mode: str or ~azure.mgmt.containerservice.v2020_07_01.models.NetworkMode :ivar pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. @@ -1137,11 +1136,11 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): :ivar docker_bridge_cidr: A CIDR notation IP range assigned to the Docker bridge network. It must not overlap with any Subnet IP ranges or the Kubernetes service address range. :vartype docker_bridge_cidr: str - :ivar outbound_type: The outbound (egress) routing method. Possible values include: - "loadBalancer", "userDefinedRouting". Default value: "loadBalancer". + :ivar outbound_type: The outbound (egress) routing method. Known values are: "loadBalancer", + "userDefinedRouting". Default value: "loadBalancer". :vartype outbound_type: str or ~azure.mgmt.containerservice.v2020_07_01.models.OutboundType - :ivar load_balancer_sku: The load balancer sku for the managed cluster. Possible values - include: "standard", "basic". + :ivar load_balancer_sku: The load balancer sku for the managed cluster. Known values are: + "standard", "basic". :vartype load_balancer_sku: str or ~azure.mgmt.containerservice.v2020_07_01.models.LoadBalancerSku :ivar load_balancer_profile: Profile of the cluster load balancer. @@ -1172,27 +1171,27 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): def __init__( self, *, - network_plugin: Optional[Union[str, "NetworkPlugin"]] = "kubenet", - network_policy: Optional[Union[str, "NetworkPolicy"]] = None, - network_mode: Optional[Union[str, "NetworkMode"]] = None, + network_plugin: Optional[Union[str, "_models.NetworkPlugin"]] = "kubenet", + network_policy: Optional[Union[str, "_models.NetworkPolicy"]] = None, + network_mode: Optional[Union[str, "_models.NetworkMode"]] = None, pod_cidr: Optional[str] = "10.244.0.0/16", service_cidr: Optional[str] = "10.0.0.0/16", dns_service_ip: Optional[str] = "10.0.0.10", docker_bridge_cidr: Optional[str] = "172.17.0.1/16", - outbound_type: Optional[Union[str, "OutboundType"]] = "loadBalancer", - load_balancer_sku: Optional[Union[str, "LoadBalancerSku"]] = None, - load_balancer_profile: Optional["ManagedClusterLoadBalancerProfile"] = None, + outbound_type: Optional[Union[str, "_models.OutboundType"]] = "loadBalancer", + load_balancer_sku: Optional[Union[str, "_models.LoadBalancerSku"]] = None, + load_balancer_profile: Optional["_models.ManagedClusterLoadBalancerProfile"] = None, **kwargs ): """ - :keyword network_plugin: Network plugin used for building Kubernetes network. Possible values - include: "azure", "kubenet". Default value: "kubenet". + :keyword network_plugin: Network plugin used for building Kubernetes network. Known values are: + "azure", "kubenet". Default value: "kubenet". :paramtype network_plugin: str or ~azure.mgmt.containerservice.v2020_07_01.models.NetworkPlugin - :keyword network_policy: Network policy used for building Kubernetes network. Possible values - include: "calico", "azure". + :keyword network_policy: Network policy used for building Kubernetes network. Known values are: + "calico", "azure". :paramtype network_policy: str or ~azure.mgmt.containerservice.v2020_07_01.models.NetworkPolicy - :keyword network_mode: Network mode used for building Kubernetes network. Possible values - include: "transparent", "bridge". + :keyword network_mode: Network mode used for building Kubernetes network. Known values are: + "transparent", "bridge". :paramtype network_mode: str or ~azure.mgmt.containerservice.v2020_07_01.models.NetworkMode :keyword pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :paramtype pod_cidr: str @@ -1205,11 +1204,11 @@ def __init__( :keyword docker_bridge_cidr: A CIDR notation IP range assigned to the Docker bridge network. It must not overlap with any Subnet IP ranges or the Kubernetes service address range. :paramtype docker_bridge_cidr: str - :keyword outbound_type: The outbound (egress) routing method. Possible values include: - "loadBalancer", "userDefinedRouting". Default value: "loadBalancer". + :keyword outbound_type: The outbound (egress) routing method. Known values are: "loadBalancer", + "userDefinedRouting". Default value: "loadBalancer". :paramtype outbound_type: str or ~azure.mgmt.containerservice.v2020_07_01.models.OutboundType - :keyword load_balancer_sku: The load balancer sku for the managed cluster. Possible values - include: "standard", "basic". + :keyword load_balancer_sku: The load balancer sku for the managed cluster. Known values are: + "standard", "basic". :paramtype load_balancer_sku: str or ~azure.mgmt.containerservice.v2020_07_01.models.LoadBalancerSku :keyword load_balancer_profile: Profile of the cluster load balancer. @@ -1251,7 +1250,7 @@ class ContainerServiceSshConfiguration(msrest.serialization.Model): def __init__( self, *, - public_keys: List["ContainerServiceSshPublicKey"], + public_keys: List["_models.ContainerServiceSshPublicKey"], **kwargs ): """ @@ -1571,25 +1570,25 @@ def __init__( self, *, location: str, - identity: Optional["ManagedClusterIdentity"] = None, + identity: Optional["_models.ManagedClusterIdentity"] = None, kubernetes_version: Optional[str] = None, dns_prefix: Optional[str] = None, - agent_pool_profiles: Optional[List["ManagedClusterAgentPoolProfile"]] = None, - linux_profile: Optional["ContainerServiceLinuxProfile"] = None, - windows_profile: Optional["ManagedClusterWindowsProfile"] = None, - service_principal_profile: Optional["ManagedClusterServicePrincipalProfile"] = None, - addon_profiles: Optional[Dict[str, "ManagedClusterAddonProfile"]] = None, + agent_pool_profiles: Optional[List["_models.ManagedClusterAgentPoolProfile"]] = None, + linux_profile: Optional["_models.ContainerServiceLinuxProfile"] = None, + windows_profile: Optional["_models.ManagedClusterWindowsProfile"] = None, + service_principal_profile: Optional["_models.ManagedClusterServicePrincipalProfile"] = None, + addon_profiles: Optional[Dict[str, "_models.ManagedClusterAddonProfile"]] = None, node_resource_group: Optional[str] = None, enable_rbac: Optional[bool] = None, enable_pod_security_policy: Optional[bool] = None, - network_profile: Optional["ContainerServiceNetworkProfile"] = None, - aad_profile: Optional["ManagedClusterAADProfile"] = None, - auto_scaler_profile: Optional["ManagedClusterPropertiesAutoScalerProfile"] = None, - api_server_access_profile: Optional["ManagedClusterAPIServerAccessProfile"] = None, + network_profile: Optional["_models.ContainerServiceNetworkProfile"] = None, + aad_profile: Optional["_models.ManagedClusterAADProfile"] = None, + auto_scaler_profile: Optional["_models.ManagedClusterPropertiesAutoScalerProfile"] = None, + api_server_access_profile: Optional["_models.ManagedClusterAPIServerAccessProfile"] = None, disk_encryption_set_id: Optional[str] = None, - identity_profile: Optional[Dict[str, "ManagedClusterPropertiesIdentityProfileValue"]] = None, + identity_profile: Optional[Dict[str, "_models.ManagedClusterPropertiesIdentityProfileValue"]] = None, tags: Optional[Dict[str, str]] = None, - sku: Optional["ManagedClusterSKU"] = None, + sku: Optional["_models.ManagedClusterSKU"] = None, **kwargs ): """ @@ -1935,7 +1934,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): range of 0 to 100 (inclusive) for user pools and in the range of 1 to 100 (inclusive) for system pools. The default value is 1. :vartype count: int - :ivar vm_size: Size of agent VMs. Possible values include: "Standard_A1", "Standard_A10", + :ivar vm_size: Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -1984,7 +1983,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2020_07_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -1992,11 +1991,10 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :vartype min_count: int :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool - :ivar type: AgentPoolType represents types of an agent pool. Possible values include: + :ivar type: AgentPoolType represents types of an agent pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2020_07_01.models.AgentPoolType - :ivar mode: AgentPoolMode represents mode of an agent pool. Possible values include: "System", - "User". + :ivar mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", "User". :vartype mode: str or ~azure.mgmt.containerservice.v2020_07_01.models.AgentPoolMode :ivar orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -2015,12 +2013,11 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar enable_node_public_ip: Enable public IP for nodes. :vartype enable_node_public_ip: bool :ivar scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Possible values include: "Spot", "Regular". Default value: - "Regular". + priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_07_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy - for Spot virtual machine scale set. Default to Delete. Possible values include: "Delete", + for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", "Deallocate". Default value: "Delete". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_07_01.models.ScaleSetEvictionPolicy @@ -2077,22 +2074,22 @@ def __init__( self, *, count: Optional[int] = None, - vm_size: Optional[Union[str, "ContainerServiceVMSizeTypes"]] = None, + vm_size: Optional[Union[str, "_models.ContainerServiceVMSizeTypes"]] = None, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - type: Optional[Union[str, "AgentPoolType"]] = None, - mode: Optional[Union[str, "AgentPoolMode"]] = None, + type: Optional[Union[str, "_models.AgentPoolType"]] = None, + mode: Optional[Union[str, "_models.AgentPoolMode"]] = None, orchestrator_version: Optional[str] = None, - upgrade_settings: Optional["AgentPoolUpgradeSettings"] = None, + upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, - scale_set_priority: Optional[Union[str, "ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", spot_max_price: Optional[float] = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, @@ -2105,7 +2102,7 @@ def __init__( range of 0 to 100 (inclusive) for user pools and in the range of 1 to 100 (inclusive) for system pools. The default value is 1. :paramtype count: int - :keyword vm_size: Size of agent VMs. Possible values include: "Standard_A1", "Standard_A10", + :keyword vm_size: Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -2154,7 +2151,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2020_07_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -2162,11 +2159,11 @@ def __init__( :paramtype min_count: int :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool - :keyword type: AgentPoolType represents types of an agent pool. Possible values include: + :keyword type: AgentPoolType represents types of an agent pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2020_07_01.models.AgentPoolType - :keyword mode: AgentPoolMode represents mode of an agent pool. Possible values include: - "System", "User". + :keyword mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", + "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2020_07_01.models.AgentPoolMode :keyword orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -2180,13 +2177,12 @@ def __init__( :keyword enable_node_public_ip: Enable public IP for nodes. :paramtype enable_node_public_ip: bool :keyword scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Possible values include: "Spot", "Regular". Default value: - "Regular". + priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_07_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction - policy for Spot virtual machine scale set. Default to Delete. Possible values include: - "Delete", "Deallocate". Default value: "Delete". + policy for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", + "Deallocate". Default value: "Delete". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_07_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: SpotMaxPrice to be used to specify the maximum price you are willing @@ -2242,7 +2238,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): range of 0 to 100 (inclusive) for user pools and in the range of 1 to 100 (inclusive) for system pools. The default value is 1. :vartype count: int - :ivar vm_size: Size of agent VMs. Possible values include: "Standard_A1", "Standard_A10", + :ivar vm_size: Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -2291,7 +2287,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2020_07_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -2299,11 +2295,10 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :vartype min_count: int :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool - :ivar type: AgentPoolType represents types of an agent pool. Possible values include: + :ivar type: AgentPoolType represents types of an agent pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2020_07_01.models.AgentPoolType - :ivar mode: AgentPoolMode represents mode of an agent pool. Possible values include: "System", - "User". + :ivar mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", "User". :vartype mode: str or ~azure.mgmt.containerservice.v2020_07_01.models.AgentPoolMode :ivar orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -2322,12 +2317,11 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar enable_node_public_ip: Enable public IP for nodes. :vartype enable_node_public_ip: bool :ivar scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Possible values include: "Spot", "Regular". Default value: - "Regular". + priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_07_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy - for Spot virtual machine scale set. Default to Delete. Possible values include: "Delete", + for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", "Deallocate". Default value: "Delete". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_07_01.models.ScaleSetEvictionPolicy @@ -2390,22 +2384,22 @@ def __init__( *, name: str, count: Optional[int] = None, - vm_size: Optional[Union[str, "ContainerServiceVMSizeTypes"]] = None, + vm_size: Optional[Union[str, "_models.ContainerServiceVMSizeTypes"]] = None, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - type: Optional[Union[str, "AgentPoolType"]] = None, - mode: Optional[Union[str, "AgentPoolMode"]] = None, + type: Optional[Union[str, "_models.AgentPoolType"]] = None, + mode: Optional[Union[str, "_models.AgentPoolMode"]] = None, orchestrator_version: Optional[str] = None, - upgrade_settings: Optional["AgentPoolUpgradeSettings"] = None, + upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, - scale_set_priority: Optional[Union[str, "ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", spot_max_price: Optional[float] = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, @@ -2418,7 +2412,7 @@ def __init__( range of 0 to 100 (inclusive) for user pools and in the range of 1 to 100 (inclusive) for system pools. The default value is 1. :paramtype count: int - :keyword vm_size: Size of agent VMs. Possible values include: "Standard_A1", "Standard_A10", + :keyword vm_size: Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -2467,7 +2461,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2020_07_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -2475,11 +2469,11 @@ def __init__( :paramtype min_count: int :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool - :keyword type: AgentPoolType represents types of an agent pool. Possible values include: + :keyword type: AgentPoolType represents types of an agent pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2020_07_01.models.AgentPoolType - :keyword mode: AgentPoolMode represents mode of an agent pool. Possible values include: - "System", "User". + :keyword mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", + "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2020_07_01.models.AgentPoolMode :keyword orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -2493,13 +2487,12 @@ def __init__( :keyword enable_node_public_ip: Enable public IP for nodes. :paramtype enable_node_public_ip: bool :keyword scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Possible values include: "Spot", "Regular". Default value: - "Regular". + priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_07_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction - policy for Spot virtual machine scale set. Default to Delete. Possible values include: - "Delete", "Deallocate". Default value: "Delete". + policy for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", + "Deallocate". Default value: "Delete". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_07_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: SpotMaxPrice to be used to specify the maximum price you are willing @@ -2570,8 +2563,8 @@ class ManagedClusterIdentity(msrest.serialization.Model): :ivar type: The type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ resource group in agent nodes. Type 'None' will not use MSI for the managed cluster, - service principal will be used instead. Possible values include: "SystemAssigned", - "UserAssigned", "None". + service principal will be used instead. Known values are: "SystemAssigned", "UserAssigned", + "None". :vartype type: str or ~azure.mgmt.containerservice.v2020_07_01.models.ResourceIdentityType :ivar user_assigned_identities: The user identity associated with the managed cluster. This identity will be used in control plane and only one user assigned identity is allowed. The user @@ -2596,15 +2589,15 @@ class ManagedClusterIdentity(msrest.serialization.Model): def __init__( self, *, - type: Optional[Union[str, "ResourceIdentityType"]] = None, - user_assigned_identities: Optional[Dict[str, "ManagedClusterIdentityUserAssignedIdentitiesValue"]] = None, + type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, + user_assigned_identities: Optional[Dict[str, "_models.ManagedClusterIdentityUserAssignedIdentitiesValue"]] = None, **kwargs ): """ :keyword type: The type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ resource group in agent nodes. Type 'None' will not use MSI for the managed - cluster, service principal will be used instead. Possible values include: "SystemAssigned", + cluster, service principal will be used instead. Known values are: "SystemAssigned", "UserAssigned", "None". :paramtype type: str or ~azure.mgmt.containerservice.v2020_07_01.models.ResourceIdentityType :keyword user_assigned_identities: The user identity associated with the managed cluster. This @@ -2676,7 +2669,7 @@ class ManagedClusterListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["ManagedCluster"]] = None, + value: Optional[List["_models.ManagedCluster"]] = None, **kwargs ): """ @@ -2730,10 +2723,10 @@ class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): def __init__( self, *, - managed_outbound_i_ps: Optional["ManagedClusterLoadBalancerProfileManagedOutboundIPs"] = None, - outbound_ip_prefixes: Optional["ManagedClusterLoadBalancerProfileOutboundIPPrefixes"] = None, - outbound_i_ps: Optional["ManagedClusterLoadBalancerProfileOutboundIPs"] = None, - effective_outbound_i_ps: Optional[List["ResourceReference"]] = None, + managed_outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileManagedOutboundIPs"] = None, + outbound_ip_prefixes: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPPrefixes"] = None, + outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPs"] = None, + effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, allocated_outbound_ports: Optional[int] = 0, idle_timeout_in_minutes: Optional[int] = 30, **kwargs @@ -2816,7 +2809,7 @@ class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.M def __init__( self, *, - public_ip_prefixes: Optional[List["ResourceReference"]] = None, + public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, **kwargs ): """ @@ -2842,7 +2835,7 @@ class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): def __init__( self, *, - public_i_ps: Optional[List["ResourceReference"]] = None, + public_i_ps: Optional[List["_models.ResourceReference"]] = None, **kwargs ): """ @@ -2863,7 +2856,7 @@ class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): :ivar name: Pool name. :vartype name: str :ivar os_type: Required. OsType to be used to specify os type. Choose from Linux and Windows. - Default to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2020_07_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -2886,9 +2879,9 @@ def __init__( self, *, kubernetes_version: str, - os_type: Union[str, "OSType"] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", name: Optional[str] = None, - upgrades: Optional[List["ManagedClusterPoolUpgradeProfileUpgradesItem"]] = None, + upgrades: Optional[List["_models.ManagedClusterPoolUpgradeProfileUpgradesItem"]] = None, **kwargs ): """ @@ -2897,7 +2890,7 @@ def __init__( :keyword name: Pool name. :paramtype name: str :keyword os_type: Required. OsType to be used to specify os type. Choose from Linux and - Windows. Default to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Windows. Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2020_07_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: @@ -3100,9 +3093,9 @@ def __init__( class ManagedClusterSKU(msrest.serialization.Model): """ManagedClusterSKU. - :ivar name: Name of a managed cluster SKU. Possible values include: "Basic". + :ivar name: Name of a managed cluster SKU. Known values are: "Basic". :vartype name: str or ~azure.mgmt.containerservice.v2020_07_01.models.ManagedClusterSKUName - :ivar tier: Tier of a managed cluster SKU. Possible values include: "Paid", "Free". + :ivar tier: Tier of a managed cluster SKU. Known values are: "Paid", "Free". :vartype tier: str or ~azure.mgmt.containerservice.v2020_07_01.models.ManagedClusterSKUTier """ @@ -3114,14 +3107,14 @@ class ManagedClusterSKU(msrest.serialization.Model): def __init__( self, *, - name: Optional[Union[str, "ManagedClusterSKUName"]] = None, - tier: Optional[Union[str, "ManagedClusterSKUTier"]] = None, + name: Optional[Union[str, "_models.ManagedClusterSKUName"]] = None, + tier: Optional[Union[str, "_models.ManagedClusterSKUTier"]] = None, **kwargs ): """ - :keyword name: Name of a managed cluster SKU. Possible values include: "Basic". + :keyword name: Name of a managed cluster SKU. Known values are: "Basic". :paramtype name: str or ~azure.mgmt.containerservice.v2020_07_01.models.ManagedClusterSKUName - :keyword tier: Tier of a managed cluster SKU. Possible values include: "Paid", "Free". + :keyword tier: Tier of a managed cluster SKU. Known values are: "Paid", "Free". :paramtype tier: str or ~azure.mgmt.containerservice.v2020_07_01.models.ManagedClusterSKUTier """ super(ManagedClusterSKU, self).__init__(**kwargs) @@ -3170,8 +3163,8 @@ class ManagedClusterUpgradeProfile(msrest.serialization.Model): def __init__( self, *, - control_plane_profile: "ManagedClusterPoolUpgradeProfile", - agent_pool_profiles: List["ManagedClusterPoolUpgradeProfile"], + control_plane_profile: "_models.ManagedClusterPoolUpgradeProfile", + agent_pool_profiles: List["_models.ManagedClusterPoolUpgradeProfile"], **kwargs ): """ @@ -3213,7 +3206,7 @@ class ManagedClusterWindowsProfile(msrest.serialization.Model): "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!". :vartype admin_password: str :ivar license_type: 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". + Azure Hybrid User Benefits for Windows VMs. Known values are: "None", "Windows_Server". :vartype license_type: str or ~azure.mgmt.containerservice.v2020_07_01.models.LicenseType """ @@ -3232,7 +3225,7 @@ def __init__( *, admin_username: str, admin_password: Optional[str] = None, - license_type: Optional[Union[str, "LicenseType"]] = None, + license_type: Optional[Union[str, "_models.LicenseType"]] = None, **kwargs ): """ @@ -3253,7 +3246,7 @@ def __init__( "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!". :paramtype admin_password: str :keyword license_type: 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". + Azure Hybrid User Benefits for Windows VMs. Known values are: "None", "Windows_Server". :paramtype license_type: str or ~azure.mgmt.containerservice.v2020_07_01.models.LicenseType """ super(ManagedClusterWindowsProfile, self).__init__(**kwargs) @@ -3377,7 +3370,7 @@ class PrivateEndpointConnection(msrest.serialization.Model): :vartype name: str :ivar type: The resource type. :vartype type: str - :ivar provisioning_state: The current provisioning state. Possible values include: "Succeeded", + :ivar provisioning_state: The current provisioning state. Known values are: "Succeeded", "Creating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2020_07_01.models.PrivateEndpointConnectionProvisioningState @@ -3408,8 +3401,8 @@ class PrivateEndpointConnection(msrest.serialization.Model): def __init__( self, *, - private_endpoint: Optional["PrivateEndpoint"] = None, - private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, + private_endpoint: Optional["_models.PrivateEndpoint"] = None, + private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionState"] = None, **kwargs ): """ @@ -3443,7 +3436,7 @@ class PrivateEndpointConnectionListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["PrivateEndpointConnection"]] = None, + value: Optional[List["_models.PrivateEndpointConnection"]] = None, **kwargs ): """ @@ -3458,7 +3451,7 @@ def __init__( class PrivateLinkServiceConnectionState(msrest.serialization.Model): """The state of a private link service connection. - :ivar status: The private link service connection status. Possible values include: "Pending", + :ivar status: The private link service connection status. Known values are: "Pending", "Approved", "Rejected", "Disconnected". :vartype status: str or ~azure.mgmt.containerservice.v2020_07_01.models.ConnectionStatus :ivar description: The private link service connection description. @@ -3473,13 +3466,13 @@ class PrivateLinkServiceConnectionState(msrest.serialization.Model): def __init__( self, *, - status: Optional[Union[str, "ConnectionStatus"]] = None, + status: Optional[Union[str, "_models.ConnectionStatus"]] = None, description: Optional[str] = None, **kwargs ): """ - :keyword status: The private link service connection status. Possible values include: - "Pending", "Approved", "Rejected", "Disconnected". + :keyword status: The private link service connection status. Known values are: "Pending", + "Approved", "Rejected", "Disconnected". :paramtype status: str or ~azure.mgmt.containerservice.v2020_07_01.models.ConnectionStatus :keyword description: The private link service connection description. :paramtype description: str diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/models/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/models/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/operations/__init__.py index fdbf34a0f841..9ef6890a9e03 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/operations/__init__.py @@ -11,9 +11,14 @@ from ._agent_pools_operations import AgentPoolsOperations from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'Operations', 'ManagedClustersOperations', 'AgentPoolsOperations', 'PrivateEndpointConnectionsOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/operations/_agent_pools_operations.py index 3d817f16f1e8..08745b928202 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/operations/_agent_pools_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -35,9 +35,12 @@ def build_list_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-07-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools") # pylint: disable=line-too-long path_format_arguments = { @@ -49,18 +52,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -72,9 +73,12 @@ def build_get_request( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-07-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -87,18 +91,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -109,14 +111,17 @@ def build_create_or_update_request_initial( resource_name: str, agent_pool_name: str, *, - json: JSONType = None, + json: Optional[_models.AgentPool] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -129,20 +134,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -156,9 +159,12 @@ def build_delete_request_initial( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-07-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -171,18 +177,16 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -194,9 +198,12 @@ def build_get_upgrade_profile_request( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-07-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default") # pylint: disable=line-too-long path_format_arguments = { @@ -209,18 +216,16 @@ def build_get_upgrade_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -231,9 +236,12 @@ def build_get_available_agent_pool_versions_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-07-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions") # pylint: disable=line-too-long path_format_arguments = { @@ -245,18 +253,16 @@ def build_get_available_agent_pool_versions_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -268,9 +274,12 @@ def build_upgrade_node_image_version_request_initial( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-07-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion") # pylint: disable=line-too-long path_format_arguments = { @@ -283,42 +292,38 @@ def build_upgrade_node_image_version_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class AgentPoolsOperations(object): - """AgentPoolsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class AgentPoolsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2020_07_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2020_07_01.ContainerServiceClient`'s + :attr:`agent_pools` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -326,7 +331,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Iterable["_models.AgentPoolListResult"]: + ) -> Iterable[_models.AgentPoolListResult]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. The operation returns properties @@ -342,13 +347,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_07_01.models.AgentPoolListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -358,9 +366,11 @@ def prepare_request(next_link=None): resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -370,9 +380,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -412,7 +424,7 @@ def get( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPool": + ) -> _models.AgentPool: """Gets the agent pool. Gets the details of the agent pool by managed cluster and resource group. @@ -428,13 +440,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2020_07_01.models.AgentPool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-07-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] request = build_get_request( @@ -444,11 +459,13 @@ def get( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -474,17 +491,20 @@ def _create_or_update_initial( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> "_models.AgentPool": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] + ) -> _models.AgentPool: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] _json = self._serialize.body(parameters, 'AgentPool') @@ -497,11 +517,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -532,9 +554,9 @@ def begin_create_or_update( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> LROPoller["_models.AgentPool"]: + ) -> LROPoller[_models.AgentPool]: """Creates or updates an agent pool. Creates or updates an agent pool in the specified managed cluster. @@ -560,17 +582,20 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_07_01.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, @@ -578,20 +603,27 @@ def begin_create_or_update( 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): - response = pipeline_response.http_response deserialized = self._deserialize('AgentPool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -611,13 +643,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements agent_pool_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-07-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -627,11 +662,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -678,21 +715,26 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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) @@ -702,8 +744,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -723,7 +771,7 @@ def get_upgrade_profile( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPoolUpgradeProfile": + ) -> _models.AgentPoolUpgradeProfile: """Gets upgrade profile for an agent pool. Gets the details of the upgrade profile for an agent pool with a specified resource group and @@ -740,13 +788,16 @@ def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2020_07_01.models.AgentPoolUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-07-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] request = build_get_upgrade_profile_request( @@ -756,11 +807,13 @@ def get_upgrade_profile( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -787,7 +840,7 @@ def get_available_agent_pool_versions( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.AgentPoolAvailableVersions": + ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported versions for the specified agent pool. Gets a list of supported versions for the specified agent pool. @@ -801,13 +854,16 @@ def get_available_agent_pool_versions( :rtype: ~azure.mgmt.containerservice.v2020_07_01.models.AgentPoolAvailableVersions :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolAvailableVersions"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-07-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] request = build_get_available_agent_pool_versions_request( @@ -816,11 +872,13 @@ def get_available_agent_pool_versions( resource_name=resource_name, api_version=api_version, template_url=self.get_available_agent_pool_versions.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -847,14 +905,17 @@ def _upgrade_node_image_version_initial( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> Optional["_models.AgentPool"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.AgentPool"]] + ) -> Optional[_models.AgentPool]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-07-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] request = build_upgrade_node_image_version_request_initial( @@ -864,11 +925,13 @@ def _upgrade_node_image_version_initial( agent_pool_name=agent_pool_name, api_version=api_version, template_url=self._upgrade_node_image_version_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -898,7 +961,7 @@ def begin_upgrade_node_image_version( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> LROPoller["_models.AgentPool"]: + ) -> LROPoller[_models.AgentPool]: """Upgrade node image version of an agent pool to the latest. Upgrade node image version of an agent pool to the latest. @@ -922,35 +985,45 @@ def begin_upgrade_node_image_version( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_07_01.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._upgrade_node_image_version_initial( + raw_result = self._upgrade_node_image_version_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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): - response = pipeline_response.http_response deserialized = self._deserialize('AgentPool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/operations/_managed_clusters_operations.py index 9ff0ae5cae8a..e2bfc3120eca 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/operations/_managed_clusters_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -33,9 +33,12 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-07-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters") path_format_arguments = { @@ -45,18 +48,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -66,9 +67,12 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-07-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters") # pylint: disable=line-too-long path_format_arguments = { @@ -79,18 +83,16 @@ def build_list_by_resource_group_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -101,9 +103,12 @@ def build_get_upgrade_profile_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-07-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default") # pylint: disable=line-too-long path_format_arguments = { @@ -115,18 +120,16 @@ def build_get_upgrade_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -138,9 +141,12 @@ def build_get_access_profile_request( role_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-07-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -153,18 +159,16 @@ def build_get_access_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -175,9 +179,12 @@ def build_list_cluster_admin_credentials_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-07-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -189,18 +196,16 @@ def build_list_cluster_admin_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -211,9 +216,12 @@ def build_list_cluster_user_credentials_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-07-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -225,18 +233,16 @@ def build_list_cluster_user_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -247,9 +253,12 @@ def build_list_cluster_monitoring_user_credentials_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-07-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -261,18 +270,16 @@ def build_list_cluster_monitoring_user_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -283,9 +290,12 @@ def build_get_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-07-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -297,18 +307,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -318,14 +326,17 @@ def build_create_or_update_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedCluster] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -337,20 +348,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -362,14 +371,17 @@ def build_update_tags_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.TagsObject] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -381,20 +393,18 @@ def build_update_tags_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -407,9 +417,12 @@ def build_delete_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-07-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -421,18 +434,16 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -442,14 +453,17 @@ def build_reset_service_principal_profile_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedClusterServicePrincipalProfile] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile") # pylint: disable=line-too-long path_format_arguments = { @@ -461,20 +475,18 @@ def build_reset_service_principal_profile_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -486,14 +498,17 @@ def build_reset_aad_profile_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedClusterAADProfile] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile") # pylint: disable=line-too-long path_format_arguments = { @@ -505,20 +520,18 @@ def build_reset_aad_profile_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -531,9 +544,12 @@ def build_rotate_cluster_certificates_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-07-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates") # pylint: disable=line-too-long path_format_arguments = { @@ -545,48 +561,44 @@ def build_rotate_cluster_certificates_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class ManagedClustersOperations(object): - """ManagedClustersOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ManagedClustersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2020_07_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2020_07_01.ContainerServiceClient`'s + :attr:`managed_clusters` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> Iterable["_models.ManagedClusterListResult"]: + ) -> Iterable[_models.ManagedClusterListResult]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. The operation returns properties @@ -599,13 +611,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_07_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -613,9 +628,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -623,9 +640,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -663,7 +682,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.ManagedClusterListResult"]: + ) -> Iterable[_models.ManagedClusterListResult]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. The operation returns @@ -678,13 +697,16 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_07_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -693,9 +715,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -704,9 +728,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -745,7 +771,7 @@ def get_upgrade_profile( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedClusterUpgradeProfile": + ) -> _models.ManagedClusterUpgradeProfile: """Gets upgrade profile for a managed cluster. Gets the details of the upgrade profile for a managed cluster with a specified resource group @@ -760,13 +786,16 @@ def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2020_07_01.models.ManagedClusterUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-07-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] request = build_get_upgrade_profile_request( @@ -775,11 +804,13 @@ def get_upgrade_profile( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -807,7 +838,7 @@ def get_access_profile( resource_name: str, role_name: str, **kwargs: Any - ) -> "_models.ManagedClusterAccessProfile": + ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. Gets the accessProfile for the specified role name of the managed cluster with a specified @@ -828,13 +859,16 @@ def get_access_profile( :rtype: ~azure.mgmt.containerservice.v2020_07_01.models.ManagedClusterAccessProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterAccessProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-07-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] request = build_get_access_profile_request( @@ -844,11 +878,13 @@ def get_access_profile( role_name=role_name, api_version=api_version, template_url=self.get_access_profile.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -875,7 +911,7 @@ def list_cluster_admin_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster admin credential of a managed cluster. Gets cluster admin credential of the managed cluster with a specified resource group and name. @@ -889,13 +925,16 @@ def list_cluster_admin_credentials( :rtype: ~azure.mgmt.containerservice.v2020_07_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-07-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_admin_credentials_request( @@ -904,11 +943,13 @@ def list_cluster_admin_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_admin_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -935,7 +976,7 @@ def list_cluster_user_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster user credential of a managed cluster. Gets cluster user credential of the managed cluster with a specified resource group and name. @@ -949,13 +990,16 @@ def list_cluster_user_credentials( :rtype: ~azure.mgmt.containerservice.v2020_07_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-07-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_user_credentials_request( @@ -964,11 +1008,13 @@ def list_cluster_user_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -995,7 +1041,7 @@ def list_cluster_monitoring_user_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster monitoring user credential of a managed cluster. Gets cluster monitoring user credential of the managed cluster with a specified resource group @@ -1010,13 +1056,16 @@ def list_cluster_monitoring_user_credentials( :rtype: ~azure.mgmt.containerservice.v2020_07_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-07-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_monitoring_user_credentials_request( @@ -1025,11 +1074,13 @@ def list_cluster_monitoring_user_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1056,7 +1107,7 @@ def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedCluster": + ) -> _models.ManagedCluster: """Gets a managed cluster. Gets the details of the managed cluster with a specified resource group and name. @@ -1070,13 +1121,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2020_07_01.models.ManagedCluster :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-07-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] request = build_get_request( @@ -1085,11 +1139,13 @@ def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1114,17 +1170,20 @@ def _create_or_update_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'ManagedCluster') @@ -1136,11 +1195,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1170,9 +1231,9 @@ def begin_create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> LROPoller["_models.ManagedCluster"]: + ) -> LROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. Creates or updates a managed cluster with the specified configuration for agents and Kubernetes @@ -1198,37 +1259,47 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_07_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1245,17 +1316,20 @@ def _update_tags_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'TagsObject') @@ -1267,11 +1341,13 @@ def _update_tags_initial( content_type=content_type, json=_json, template_url=self._update_tags_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1297,9 +1373,9 @@ def begin_update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> LROPoller["_models.ManagedCluster"]: + ) -> LROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates a managed cluster with the specified tags. @@ -1324,37 +1400,47 @@ def begin_update_tags( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_07_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._update_tags_initial( + raw_result = self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1373,13 +1459,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-07-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -1388,11 +1477,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1436,20 +1527,25 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_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) @@ -1459,8 +1555,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1477,17 +1579,20 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') @@ -1499,11 +1604,13 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re content_type=content_type, json=_json, template_url=self._reset_service_principal_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1525,7 +1632,7 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> LROPoller[None]: """Reset Service Principal Profile of a managed cluster. @@ -1552,23 +1659,28 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._reset_service_principal_profile_initial( + raw_result = self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1578,8 +1690,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1596,17 +1714,20 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') @@ -1618,11 +1739,13 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement content_type=content_type, json=_json, template_url=self._reset_aad_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1644,7 +1767,7 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> LROPoller[None]: """Reset AAD Profile of a managed cluster. @@ -1670,23 +1793,28 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._reset_aad_profile_initial( + raw_result = self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1696,8 +1824,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1716,13 +1850,16 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-07-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_rotate_cluster_certificates_request_initial( @@ -1731,11 +1868,13 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return resource_name=resource_name, api_version=api_version, template_url=self._rotate_cluster_certificates_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1779,20 +1918,25 @@ def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-st :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._rotate_cluster_certificates_initial( + raw_result = self._rotate_cluster_certificates_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) @@ -1802,8 +1946,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/operations/_operations.py index 7a972fad7e4e..4cff3e6c5d1c 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/operations/_operations.py @@ -16,6 +16,7 @@ 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 @@ -29,55 +30,54 @@ def build_list_request( **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-07-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.ContainerService/operations") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class Operations(object): - """Operations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2020_07_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2020_07_01.ContainerServiceClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> Iterable["_models.OperationListResult"]: + ) -> Iterable[_models.OperationListResult]: """Gets a list of compute operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -86,31 +86,38 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_07_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/operations/_private_endpoint_connections_operations.py index 10eabf744f8e..3cae8a7f0882 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_07_01/operations/_private_endpoint_connections_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast from msrest import Serializer @@ -16,13 +16,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -34,9 +34,12 @@ def build_list_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-07-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections") # pylint: disable=line-too-long path_format_arguments = { @@ -48,18 +51,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -71,9 +72,12 @@ def build_get_request( private_endpoint_connection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-07-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -86,18 +90,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -108,14 +110,17 @@ def build_update_request( resource_name: str, private_endpoint_connection_name: str, *, - json: JSONType = None, + json: Optional[_models.PrivateEndpointConnection] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -128,20 +133,18 @@ def build_update_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -155,9 +158,12 @@ def build_delete_request_initial( private_endpoint_connection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-07-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -170,42 +176,38 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class PrivateEndpointConnectionsOperations(object): - """PrivateEndpointConnectionsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class PrivateEndpointConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2020_07_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2020_07_01.ContainerServiceClient`'s + :attr:`private_endpoint_connections` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -213,7 +215,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnectionListResult": + ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. Gets a list of private endpoint connections in the specified managed cluster. The operation @@ -228,13 +230,16 @@ def list( :rtype: ~azure.mgmt.containerservice.v2020_07_01.models.PrivateEndpointConnectionListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-07-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] request = build_list_request( @@ -243,11 +248,13 @@ def list( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -275,7 +282,7 @@ def get( resource_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Gets the private endpoint connection. Gets the details of the private endpoint connection by managed cluster and resource group. @@ -291,13 +298,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2020_07_01.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-07-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] request = build_get_request( @@ -307,11 +317,13 @@ def get( private_endpoint_connection_name=private_endpoint_connection_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -338,9 +350,9 @@ def update( resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - parameters: "_models.PrivateEndpointConnection", + parameters: _models.PrivateEndpointConnection, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. Updates a private endpoint connection in the specified managed cluster. @@ -358,14 +370,17 @@ def update( :rtype: ~azure.mgmt.containerservice.v2020_07_01.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] _json = self._serialize.body(parameters, 'PrivateEndpointConnection') @@ -378,11 +393,13 @@ def update( content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -410,13 +427,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-07-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -426,11 +446,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name=private_endpoint_connection_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -477,21 +499,26 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-07-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -501,8 +528,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/__init__.py index 53c675bd95e2..37a5f9e02e6f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._container_service_client import ContainerServiceClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['ContainerServiceClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/_container_service_client.py index 400293819c69..4aaa3fd573e2 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/_container_service_client.py @@ -69,12 +69,24 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.managed_clusters = ManagedClustersOperations(self._client, self._config, self._serialize, self._deserialize) - self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) - self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_clusters = ManagedClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.agent_pools = AgentPoolsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/aio/__init__.py index 53c675bd95e2..37a5f9e02e6f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/aio/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/aio/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._container_service_client import ContainerServiceClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['ContainerServiceClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/aio/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/aio/_container_service_client.py index b9bdd4e6a988..221bdc1896d3 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/aio/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/aio/_container_service_client.py @@ -70,12 +70,24 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.managed_clusters = ManagedClustersOperations(self._client, self._config, self._serialize, self._deserialize) - self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) - self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_clusters = ManagedClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.agent_pools = AgentPoolsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/aio/operations/__init__.py index 653c03870023..eb76d54a688d 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/aio/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/aio/operations/__init__.py @@ -13,6 +13,9 @@ from ._private_link_resources_operations import PrivateLinkResourcesOperations from ._resolve_private_link_service_id_operations import ResolvePrivateLinkServiceIdOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'Operations', 'ManagedClustersOperations', @@ -21,3 +24,5 @@ 'PrivateLinkResourcesOperations', 'ResolvePrivateLinkServiceIdOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/aio/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/aio/operations/_agent_pools_operations.py index 16c5055379f5..3a92f26aa0d1 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/aio/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/aio/operations/_agent_pools_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. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ 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 @@ -26,26 +27,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class AgentPoolsOperations: - """AgentPoolsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2020_09_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2020_09_01.aio.ContainerServiceClient`'s + :attr:`agent_pools` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -53,7 +52,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> AsyncIterable["_models.AgentPoolListResult"]: + ) -> AsyncIterable[_models.AgentPoolListResult]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. The operation returns properties @@ -69,13 +68,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_09_01.models.AgentPoolListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-09-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -85,9 +87,11 @@ def prepare_request(next_link=None): resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -97,9 +101,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -139,7 +145,7 @@ async def get( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPool": + ) -> _models.AgentPool: """Gets the agent pool. Gets the details of the agent pool by managed cluster and resource group. @@ -155,13 +161,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2020_09_01.models.AgentPool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-09-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] request = build_get_request( @@ -171,11 +180,13 @@ async def get( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -201,17 +212,20 @@ async def _create_or_update_initial( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> "_models.AgentPool": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] + ) -> _models.AgentPool: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2020-09-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] _json = self._serialize.body(parameters, 'AgentPool') @@ -224,11 +238,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -259,9 +275,9 @@ async def begin_create_or_update( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> AsyncLROPoller["_models.AgentPool"]: + ) -> AsyncLROPoller[_models.AgentPool]: """Creates or updates an agent pool. Creates or updates an agent pool in the specified managed cluster. @@ -288,17 +304,20 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_09_01.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-09-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, @@ -306,20 +325,27 @@ async def begin_create_or_update( 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): - response = pipeline_response.http_response deserialized = self._deserialize('AgentPool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -339,13 +365,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements agent_pool_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-09-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -355,11 +384,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -406,21 +437,26 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-09-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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) @@ -430,8 +466,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -451,7 +493,7 @@ async def get_upgrade_profile( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPoolUpgradeProfile": + ) -> _models.AgentPoolUpgradeProfile: """Gets upgrade profile for an agent pool. Gets the details of the upgrade profile for an agent pool with a specified resource group and @@ -468,13 +510,16 @@ async def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2020_09_01.models.AgentPoolUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-09-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] request = build_get_upgrade_profile_request( @@ -484,11 +529,13 @@ async def get_upgrade_profile( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -515,7 +562,7 @@ async def get_available_agent_pool_versions( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.AgentPoolAvailableVersions": + ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported versions for the specified agent pool. Gets a list of supported versions for the specified agent pool. @@ -529,13 +576,16 @@ async def get_available_agent_pool_versions( :rtype: ~azure.mgmt.containerservice.v2020_09_01.models.AgentPoolAvailableVersions :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolAvailableVersions"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-09-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] request = build_get_available_agent_pool_versions_request( @@ -544,11 +594,13 @@ async def get_available_agent_pool_versions( resource_name=resource_name, api_version=api_version, template_url=self.get_available_agent_pool_versions.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -575,14 +627,17 @@ async def _upgrade_node_image_version_initial( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> Optional["_models.AgentPool"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.AgentPool"]] + ) -> Optional[_models.AgentPool]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-09-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] request = build_upgrade_node_image_version_request_initial( @@ -592,11 +647,13 @@ async def _upgrade_node_image_version_initial( agent_pool_name=agent_pool_name, api_version=api_version, template_url=self._upgrade_node_image_version_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -626,7 +683,7 @@ async def begin_upgrade_node_image_version( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> AsyncLROPoller["_models.AgentPool"]: + ) -> AsyncLROPoller[_models.AgentPool]: """Upgrade node image version of an agent pool to the latest. Upgrade node image version of an agent pool to the latest. @@ -651,35 +708,45 @@ async def begin_upgrade_node_image_version( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_09_01.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-09-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._upgrade_node_image_version_initial( + raw_result = await self._upgrade_node_image_version_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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): - response = pipeline_response.http_response deserialized = self._deserialize('AgentPool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/aio/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/aio/operations/_managed_clusters_operations.py index 008674fd13d9..b623c811741a 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/aio/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/aio/operations/_managed_clusters_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. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ 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 @@ -26,32 +27,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ManagedClustersOperations: # pylint: disable=too-many-public-methods - """ManagedClustersOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2020_09_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2020_09_01.aio.ContainerServiceClient`'s + :attr:`managed_clusters` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.ManagedClusterListResult"]: + ) -> AsyncIterable[_models.ManagedClusterListResult]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. The operation returns properties @@ -64,13 +63,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_09_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-09-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -78,9 +80,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -88,9 +92,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -128,7 +134,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ManagedClusterListResult"]: + ) -> AsyncIterable[_models.ManagedClusterListResult]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. The operation returns @@ -143,13 +149,16 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_09_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-09-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -158,9 +167,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -169,9 +180,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -210,7 +223,7 @@ async def get_upgrade_profile( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedClusterUpgradeProfile": + ) -> _models.ManagedClusterUpgradeProfile: """Gets upgrade profile for a managed cluster. Gets the details of the upgrade profile for a managed cluster with a specified resource group @@ -225,13 +238,16 @@ async def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2020_09_01.models.ManagedClusterUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-09-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] request = build_get_upgrade_profile_request( @@ -240,11 +256,13 @@ async def get_upgrade_profile( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -272,7 +290,7 @@ async def get_access_profile( resource_name: str, role_name: str, **kwargs: Any - ) -> "_models.ManagedClusterAccessProfile": + ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. Gets the accessProfile for the specified role name of the managed cluster with a specified @@ -293,13 +311,16 @@ async def get_access_profile( :rtype: ~azure.mgmt.containerservice.v2020_09_01.models.ManagedClusterAccessProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterAccessProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-09-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] request = build_get_access_profile_request( @@ -309,11 +330,13 @@ async def get_access_profile( role_name=role_name, api_version=api_version, template_url=self.get_access_profile.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -340,7 +363,7 @@ async def list_cluster_admin_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster admin credential of a managed cluster. Gets cluster admin credential of the managed cluster with a specified resource group and name. @@ -354,13 +377,16 @@ async def list_cluster_admin_credentials( :rtype: ~azure.mgmt.containerservice.v2020_09_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-09-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_admin_credentials_request( @@ -369,11 +395,13 @@ async def list_cluster_admin_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_admin_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -400,7 +428,7 @@ async def list_cluster_user_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster user credential of a managed cluster. Gets cluster user credential of the managed cluster with a specified resource group and name. @@ -414,13 +442,16 @@ async def list_cluster_user_credentials( :rtype: ~azure.mgmt.containerservice.v2020_09_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-09-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_user_credentials_request( @@ -429,11 +460,13 @@ async def list_cluster_user_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -460,7 +493,7 @@ async def list_cluster_monitoring_user_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster monitoring user credential of a managed cluster. Gets cluster monitoring user credential of the managed cluster with a specified resource group @@ -475,13 +508,16 @@ async def list_cluster_monitoring_user_credentials( :rtype: ~azure.mgmt.containerservice.v2020_09_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-09-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_monitoring_user_credentials_request( @@ -490,11 +526,13 @@ async def list_cluster_monitoring_user_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -521,7 +559,7 @@ async def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedCluster": + ) -> _models.ManagedCluster: """Gets a managed cluster. Gets the details of the managed cluster with a specified resource group and name. @@ -535,13 +573,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2020_09_01.models.ManagedCluster :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-09-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] request = build_get_request( @@ -550,11 +591,13 @@ async def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -579,17 +622,20 @@ async def _create_or_update_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2020-09-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'ManagedCluster') @@ -601,11 +647,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -635,9 +683,9 @@ async def begin_create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> AsyncLROPoller["_models.ManagedCluster"]: + ) -> AsyncLROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. Creates or updates a managed cluster with the specified configuration for agents and Kubernetes @@ -663,37 +711,47 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_09_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-09-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -710,17 +768,20 @@ async def _update_tags_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2020-09-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'TagsObject') @@ -732,11 +793,13 @@ async def _update_tags_initial( content_type=content_type, json=_json, template_url=self._update_tags_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -762,9 +825,9 @@ async def begin_update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> AsyncLROPoller["_models.ManagedCluster"]: + ) -> AsyncLROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates a managed cluster with the specified tags. @@ -789,37 +852,47 @@ async def begin_update_tags( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_09_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-09-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._update_tags_initial( + raw_result = await self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -838,13 +911,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-09-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -853,11 +929,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -901,20 +979,25 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-09-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_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) @@ -924,8 +1007,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -942,17 +1031,20 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-09-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') @@ -964,11 +1056,13 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist content_type=content_type, json=_json, template_url=self._reset_service_principal_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -990,7 +1084,7 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> AsyncLROPoller[None]: """Reset Service Principal Profile of a managed cluster. @@ -1017,23 +1111,28 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-09-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._reset_service_principal_profile_initial( + raw_result = await self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1043,8 +1142,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1061,17 +1166,20 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-09-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') @@ -1083,11 +1191,13 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta content_type=content_type, json=_json, template_url=self._reset_aad_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1109,7 +1219,7 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> AsyncLROPoller[None]: """Reset AAD Profile of a managed cluster. @@ -1135,23 +1245,28 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-09-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._reset_aad_profile_initial( + raw_result = await self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1161,8 +1276,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1181,13 +1302,16 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-09-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_rotate_cluster_certificates_request_initial( @@ -1196,11 +1320,13 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- resource_name=resource_name, api_version=api_version, template_url=self._rotate_cluster_certificates_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1244,20 +1370,25 @@ async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-ret :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-09-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._rotate_cluster_certificates_initial( + raw_result = await self._rotate_cluster_certificates_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) @@ -1267,8 +1398,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1287,13 +1424,16 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-09-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_stop_request_initial( @@ -1302,11 +1442,13 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_name, api_version=api_version, template_url=self._stop_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1350,20 +1492,25 @@ async def begin_stop( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-09-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._stop_initial( + raw_result = await self._stop_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) @@ -1373,8 +1520,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1393,13 +1546,16 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-09-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_start_request_initial( @@ -1408,11 +1564,13 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_name, api_version=api_version, template_url=self._start_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1456,20 +1614,25 @@ async def begin_start( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-09-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._start_initial( + raw_result = await self._start_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) @@ -1479,8 +1642,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/aio/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/aio/operations/_operations.py index de8353f7322f..313fba28651c 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/aio/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/aio/operations/_operations.py @@ -14,6 +14,7 @@ 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 @@ -23,32 +24,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class Operations: - """Operations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2020_09_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2020_09_01.aio.ContainerServiceClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.OperationListResult"]: + ) -> AsyncIterable[_models.OperationListResult]: """Gets a list of compute operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -57,31 +56,38 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_09_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-09-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/aio/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/aio/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/aio/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/aio/operations/_private_endpoint_connections_operations.py index f4bbf06ac680..175d745992d5 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/aio/operations/_private_endpoint_connections_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -14,6 +14,7 @@ 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 @@ -24,26 +25,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class PrivateEndpointConnectionsOperations: - """PrivateEndpointConnectionsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2020_09_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2020_09_01.aio.ContainerServiceClient`'s + :attr:`private_endpoint_connections` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -51,7 +50,7 @@ async def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnectionListResult": + ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. Gets a list of private endpoint connections in the specified managed cluster. The operation @@ -66,13 +65,16 @@ async def list( :rtype: ~azure.mgmt.containerservice.v2020_09_01.models.PrivateEndpointConnectionListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-09-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] request = build_list_request( @@ -81,11 +83,13 @@ async def list( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -113,7 +117,7 @@ async def get( resource_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Gets the private endpoint connection. Gets the details of the private endpoint connection by managed cluster and resource group. @@ -129,13 +133,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2020_09_01.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-09-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] request = build_get_request( @@ -145,11 +152,13 @@ async def get( private_endpoint_connection_name=private_endpoint_connection_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -176,9 +185,9 @@ async def update( resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - parameters: "_models.PrivateEndpointConnection", + parameters: _models.PrivateEndpointConnection, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. Updates a private endpoint connection in the specified managed cluster. @@ -196,14 +205,17 @@ async def update( :rtype: ~azure.mgmt.containerservice.v2020_09_01.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2020-09-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] _json = self._serialize.body(parameters, 'PrivateEndpointConnection') @@ -216,11 +228,13 @@ async def update( content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -248,13 +262,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-09-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -264,11 +281,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name=private_endpoint_connection_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -315,21 +334,26 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-09-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -339,8 +363,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/aio/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/aio/operations/_private_link_resources_operations.py index 524fee5872cf..d507c5d4248a 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/aio/operations/_private_link_resources_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/aio/operations/_private_link_resources_operations.py @@ -13,6 +13,7 @@ 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 @@ -22,26 +23,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class PrivateLinkResourcesOperations: - """PrivateLinkResourcesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2020_09_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2020_09_01.aio.ContainerServiceClient`'s + :attr:`private_link_resources` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -49,7 +48,7 @@ async def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.PrivateLinkResourcesListResult": + ) -> _models.PrivateLinkResourcesListResult: """Gets a list of private link resources in the specified managed cluster. Gets a list of private link resources in the specified managed cluster. The operation returns @@ -64,13 +63,16 @@ async def list( :rtype: ~azure.mgmt.containerservice.v2020_09_01.models.PrivateLinkResourcesListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourcesListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-09-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] request = build_list_request( @@ -79,11 +81,13 @@ async def list( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/aio/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/aio/operations/_resolve_private_link_service_id_operations.py index 5e407b760230..49ebedef0dd1 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/aio/operations/_resolve_private_link_service_id_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/aio/operations/_resolve_private_link_service_id_operations.py @@ -13,6 +13,7 @@ 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 @@ -22,35 +23,33 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ResolvePrivateLinkServiceIdOperations: - """ResolvePrivateLinkServiceIdOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2020_09_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2020_09_01.aio.ContainerServiceClient`'s + :attr:`resolve_private_link_service_id` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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 post( self, resource_group_name: str, resource_name: str, - parameters: "_models.PrivateLinkResource", + parameters: _models.PrivateLinkResource, **kwargs: Any - ) -> "_models.PrivateLinkResource": + ) -> _models.PrivateLinkResource: """Gets the private link service ID for the specified managed cluster. Gets the private link service ID the specified managed cluster. @@ -67,14 +66,17 @@ async def post( :rtype: ~azure.mgmt.containerservice.v2020_09_01.models.PrivateLinkResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2020-09-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] _json = self._serialize.body(parameters, 'PrivateLinkResource') @@ -86,11 +88,13 @@ async def post( content_type=content_type, json=_json, template_url=self.post.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/models/__init__.py index 4b98050fe23e..2d917ca249da 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/models/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/models/__init__.py @@ -87,7 +87,9 @@ ScaleSetEvictionPolicy, ScaleSetPriority, ) - +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'AgentPool', 'AgentPoolAvailableVersions', @@ -167,3 +169,5 @@ 'ScaleSetEvictionPolicy', 'ScaleSetPriority', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/models/_container_service_client_enums.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/models/_container_service_client_enums.py index d99b1f1a529e..dd728798c217 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/models/_container_service_client_enums.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/models/_container_service_client_enums.py @@ -7,32 +7,31 @@ # -------------------------------------------------------------------------- from enum import Enum -from six import with_metaclass from azure.core import CaseInsensitiveEnumMeta -class AgentPoolMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class AgentPoolMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """AgentPoolMode represents mode of an agent pool. """ SYSTEM = "System" USER = "User" -class AgentPoolType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class AgentPoolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """AgentPoolType represents types of an agent pool. """ VIRTUAL_MACHINE_SCALE_SETS = "VirtualMachineScaleSets" AVAILABILITY_SET = "AvailabilitySet" -class Code(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class Code(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Tells whether the cluster is Running or Stopped """ RUNNING = "Running" STOPPED = "Stopped" -class ConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The private link service connection status. """ @@ -41,7 +40,7 @@ class ConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): REJECTED = "Rejected" DISCONNECTED = "Disconnected" -class ContainerServiceStorageProfileTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the orchestrator choice. """ @@ -49,7 +48,7 @@ class ContainerServiceStorageProfileTypes(with_metaclass(CaseInsensitiveEnumMeta STORAGE_ACCOUNT = "StorageAccount" MANAGED_DISKS = "ManagedDisks" -class ContainerServiceVMSizeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Size of agent VMs. """ @@ -228,7 +227,7 @@ class ContainerServiceVMSizeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, E STANDARD_NV24 = "Standard_NV24" STANDARD_NV6 = "Standard_NV6" -class Count(with_metaclass(CaseInsensitiveEnumMeta, int, Enum)): +class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): """Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, and 5. The default value is 1. """ @@ -237,13 +236,13 @@ class Count(with_metaclass(CaseInsensitiveEnumMeta, int, Enum)): THREE = 3 FIVE = 5 -class Expander(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class Expander(str, Enum, metaclass=CaseInsensitiveEnumMeta): LEAST_WASTE = "least-waste" MOST_PODS = "most-pods" RANDOM = "random" -class LicenseType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class LicenseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The licenseType to use for Windows VMs. Windows_Server is used to enable Azure Hybrid User Benefits for Windows VMs. """ @@ -251,69 +250,69 @@ class LicenseType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): NONE = "None" WINDOWS_SERVER = "Windows_Server" -class LoadBalancerSku(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class LoadBalancerSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The load balancer sku for the managed cluster. """ STANDARD = "standard" BASIC = "basic" -class ManagedClusterSKUName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ManagedClusterSKUName(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Name of a managed cluster SKU. """ BASIC = "Basic" -class ManagedClusterSKUTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ManagedClusterSKUTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Tier of a managed cluster SKU. """ PAID = "Paid" FREE = "Free" -class NetworkMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Network mode used for building Kubernetes network. """ TRANSPARENT = "transparent" BRIDGE = "bridge" -class NetworkPlugin(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkPlugin(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Network plugin used for building Kubernetes network. """ AZURE = "azure" KUBENET = "kubenet" -class NetworkPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Network policy used for building Kubernetes network. """ CALICO = "calico" AZURE = "azure" -class OSDiskType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OSDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """OSDiskType represents the type of an OS disk on an agent pool. """ MANAGED = "Managed" EPHEMERAL = "Ephemeral" -class OSType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux. """ LINUX = "Linux" WINDOWS = "Windows" -class OutboundType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OutboundType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The outbound (egress) routing method. """ LOAD_BALANCER = "loadBalancer" USER_DEFINED_ROUTING = "userDefinedRouting" -class PrivateEndpointConnectionProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class PrivateEndpointConnectionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The current provisioning state. """ @@ -322,7 +321,7 @@ class PrivateEndpointConnectionProvisioningState(with_metaclass(CaseInsensitiveE DELETING = "Deleting" FAILED = "Failed" -class ResourceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ resource group in agent nodes. Type 'None' will not use MSI for the managed cluster, service @@ -333,7 +332,7 @@ class ResourceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): USER_ASSIGNED = "UserAssigned" NONE = "None" -class ScaleSetEvictionPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ScaleSetEvictionPolicy to be used to specify eviction policy for Spot virtual machine scale set. Default to Delete. """ @@ -341,7 +340,7 @@ class ScaleSetEvictionPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)) DELETE = "Delete" DEALLOCATE = "Deallocate" -class ScaleSetPriority(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ScaleSetPriority(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ScaleSetPriority to be used to specify virtual machine scale set priority. Default to regular. """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/models/_models_py3.py index fed66468b5cb..c544b912e67e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/models/_models_py3.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/models/_models_py3.py @@ -6,11 +6,13 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Dict, List, Optional, Union +from typing import Dict, List, Optional, TYPE_CHECKING, Union import msrest.serialization -from ._container_service_client_enums import * +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + import __init__ as _models class SubResource(msrest.serialization.Model): @@ -67,7 +69,7 @@ class AgentPool(SubResource): range of 0 to 100 (inclusive) for user pools and in the range of 1 to 100 (inclusive) for system pools. The default value is 1. :vartype count: int - :ivar vm_size: Size of agent VMs. Possible values include: "Standard_A1", "Standard_A10", + :ivar vm_size: Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -112,15 +114,15 @@ class AgentPool(SubResource): the vmSize specified. :vartype os_disk_size_gb: int :ivar os_disk_type: OS disk type to be used for machines in a given agent pool. Allowed values - are 'Ephemeral' and 'Managed'. Defaults to 'Managed'. May not be changed after creation. - Possible values include: "Managed", "Ephemeral". + are 'Ephemeral' and 'Managed'. Defaults to 'Managed'. May not be changed after creation. Known + values are: "Managed", "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2020_09_01.models.OSDiskType :ivar vnet_subnet_id: VNet SubnetID specifies the VNet's subnet identifier. :vartype vnet_subnet_id: str :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2020_09_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -128,12 +130,11 @@ class AgentPool(SubResource): :vartype min_count: int :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool - :ivar type_properties_type: AgentPoolType represents types of an agent pool. Possible values - include: "VirtualMachineScaleSets", "AvailabilitySet". + :ivar type_properties_type: AgentPoolType represents types of an agent pool. Known values are: + "VirtualMachineScaleSets", "AvailabilitySet". :vartype type_properties_type: str or ~azure.mgmt.containerservice.v2020_09_01.models.AgentPoolType - :ivar mode: AgentPoolMode represents mode of an agent pool. Possible values include: "System", - "User". + :ivar mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", "User". :vartype mode: str or ~azure.mgmt.containerservice.v2020_09_01.models.AgentPoolMode :ivar orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -154,12 +155,11 @@ class AgentPool(SubResource): :ivar enable_node_public_ip: Enable public IP for nodes. :vartype enable_node_public_ip: bool :ivar scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Possible values include: "Spot", "Regular". Default value: - "Regular". + priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_09_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy - for Spot virtual machine scale set. Default to Delete. Possible values include: "Delete", + for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", "Deallocate". Default value: "Delete". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_09_01.models.ScaleSetEvictionPolicy @@ -225,23 +225,23 @@ def __init__( self, *, count: Optional[int] = None, - vm_size: Optional[Union[str, "ContainerServiceVMSizeTypes"]] = None, + vm_size: Optional[Union[str, "_models.ContainerServiceVMSizeTypes"]] = None, os_disk_size_gb: Optional[int] = None, - os_disk_type: Optional[Union[str, "OSDiskType"]] = None, + os_disk_type: Optional[Union[str, "_models.OSDiskType"]] = None, vnet_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - type_properties_type: Optional[Union[str, "AgentPoolType"]] = None, - mode: Optional[Union[str, "AgentPoolMode"]] = None, + type_properties_type: Optional[Union[str, "_models.AgentPoolType"]] = None, + mode: Optional[Union[str, "_models.AgentPoolMode"]] = None, orchestrator_version: Optional[str] = None, - upgrade_settings: Optional["AgentPoolUpgradeSettings"] = None, + upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, - scale_set_priority: Optional[Union[str, "ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", spot_max_price: Optional[float] = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, @@ -254,7 +254,7 @@ def __init__( range of 0 to 100 (inclusive) for user pools and in the range of 1 to 100 (inclusive) for system pools. The default value is 1. :paramtype count: int - :keyword vm_size: Size of agent VMs. Possible values include: "Standard_A1", "Standard_A10", + :keyword vm_size: Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -300,14 +300,14 @@ def __init__( :paramtype os_disk_size_gb: int :keyword os_disk_type: OS disk type to be used for machines in a given agent pool. Allowed values are 'Ephemeral' and 'Managed'. Defaults to 'Managed'. May not be changed after creation. - Possible values include: "Managed", "Ephemeral". + Known values are: "Managed", "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2020_09_01.models.OSDiskType :keyword vnet_subnet_id: VNet SubnetID specifies the VNet's subnet identifier. :paramtype vnet_subnet_id: str :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2020_09_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -315,12 +315,12 @@ def __init__( :paramtype min_count: int :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool - :keyword type_properties_type: AgentPoolType represents types of an agent pool. Possible values - include: "VirtualMachineScaleSets", "AvailabilitySet". + :keyword type_properties_type: AgentPoolType represents types of an agent pool. Known values + are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type_properties_type: str or ~azure.mgmt.containerservice.v2020_09_01.models.AgentPoolType - :keyword mode: AgentPoolMode represents mode of an agent pool. Possible values include: - "System", "User". + :keyword mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", + "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2020_09_01.models.AgentPoolMode :keyword orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -334,13 +334,12 @@ def __init__( :keyword enable_node_public_ip: Enable public IP for nodes. :paramtype enable_node_public_ip: bool :keyword scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Possible values include: "Spot", "Regular". Default value: - "Regular". + priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_09_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction - policy for Spot virtual machine scale set. Default to Delete. Possible values include: - "Delete", "Deallocate". Default value: "Delete". + policy for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", + "Deallocate". Default value: "Delete". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_09_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: SpotMaxPrice to be used to specify the maximum price you are willing @@ -419,7 +418,7 @@ class AgentPoolAvailableVersions(msrest.serialization.Model): def __init__( self, *, - agent_pool_versions: Optional[List["AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem"]] = None, + agent_pool_versions: Optional[List["_models.AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem"]] = None, **kwargs ): """ @@ -496,7 +495,7 @@ class AgentPoolListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["AgentPool"]] = None, + value: Optional[List["_models.AgentPool"]] = None, **kwargs ): """ @@ -524,7 +523,7 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): :ivar kubernetes_version: Required. Kubernetes version (major, minor, patch). :vartype kubernetes_version: str :ivar os_type: Required. OsType to be used to specify os type. Choose from Linux and Windows. - Default to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2020_09_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -556,8 +555,8 @@ def __init__( self, *, kubernetes_version: str, - os_type: Union[str, "OSType"] = "Linux", - upgrades: Optional[List["AgentPoolUpgradeProfilePropertiesUpgradesItem"]] = None, + os_type: Union[str, "_models.OSType"] = "Linux", + upgrades: Optional[List["_models.AgentPoolUpgradeProfilePropertiesUpgradesItem"]] = None, latest_node_image_version: Optional[str] = None, **kwargs ): @@ -565,7 +564,7 @@ def __init__( :keyword kubernetes_version: Required. Kubernetes version (major, minor, patch). :paramtype kubernetes_version: str :keyword os_type: Required. OsType to be used to specify os type. Choose from Linux and - Windows. Default to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Windows. Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2020_09_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: @@ -744,23 +743,23 @@ class BaseManagedCluster(msrest.serialization.Model): def __init__( self, *, - identity: Optional["ManagedClusterIdentity"] = None, + identity: Optional["_models.ManagedClusterIdentity"] = None, kubernetes_version: Optional[str] = None, dns_prefix: Optional[str] = None, - agent_pool_profiles: Optional[List["ManagedClusterAgentPoolProfile"]] = None, - linux_profile: Optional["ContainerServiceLinuxProfile"] = None, - windows_profile: Optional["ManagedClusterWindowsProfile"] = None, - service_principal_profile: Optional["ManagedClusterServicePrincipalProfile"] = None, - addon_profiles: Optional[Dict[str, "ManagedClusterAddonProfile"]] = None, + agent_pool_profiles: Optional[List["_models.ManagedClusterAgentPoolProfile"]] = None, + linux_profile: Optional["_models.ContainerServiceLinuxProfile"] = None, + windows_profile: Optional["_models.ManagedClusterWindowsProfile"] = None, + service_principal_profile: Optional["_models.ManagedClusterServicePrincipalProfile"] = None, + addon_profiles: Optional[Dict[str, "_models.ManagedClusterAddonProfile"]] = None, node_resource_group: Optional[str] = None, enable_rbac: Optional[bool] = None, enable_pod_security_policy: Optional[bool] = None, - network_profile: Optional["ContainerServiceNetworkProfile"] = None, - aad_profile: Optional["ManagedClusterAADProfile"] = None, - auto_scaler_profile: Optional["ManagedClusterPropertiesAutoScalerProfile"] = None, - api_server_access_profile: Optional["ManagedClusterAPIServerAccessProfile"] = None, + network_profile: Optional["_models.ContainerServiceNetworkProfile"] = None, + aad_profile: Optional["_models.ManagedClusterAADProfile"] = None, + auto_scaler_profile: Optional["_models.ManagedClusterPropertiesAutoScalerProfile"] = None, + api_server_access_profile: Optional["_models.ManagedClusterAPIServerAccessProfile"] = None, disk_encryption_set_id: Optional[str] = None, - identity_profile: Optional[Dict[str, "ManagedClusterPropertiesIdentityProfileValue"]] = None, + identity_profile: Optional[Dict[str, "_models.ManagedClusterPropertiesIdentityProfileValue"]] = None, **kwargs ): """ @@ -867,7 +866,7 @@ def __init__( code: Optional[str] = None, message: Optional[str] = None, target: Optional[str] = None, - details: Optional[List["CloudErrorBody"]] = None, + details: Optional[List["_models.CloudErrorBody"]] = None, **kwargs ): """ @@ -911,7 +910,7 @@ class ContainerServiceDiagnosticsProfile(msrest.serialization.Model): def __init__( self, *, - vm_diagnostics: "ContainerServiceVMDiagnostics", + vm_diagnostics: "_models.ContainerServiceVMDiagnostics", **kwargs ): """ @@ -948,7 +947,7 @@ def __init__( self, *, admin_username: str, - ssh: "ContainerServiceSshConfiguration", + ssh: "_models.ContainerServiceSshConfiguration", **kwargs ): """ @@ -971,17 +970,17 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar count: Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, - and 5. The default value is 1. Possible values include: 1, 3, 5. Default value: "1". + and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". :vartype count: int or ~azure.mgmt.containerservice.v2020_09_01.models.Count :ivar dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. :vartype dns_prefix: str - :ivar vm_size: Required. Size of agent VMs. Possible values include: "Standard_A1", - "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", - "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", - "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", - "Standard_A8m_v2", "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", - "Standard_B8ms", "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", - "Standard_D12", "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", + :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", + "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", + "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", + "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", "Standard_B8ms", + "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", "Standard_D12", + "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", "Standard_D13_v2_Promo", "Standard_D14", "Standard_D14_v2", "Standard_D14_v2_Promo", "Standard_D15_v2", "Standard_D16_v3", "Standard_D16s_v3", "Standard_D1_v2", "Standard_D2", "Standard_D2_v2", "Standard_D2_v2_Promo", "Standard_D2_v3", "Standard_D2s_v3", "Standard_D3", @@ -1026,7 +1025,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): :vartype first_consecutive_static_ip: str :ivar storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Possible values include: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". :vartype storage_profile: str or ~azure.mgmt.containerservice.v2020_09_01.models.ContainerServiceStorageProfileTypes :ivar fqdn: FQDN for the master pool. @@ -1055,27 +1054,27 @@ def __init__( self, *, dns_prefix: str, - vm_size: Union[str, "ContainerServiceVMSizeTypes"], - count: Optional[Union[int, "Count"]] = 1, + vm_size: Union[str, "_models.ContainerServiceVMSizeTypes"], + count: Optional[Union[int, "_models.Count"]] = 1, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, first_consecutive_static_ip: Optional[str] = "10.240.255.5", - storage_profile: Optional[Union[str, "ContainerServiceStorageProfileTypes"]] = None, + storage_profile: Optional[Union[str, "_models.ContainerServiceStorageProfileTypes"]] = None, **kwargs ): """ :keyword count: Number of masters (VMs) in the container service cluster. Allowed values are 1, - 3, and 5. The default value is 1. Possible values include: 1, 3, 5. Default value: "1". + 3, and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". :paramtype count: int or ~azure.mgmt.containerservice.v2020_09_01.models.Count :keyword dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. :paramtype dns_prefix: str - :keyword vm_size: Required. Size of agent VMs. Possible values include: "Standard_A1", - "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", - "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", - "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", - "Standard_A8m_v2", "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", - "Standard_B8ms", "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", - "Standard_D12", "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", + :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", + "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", + "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", + "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", "Standard_B8ms", + "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", "Standard_D12", + "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", "Standard_D13_v2_Promo", "Standard_D14", "Standard_D14_v2", "Standard_D14_v2_Promo", "Standard_D15_v2", "Standard_D16_v3", "Standard_D16s_v3", "Standard_D1_v2", "Standard_D2", "Standard_D2_v2", "Standard_D2_v2_Promo", "Standard_D2_v3", "Standard_D2s_v3", "Standard_D3", @@ -1120,7 +1119,7 @@ def __init__( :paramtype first_consecutive_static_ip: str :keyword storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Possible values include: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". :paramtype storage_profile: str or ~azure.mgmt.containerservice.v2020_09_01.models.ContainerServiceStorageProfileTypes """ @@ -1138,13 +1137,13 @@ def __init__( class ContainerServiceNetworkProfile(msrest.serialization.Model): """Profile of network configuration. - :ivar network_plugin: Network plugin used for building Kubernetes network. Possible values - include: "azure", "kubenet". Default value: "kubenet". + :ivar network_plugin: Network plugin used for building Kubernetes network. Known values are: + "azure", "kubenet". Default value: "kubenet". :vartype network_plugin: str or ~azure.mgmt.containerservice.v2020_09_01.models.NetworkPlugin - :ivar network_policy: Network policy used for building Kubernetes network. Possible values - include: "calico", "azure". + :ivar network_policy: Network policy used for building Kubernetes network. Known values are: + "calico", "azure". :vartype network_policy: str or ~azure.mgmt.containerservice.v2020_09_01.models.NetworkPolicy - :ivar network_mode: Network mode used for building Kubernetes network. Possible values include: + :ivar network_mode: Network mode used for building Kubernetes network. Known values are: "transparent", "bridge". :vartype network_mode: str or ~azure.mgmt.containerservice.v2020_09_01.models.NetworkMode :ivar pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. @@ -1158,11 +1157,11 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): :ivar docker_bridge_cidr: A CIDR notation IP range assigned to the Docker bridge network. It must not overlap with any Subnet IP ranges or the Kubernetes service address range. :vartype docker_bridge_cidr: str - :ivar outbound_type: The outbound (egress) routing method. Possible values include: - "loadBalancer", "userDefinedRouting". Default value: "loadBalancer". + :ivar outbound_type: The outbound (egress) routing method. Known values are: "loadBalancer", + "userDefinedRouting". Default value: "loadBalancer". :vartype outbound_type: str or ~azure.mgmt.containerservice.v2020_09_01.models.OutboundType - :ivar load_balancer_sku: The load balancer sku for the managed cluster. Possible values - include: "standard", "basic". + :ivar load_balancer_sku: The load balancer sku for the managed cluster. Known values are: + "standard", "basic". :vartype load_balancer_sku: str or ~azure.mgmt.containerservice.v2020_09_01.models.LoadBalancerSku :ivar load_balancer_profile: Profile of the cluster load balancer. @@ -1193,27 +1192,27 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): def __init__( self, *, - network_plugin: Optional[Union[str, "NetworkPlugin"]] = "kubenet", - network_policy: Optional[Union[str, "NetworkPolicy"]] = None, - network_mode: Optional[Union[str, "NetworkMode"]] = None, + network_plugin: Optional[Union[str, "_models.NetworkPlugin"]] = "kubenet", + network_policy: Optional[Union[str, "_models.NetworkPolicy"]] = None, + network_mode: Optional[Union[str, "_models.NetworkMode"]] = None, pod_cidr: Optional[str] = "10.244.0.0/16", service_cidr: Optional[str] = "10.0.0.0/16", dns_service_ip: Optional[str] = "10.0.0.10", docker_bridge_cidr: Optional[str] = "172.17.0.1/16", - outbound_type: Optional[Union[str, "OutboundType"]] = "loadBalancer", - load_balancer_sku: Optional[Union[str, "LoadBalancerSku"]] = None, - load_balancer_profile: Optional["ManagedClusterLoadBalancerProfile"] = None, + outbound_type: Optional[Union[str, "_models.OutboundType"]] = "loadBalancer", + load_balancer_sku: Optional[Union[str, "_models.LoadBalancerSku"]] = None, + load_balancer_profile: Optional["_models.ManagedClusterLoadBalancerProfile"] = None, **kwargs ): """ - :keyword network_plugin: Network plugin used for building Kubernetes network. Possible values - include: "azure", "kubenet". Default value: "kubenet". + :keyword network_plugin: Network plugin used for building Kubernetes network. Known values are: + "azure", "kubenet". Default value: "kubenet". :paramtype network_plugin: str or ~azure.mgmt.containerservice.v2020_09_01.models.NetworkPlugin - :keyword network_policy: Network policy used for building Kubernetes network. Possible values - include: "calico", "azure". + :keyword network_policy: Network policy used for building Kubernetes network. Known values are: + "calico", "azure". :paramtype network_policy: str or ~azure.mgmt.containerservice.v2020_09_01.models.NetworkPolicy - :keyword network_mode: Network mode used for building Kubernetes network. Possible values - include: "transparent", "bridge". + :keyword network_mode: Network mode used for building Kubernetes network. Known values are: + "transparent", "bridge". :paramtype network_mode: str or ~azure.mgmt.containerservice.v2020_09_01.models.NetworkMode :keyword pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :paramtype pod_cidr: str @@ -1226,11 +1225,11 @@ def __init__( :keyword docker_bridge_cidr: A CIDR notation IP range assigned to the Docker bridge network. It must not overlap with any Subnet IP ranges or the Kubernetes service address range. :paramtype docker_bridge_cidr: str - :keyword outbound_type: The outbound (egress) routing method. Possible values include: - "loadBalancer", "userDefinedRouting". Default value: "loadBalancer". + :keyword outbound_type: The outbound (egress) routing method. Known values are: "loadBalancer", + "userDefinedRouting". Default value: "loadBalancer". :paramtype outbound_type: str or ~azure.mgmt.containerservice.v2020_09_01.models.OutboundType - :keyword load_balancer_sku: The load balancer sku for the managed cluster. Possible values - include: "standard", "basic". + :keyword load_balancer_sku: The load balancer sku for the managed cluster. Known values are: + "standard", "basic". :paramtype load_balancer_sku: str or ~azure.mgmt.containerservice.v2020_09_01.models.LoadBalancerSku :keyword load_balancer_profile: Profile of the cluster load balancer. @@ -1272,7 +1271,7 @@ class ContainerServiceSshConfiguration(msrest.serialization.Model): def __init__( self, *, - public_keys: List["ContainerServiceSshPublicKey"], + public_keys: List["_models.ContainerServiceSshPublicKey"], **kwargs ): """ @@ -1596,25 +1595,25 @@ def __init__( self, *, location: str, - identity: Optional["ManagedClusterIdentity"] = None, + identity: Optional["_models.ManagedClusterIdentity"] = None, kubernetes_version: Optional[str] = None, dns_prefix: Optional[str] = None, - agent_pool_profiles: Optional[List["ManagedClusterAgentPoolProfile"]] = None, - linux_profile: Optional["ContainerServiceLinuxProfile"] = None, - windows_profile: Optional["ManagedClusterWindowsProfile"] = None, - service_principal_profile: Optional["ManagedClusterServicePrincipalProfile"] = None, - addon_profiles: Optional[Dict[str, "ManagedClusterAddonProfile"]] = None, + agent_pool_profiles: Optional[List["_models.ManagedClusterAgentPoolProfile"]] = None, + linux_profile: Optional["_models.ContainerServiceLinuxProfile"] = None, + windows_profile: Optional["_models.ManagedClusterWindowsProfile"] = None, + service_principal_profile: Optional["_models.ManagedClusterServicePrincipalProfile"] = None, + addon_profiles: Optional[Dict[str, "_models.ManagedClusterAddonProfile"]] = None, node_resource_group: Optional[str] = None, enable_rbac: Optional[bool] = None, enable_pod_security_policy: Optional[bool] = None, - network_profile: Optional["ContainerServiceNetworkProfile"] = None, - aad_profile: Optional["ManagedClusterAADProfile"] = None, - auto_scaler_profile: Optional["ManagedClusterPropertiesAutoScalerProfile"] = None, - api_server_access_profile: Optional["ManagedClusterAPIServerAccessProfile"] = None, + network_profile: Optional["_models.ContainerServiceNetworkProfile"] = None, + aad_profile: Optional["_models.ManagedClusterAADProfile"] = None, + auto_scaler_profile: Optional["_models.ManagedClusterPropertiesAutoScalerProfile"] = None, + api_server_access_profile: Optional["_models.ManagedClusterAPIServerAccessProfile"] = None, disk_encryption_set_id: Optional[str] = None, - identity_profile: Optional[Dict[str, "ManagedClusterPropertiesIdentityProfileValue"]] = None, + identity_profile: Optional[Dict[str, "_models.ManagedClusterPropertiesIdentityProfileValue"]] = None, tags: Optional[Dict[str, str]] = None, - sku: Optional["ManagedClusterSKU"] = None, + sku: Optional["_models.ManagedClusterSKU"] = None, **kwargs ): """ @@ -1961,7 +1960,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): range of 0 to 100 (inclusive) for user pools and in the range of 1 to 100 (inclusive) for system pools. The default value is 1. :vartype count: int - :ivar vm_size: Size of agent VMs. Possible values include: "Standard_A1", "Standard_A10", + :ivar vm_size: Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -2006,15 +2005,15 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): the vmSize specified. :vartype os_disk_size_gb: int :ivar os_disk_type: OS disk type to be used for machines in a given agent pool. Allowed values - are 'Ephemeral' and 'Managed'. Defaults to 'Managed'. May not be changed after creation. - Possible values include: "Managed", "Ephemeral". + are 'Ephemeral' and 'Managed'. Defaults to 'Managed'. May not be changed after creation. Known + values are: "Managed", "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2020_09_01.models.OSDiskType :ivar vnet_subnet_id: VNet SubnetID specifies the VNet's subnet identifier. :vartype vnet_subnet_id: str :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2020_09_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -2022,11 +2021,10 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :vartype min_count: int :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool - :ivar type: AgentPoolType represents types of an agent pool. Possible values include: + :ivar type: AgentPoolType represents types of an agent pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2020_09_01.models.AgentPoolType - :ivar mode: AgentPoolMode represents mode of an agent pool. Possible values include: "System", - "User". + :ivar mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", "User". :vartype mode: str or ~azure.mgmt.containerservice.v2020_09_01.models.AgentPoolMode :ivar orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -2047,12 +2045,11 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar enable_node_public_ip: Enable public IP for nodes. :vartype enable_node_public_ip: bool :ivar scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Possible values include: "Spot", "Regular". Default value: - "Regular". + priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_09_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy - for Spot virtual machine scale set. Default to Delete. Possible values include: "Delete", + for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", "Deallocate". Default value: "Delete". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_09_01.models.ScaleSetEvictionPolicy @@ -2112,23 +2109,23 @@ def __init__( self, *, count: Optional[int] = None, - vm_size: Optional[Union[str, "ContainerServiceVMSizeTypes"]] = None, + vm_size: Optional[Union[str, "_models.ContainerServiceVMSizeTypes"]] = None, os_disk_size_gb: Optional[int] = None, - os_disk_type: Optional[Union[str, "OSDiskType"]] = None, + os_disk_type: Optional[Union[str, "_models.OSDiskType"]] = None, vnet_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - type: Optional[Union[str, "AgentPoolType"]] = None, - mode: Optional[Union[str, "AgentPoolMode"]] = None, + type: Optional[Union[str, "_models.AgentPoolType"]] = None, + mode: Optional[Union[str, "_models.AgentPoolMode"]] = None, orchestrator_version: Optional[str] = None, - upgrade_settings: Optional["AgentPoolUpgradeSettings"] = None, + upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, - scale_set_priority: Optional[Union[str, "ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", spot_max_price: Optional[float] = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, @@ -2141,7 +2138,7 @@ def __init__( range of 0 to 100 (inclusive) for user pools and in the range of 1 to 100 (inclusive) for system pools. The default value is 1. :paramtype count: int - :keyword vm_size: Size of agent VMs. Possible values include: "Standard_A1", "Standard_A10", + :keyword vm_size: Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -2187,14 +2184,14 @@ def __init__( :paramtype os_disk_size_gb: int :keyword os_disk_type: OS disk type to be used for machines in a given agent pool. Allowed values are 'Ephemeral' and 'Managed'. Defaults to 'Managed'. May not be changed after creation. - Possible values include: "Managed", "Ephemeral". + Known values are: "Managed", "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2020_09_01.models.OSDiskType :keyword vnet_subnet_id: VNet SubnetID specifies the VNet's subnet identifier. :paramtype vnet_subnet_id: str :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2020_09_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -2202,11 +2199,11 @@ def __init__( :paramtype min_count: int :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool - :keyword type: AgentPoolType represents types of an agent pool. Possible values include: + :keyword type: AgentPoolType represents types of an agent pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2020_09_01.models.AgentPoolType - :keyword mode: AgentPoolMode represents mode of an agent pool. Possible values include: - "System", "User". + :keyword mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", + "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2020_09_01.models.AgentPoolMode :keyword orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -2220,13 +2217,12 @@ def __init__( :keyword enable_node_public_ip: Enable public IP for nodes. :paramtype enable_node_public_ip: bool :keyword scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Possible values include: "Spot", "Regular". Default value: - "Regular". + priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_09_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction - policy for Spot virtual machine scale set. Default to Delete. Possible values include: - "Delete", "Deallocate". Default value: "Delete". + policy for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", + "Deallocate". Default value: "Delete". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_09_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: SpotMaxPrice to be used to specify the maximum price you are willing @@ -2284,7 +2280,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): range of 0 to 100 (inclusive) for user pools and in the range of 1 to 100 (inclusive) for system pools. The default value is 1. :vartype count: int - :ivar vm_size: Size of agent VMs. Possible values include: "Standard_A1", "Standard_A10", + :ivar vm_size: Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -2329,15 +2325,15 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): the vmSize specified. :vartype os_disk_size_gb: int :ivar os_disk_type: OS disk type to be used for machines in a given agent pool. Allowed values - are 'Ephemeral' and 'Managed'. Defaults to 'Managed'. May not be changed after creation. - Possible values include: "Managed", "Ephemeral". + are 'Ephemeral' and 'Managed'. Defaults to 'Managed'. May not be changed after creation. Known + values are: "Managed", "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2020_09_01.models.OSDiskType :ivar vnet_subnet_id: VNet SubnetID specifies the VNet's subnet identifier. :vartype vnet_subnet_id: str :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2020_09_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -2345,11 +2341,10 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :vartype min_count: int :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool - :ivar type: AgentPoolType represents types of an agent pool. Possible values include: + :ivar type: AgentPoolType represents types of an agent pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2020_09_01.models.AgentPoolType - :ivar mode: AgentPoolMode represents mode of an agent pool. Possible values include: "System", - "User". + :ivar mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", "User". :vartype mode: str or ~azure.mgmt.containerservice.v2020_09_01.models.AgentPoolMode :ivar orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -2370,12 +2365,11 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar enable_node_public_ip: Enable public IP for nodes. :vartype enable_node_public_ip: bool :ivar scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Possible values include: "Spot", "Regular". Default value: - "Regular". + priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_09_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy - for Spot virtual machine scale set. Default to Delete. Possible values include: "Delete", + for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", "Deallocate". Default value: "Delete". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_09_01.models.ScaleSetEvictionPolicy @@ -2441,23 +2435,23 @@ def __init__( *, name: str, count: Optional[int] = None, - vm_size: Optional[Union[str, "ContainerServiceVMSizeTypes"]] = None, + vm_size: Optional[Union[str, "_models.ContainerServiceVMSizeTypes"]] = None, os_disk_size_gb: Optional[int] = None, - os_disk_type: Optional[Union[str, "OSDiskType"]] = None, + os_disk_type: Optional[Union[str, "_models.OSDiskType"]] = None, vnet_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - type: Optional[Union[str, "AgentPoolType"]] = None, - mode: Optional[Union[str, "AgentPoolMode"]] = None, + type: Optional[Union[str, "_models.AgentPoolType"]] = None, + mode: Optional[Union[str, "_models.AgentPoolMode"]] = None, orchestrator_version: Optional[str] = None, - upgrade_settings: Optional["AgentPoolUpgradeSettings"] = None, + upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, - scale_set_priority: Optional[Union[str, "ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", spot_max_price: Optional[float] = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, @@ -2470,7 +2464,7 @@ def __init__( range of 0 to 100 (inclusive) for user pools and in the range of 1 to 100 (inclusive) for system pools. The default value is 1. :paramtype count: int - :keyword vm_size: Size of agent VMs. Possible values include: "Standard_A1", "Standard_A10", + :keyword vm_size: Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -2516,14 +2510,14 @@ def __init__( :paramtype os_disk_size_gb: int :keyword os_disk_type: OS disk type to be used for machines in a given agent pool. Allowed values are 'Ephemeral' and 'Managed'. Defaults to 'Managed'. May not be changed after creation. - Possible values include: "Managed", "Ephemeral". + Known values are: "Managed", "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2020_09_01.models.OSDiskType :keyword vnet_subnet_id: VNet SubnetID specifies the VNet's subnet identifier. :paramtype vnet_subnet_id: str :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2020_09_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -2531,11 +2525,11 @@ def __init__( :paramtype min_count: int :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool - :keyword type: AgentPoolType represents types of an agent pool. Possible values include: + :keyword type: AgentPoolType represents types of an agent pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2020_09_01.models.AgentPoolType - :keyword mode: AgentPoolMode represents mode of an agent pool. Possible values include: - "System", "User". + :keyword mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", + "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2020_09_01.models.AgentPoolMode :keyword orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -2549,13 +2543,12 @@ def __init__( :keyword enable_node_public_ip: Enable public IP for nodes. :paramtype enable_node_public_ip: bool :keyword scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Possible values include: "Spot", "Regular". Default value: - "Regular". + priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_09_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction - policy for Spot virtual machine scale set. Default to Delete. Possible values include: - "Delete", "Deallocate". Default value: "Delete". + policy for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", + "Deallocate". Default value: "Delete". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_09_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: SpotMaxPrice to be used to specify the maximum price you are willing @@ -2626,8 +2619,8 @@ class ManagedClusterIdentity(msrest.serialization.Model): :ivar type: The type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ resource group in agent nodes. Type 'None' will not use MSI for the managed cluster, - service principal will be used instead. Possible values include: "SystemAssigned", - "UserAssigned", "None". + service principal will be used instead. Known values are: "SystemAssigned", "UserAssigned", + "None". :vartype type: str or ~azure.mgmt.containerservice.v2020_09_01.models.ResourceIdentityType :ivar user_assigned_identities: The user identity associated with the managed cluster. This identity will be used in control plane and only one user assigned identity is allowed. The user @@ -2652,15 +2645,15 @@ class ManagedClusterIdentity(msrest.serialization.Model): def __init__( self, *, - type: Optional[Union[str, "ResourceIdentityType"]] = None, - user_assigned_identities: Optional[Dict[str, "ManagedClusterIdentityUserAssignedIdentitiesValue"]] = None, + type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, + user_assigned_identities: Optional[Dict[str, "_models.ManagedClusterIdentityUserAssignedIdentitiesValue"]] = None, **kwargs ): """ :keyword type: The type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ resource group in agent nodes. Type 'None' will not use MSI for the managed - cluster, service principal will be used instead. Possible values include: "SystemAssigned", + cluster, service principal will be used instead. Known values are: "SystemAssigned", "UserAssigned", "None". :paramtype type: str or ~azure.mgmt.containerservice.v2020_09_01.models.ResourceIdentityType :keyword user_assigned_identities: The user identity associated with the managed cluster. This @@ -2732,7 +2725,7 @@ class ManagedClusterListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["ManagedCluster"]] = None, + value: Optional[List["_models.ManagedCluster"]] = None, **kwargs ): """ @@ -2786,10 +2779,10 @@ class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): def __init__( self, *, - managed_outbound_i_ps: Optional["ManagedClusterLoadBalancerProfileManagedOutboundIPs"] = None, - outbound_ip_prefixes: Optional["ManagedClusterLoadBalancerProfileOutboundIPPrefixes"] = None, - outbound_i_ps: Optional["ManagedClusterLoadBalancerProfileOutboundIPs"] = None, - effective_outbound_i_ps: Optional[List["ResourceReference"]] = None, + managed_outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileManagedOutboundIPs"] = None, + outbound_ip_prefixes: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPPrefixes"] = None, + outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPs"] = None, + effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, allocated_outbound_ports: Optional[int] = 0, idle_timeout_in_minutes: Optional[int] = 30, **kwargs @@ -2872,7 +2865,7 @@ class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.M def __init__( self, *, - public_ip_prefixes: Optional[List["ResourceReference"]] = None, + public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, **kwargs ): """ @@ -2898,7 +2891,7 @@ class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): def __init__( self, *, - public_i_ps: Optional[List["ResourceReference"]] = None, + public_i_ps: Optional[List["_models.ResourceReference"]] = None, **kwargs ): """ @@ -2919,7 +2912,7 @@ class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): :ivar name: Pool name. :vartype name: str :ivar os_type: Required. OsType to be used to specify os type. Choose from Linux and Windows. - Default to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2020_09_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -2942,9 +2935,9 @@ def __init__( self, *, kubernetes_version: str, - os_type: Union[str, "OSType"] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", name: Optional[str] = None, - upgrades: Optional[List["ManagedClusterPoolUpgradeProfileUpgradesItem"]] = None, + upgrades: Optional[List["_models.ManagedClusterPoolUpgradeProfileUpgradesItem"]] = None, **kwargs ): """ @@ -2953,7 +2946,7 @@ def __init__( :keyword name: Pool name. :paramtype name: str :keyword os_type: Required. OsType to be used to specify os type. Choose from Linux and - Windows. Default to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Windows. Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2020_09_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: @@ -3003,7 +2996,7 @@ class ManagedClusterPropertiesAutoScalerProfile(msrest.serialization.Model): :ivar balance_similar_node_groups: :vartype balance_similar_node_groups: str - :ivar expander: Possible values include: "least-waste", "most-pods", "random". + :ivar expander: Known values are: "least-waste", "most-pods", "random". :vartype expander: str or ~azure.mgmt.containerservice.v2020_09_01.models.Expander :ivar max_empty_bulk_delete: :vartype max_empty_bulk_delete: str @@ -3058,7 +3051,7 @@ def __init__( self, *, balance_similar_node_groups: Optional[str] = None, - expander: Optional[Union[str, "Expander"]] = None, + expander: Optional[Union[str, "_models.Expander"]] = None, max_empty_bulk_delete: Optional[str] = None, max_graceful_termination_sec: Optional[str] = None, max_total_unready_percentage: Optional[str] = None, @@ -3078,7 +3071,7 @@ def __init__( """ :keyword balance_similar_node_groups: :paramtype balance_similar_node_groups: str - :keyword expander: Possible values include: "least-waste", "most-pods", "random". + :keyword expander: Known values are: "least-waste", "most-pods", "random". :paramtype expander: str or ~azure.mgmt.containerservice.v2020_09_01.models.Expander :keyword max_empty_bulk_delete: :paramtype max_empty_bulk_delete: str @@ -3205,9 +3198,9 @@ def __init__( class ManagedClusterSKU(msrest.serialization.Model): """ManagedClusterSKU. - :ivar name: Name of a managed cluster SKU. Possible values include: "Basic". + :ivar name: Name of a managed cluster SKU. Known values are: "Basic". :vartype name: str or ~azure.mgmt.containerservice.v2020_09_01.models.ManagedClusterSKUName - :ivar tier: Tier of a managed cluster SKU. Possible values include: "Paid", "Free". + :ivar tier: Tier of a managed cluster SKU. Known values are: "Paid", "Free". :vartype tier: str or ~azure.mgmt.containerservice.v2020_09_01.models.ManagedClusterSKUTier """ @@ -3219,14 +3212,14 @@ class ManagedClusterSKU(msrest.serialization.Model): def __init__( self, *, - name: Optional[Union[str, "ManagedClusterSKUName"]] = None, - tier: Optional[Union[str, "ManagedClusterSKUTier"]] = None, + name: Optional[Union[str, "_models.ManagedClusterSKUName"]] = None, + tier: Optional[Union[str, "_models.ManagedClusterSKUTier"]] = None, **kwargs ): """ - :keyword name: Name of a managed cluster SKU. Possible values include: "Basic". + :keyword name: Name of a managed cluster SKU. Known values are: "Basic". :paramtype name: str or ~azure.mgmt.containerservice.v2020_09_01.models.ManagedClusterSKUName - :keyword tier: Tier of a managed cluster SKU. Possible values include: "Paid", "Free". + :keyword tier: Tier of a managed cluster SKU. Known values are: "Paid", "Free". :paramtype tier: str or ~azure.mgmt.containerservice.v2020_09_01.models.ManagedClusterSKUTier """ super(ManagedClusterSKU, self).__init__(**kwargs) @@ -3275,8 +3268,8 @@ class ManagedClusterUpgradeProfile(msrest.serialization.Model): def __init__( self, *, - control_plane_profile: "ManagedClusterPoolUpgradeProfile", - agent_pool_profiles: List["ManagedClusterPoolUpgradeProfile"], + control_plane_profile: "_models.ManagedClusterPoolUpgradeProfile", + agent_pool_profiles: List["_models.ManagedClusterPoolUpgradeProfile"], **kwargs ): """ @@ -3318,7 +3311,7 @@ class ManagedClusterWindowsProfile(msrest.serialization.Model): "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!". :vartype admin_password: str :ivar license_type: 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". + Azure Hybrid User Benefits for Windows VMs. Known values are: "None", "Windows_Server". :vartype license_type: str or ~azure.mgmt.containerservice.v2020_09_01.models.LicenseType """ @@ -3337,7 +3330,7 @@ def __init__( *, admin_username: str, admin_password: Optional[str] = None, - license_type: Optional[Union[str, "LicenseType"]] = None, + license_type: Optional[Union[str, "_models.LicenseType"]] = None, **kwargs ): """ @@ -3358,7 +3351,7 @@ def __init__( "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!". :paramtype admin_password: str :keyword license_type: 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". + Azure Hybrid User Benefits for Windows VMs. Known values are: "None", "Windows_Server". :paramtype license_type: str or ~azure.mgmt.containerservice.v2020_09_01.models.LicenseType """ super(ManagedClusterWindowsProfile, self).__init__(**kwargs) @@ -3449,8 +3442,8 @@ def __init__( class PowerState(msrest.serialization.Model): """Describes the Power State of the cluster. - :ivar code: Tells whether the cluster is Running or Stopped. Possible values include: - "Running", "Stopped". + :ivar code: Tells whether the cluster is Running or Stopped. Known values are: "Running", + "Stopped". :vartype code: str or ~azure.mgmt.containerservice.v2020_09_01.models.Code """ @@ -3461,12 +3454,12 @@ class PowerState(msrest.serialization.Model): def __init__( self, *, - code: Optional[Union[str, "Code"]] = None, + code: Optional[Union[str, "_models.Code"]] = None, **kwargs ): """ - :keyword code: Tells whether the cluster is Running or Stopped. Possible values include: - "Running", "Stopped". + :keyword code: Tells whether the cluster is Running or Stopped. Known values are: "Running", + "Stopped". :paramtype code: str or ~azure.mgmt.containerservice.v2020_09_01.models.Code """ super(PowerState, self).__init__(**kwargs) @@ -3509,7 +3502,7 @@ class PrivateEndpointConnection(msrest.serialization.Model): :vartype name: str :ivar type: The resource type. :vartype type: str - :ivar provisioning_state: The current provisioning state. Possible values include: "Succeeded", + :ivar provisioning_state: The current provisioning state. Known values are: "Succeeded", "Creating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2020_09_01.models.PrivateEndpointConnectionProvisioningState @@ -3540,8 +3533,8 @@ class PrivateEndpointConnection(msrest.serialization.Model): def __init__( self, *, - private_endpoint: Optional["PrivateEndpoint"] = None, - private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, + private_endpoint: Optional["_models.PrivateEndpoint"] = None, + private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionState"] = None, **kwargs ): """ @@ -3575,7 +3568,7 @@ class PrivateEndpointConnectionListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["PrivateEndpointConnection"]] = None, + value: Optional[List["_models.PrivateEndpointConnection"]] = None, **kwargs ): """ @@ -3665,7 +3658,7 @@ class PrivateLinkResourcesListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["PrivateLinkResource"]] = None, + value: Optional[List["_models.PrivateLinkResource"]] = None, **kwargs ): """ @@ -3679,7 +3672,7 @@ def __init__( class PrivateLinkServiceConnectionState(msrest.serialization.Model): """The state of a private link service connection. - :ivar status: The private link service connection status. Possible values include: "Pending", + :ivar status: The private link service connection status. Known values are: "Pending", "Approved", "Rejected", "Disconnected". :vartype status: str or ~azure.mgmt.containerservice.v2020_09_01.models.ConnectionStatus :ivar description: The private link service connection description. @@ -3694,13 +3687,13 @@ class PrivateLinkServiceConnectionState(msrest.serialization.Model): def __init__( self, *, - status: Optional[Union[str, "ConnectionStatus"]] = None, + status: Optional[Union[str, "_models.ConnectionStatus"]] = None, description: Optional[str] = None, **kwargs ): """ - :keyword status: The private link service connection status. Possible values include: - "Pending", "Approved", "Rejected", "Disconnected". + :keyword status: The private link service connection status. Known values are: "Pending", + "Approved", "Rejected", "Disconnected". :paramtype status: str or ~azure.mgmt.containerservice.v2020_09_01.models.ConnectionStatus :keyword description: The private link service connection description. :paramtype description: str diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/models/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/models/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/operations/__init__.py index 653c03870023..eb76d54a688d 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/operations/__init__.py @@ -13,6 +13,9 @@ from ._private_link_resources_operations import PrivateLinkResourcesOperations from ._resolve_private_link_service_id_operations import ResolvePrivateLinkServiceIdOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'Operations', 'ManagedClustersOperations', @@ -21,3 +24,5 @@ 'PrivateLinkResourcesOperations', 'ResolvePrivateLinkServiceIdOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/operations/_agent_pools_operations.py index 90235ec21426..5e1f510fa0c8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/operations/_agent_pools_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -35,9 +35,12 @@ def build_list_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-09-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools") # pylint: disable=line-too-long path_format_arguments = { @@ -49,18 +52,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -72,9 +73,12 @@ def build_get_request( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-09-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -87,18 +91,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -109,14 +111,17 @@ def build_create_or_update_request_initial( resource_name: str, agent_pool_name: str, *, - json: JSONType = None, + json: Optional[_models.AgentPool] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-09-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -129,20 +134,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -156,9 +159,12 @@ def build_delete_request_initial( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-09-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -171,18 +177,16 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -194,9 +198,12 @@ def build_get_upgrade_profile_request( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-09-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default") # pylint: disable=line-too-long path_format_arguments = { @@ -209,18 +216,16 @@ def build_get_upgrade_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -231,9 +236,12 @@ def build_get_available_agent_pool_versions_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-09-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions") # pylint: disable=line-too-long path_format_arguments = { @@ -245,18 +253,16 @@ def build_get_available_agent_pool_versions_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -268,9 +274,12 @@ def build_upgrade_node_image_version_request_initial( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-09-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion") # pylint: disable=line-too-long path_format_arguments = { @@ -283,42 +292,38 @@ def build_upgrade_node_image_version_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class AgentPoolsOperations(object): - """AgentPoolsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class AgentPoolsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2020_09_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2020_09_01.ContainerServiceClient`'s + :attr:`agent_pools` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -326,7 +331,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Iterable["_models.AgentPoolListResult"]: + ) -> Iterable[_models.AgentPoolListResult]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. The operation returns properties @@ -342,13 +347,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_09_01.models.AgentPoolListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-09-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -358,9 +366,11 @@ def prepare_request(next_link=None): resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -370,9 +380,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -412,7 +424,7 @@ def get( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPool": + ) -> _models.AgentPool: """Gets the agent pool. Gets the details of the agent pool by managed cluster and resource group. @@ -428,13 +440,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2020_09_01.models.AgentPool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-09-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] request = build_get_request( @@ -444,11 +459,13 @@ def get( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -474,17 +491,20 @@ def _create_or_update_initial( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> "_models.AgentPool": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] + ) -> _models.AgentPool: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-09-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] _json = self._serialize.body(parameters, 'AgentPool') @@ -497,11 +517,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -532,9 +554,9 @@ def begin_create_or_update( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> LROPoller["_models.AgentPool"]: + ) -> LROPoller[_models.AgentPool]: """Creates or updates an agent pool. Creates or updates an agent pool in the specified managed cluster. @@ -560,17 +582,20 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_09_01.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-09-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, @@ -578,20 +603,27 @@ def begin_create_or_update( 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): - response = pipeline_response.http_response deserialized = self._deserialize('AgentPool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -611,13 +643,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements agent_pool_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-09-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -627,11 +662,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -678,21 +715,26 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-09-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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) @@ -702,8 +744,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -723,7 +771,7 @@ def get_upgrade_profile( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPoolUpgradeProfile": + ) -> _models.AgentPoolUpgradeProfile: """Gets upgrade profile for an agent pool. Gets the details of the upgrade profile for an agent pool with a specified resource group and @@ -740,13 +788,16 @@ def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2020_09_01.models.AgentPoolUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-09-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] request = build_get_upgrade_profile_request( @@ -756,11 +807,13 @@ def get_upgrade_profile( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -787,7 +840,7 @@ def get_available_agent_pool_versions( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.AgentPoolAvailableVersions": + ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported versions for the specified agent pool. Gets a list of supported versions for the specified agent pool. @@ -801,13 +854,16 @@ def get_available_agent_pool_versions( :rtype: ~azure.mgmt.containerservice.v2020_09_01.models.AgentPoolAvailableVersions :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolAvailableVersions"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-09-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] request = build_get_available_agent_pool_versions_request( @@ -816,11 +872,13 @@ def get_available_agent_pool_versions( resource_name=resource_name, api_version=api_version, template_url=self.get_available_agent_pool_versions.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -847,14 +905,17 @@ def _upgrade_node_image_version_initial( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> Optional["_models.AgentPool"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.AgentPool"]] + ) -> Optional[_models.AgentPool]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-09-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] request = build_upgrade_node_image_version_request_initial( @@ -864,11 +925,13 @@ def _upgrade_node_image_version_initial( agent_pool_name=agent_pool_name, api_version=api_version, template_url=self._upgrade_node_image_version_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -898,7 +961,7 @@ def begin_upgrade_node_image_version( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> LROPoller["_models.AgentPool"]: + ) -> LROPoller[_models.AgentPool]: """Upgrade node image version of an agent pool to the latest. Upgrade node image version of an agent pool to the latest. @@ -922,35 +985,45 @@ def begin_upgrade_node_image_version( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_09_01.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-09-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._upgrade_node_image_version_initial( + raw_result = self._upgrade_node_image_version_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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): - response = pipeline_response.http_response deserialized = self._deserialize('AgentPool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/operations/_managed_clusters_operations.py index 42fa9162380c..568aaaef0364 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/operations/_managed_clusters_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -33,9 +33,12 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-09-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters") path_format_arguments = { @@ -45,18 +48,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -66,9 +67,12 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-09-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters") # pylint: disable=line-too-long path_format_arguments = { @@ -79,18 +83,16 @@ def build_list_by_resource_group_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -101,9 +103,12 @@ def build_get_upgrade_profile_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-09-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default") # pylint: disable=line-too-long path_format_arguments = { @@ -115,18 +120,16 @@ def build_get_upgrade_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -138,9 +141,12 @@ def build_get_access_profile_request( role_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-09-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -153,18 +159,16 @@ def build_get_access_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -175,9 +179,12 @@ def build_list_cluster_admin_credentials_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-09-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -189,18 +196,16 @@ def build_list_cluster_admin_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -211,9 +216,12 @@ def build_list_cluster_user_credentials_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-09-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -225,18 +233,16 @@ def build_list_cluster_user_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -247,9 +253,12 @@ def build_list_cluster_monitoring_user_credentials_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-09-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -261,18 +270,16 @@ def build_list_cluster_monitoring_user_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -283,9 +290,12 @@ def build_get_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-09-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -297,18 +307,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -318,14 +326,17 @@ def build_create_or_update_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedCluster] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-09-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -337,20 +348,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -362,14 +371,17 @@ def build_update_tags_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.TagsObject] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-09-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -381,20 +393,18 @@ def build_update_tags_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -407,9 +417,12 @@ def build_delete_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-09-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -421,18 +434,16 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -442,14 +453,17 @@ def build_reset_service_principal_profile_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedClusterServicePrincipalProfile] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-09-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile") # pylint: disable=line-too-long path_format_arguments = { @@ -461,20 +475,18 @@ def build_reset_service_principal_profile_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -486,14 +498,17 @@ def build_reset_aad_profile_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedClusterAADProfile] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-09-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile") # pylint: disable=line-too-long path_format_arguments = { @@ -505,20 +520,18 @@ def build_reset_aad_profile_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -531,9 +544,12 @@ def build_rotate_cluster_certificates_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-09-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates") # pylint: disable=line-too-long path_format_arguments = { @@ -545,18 +561,16 @@ def build_rotate_cluster_certificates_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -567,9 +581,12 @@ def build_stop_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-09-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop") # pylint: disable=line-too-long path_format_arguments = { @@ -581,18 +598,16 @@ def build_stop_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -603,9 +618,12 @@ def build_start_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-09-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start") # pylint: disable=line-too-long path_format_arguments = { @@ -617,48 +635,44 @@ def build_start_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class ManagedClustersOperations(object): # pylint: disable=too-many-public-methods - """ManagedClustersOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ManagedClustersOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2020_09_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2020_09_01.ContainerServiceClient`'s + :attr:`managed_clusters` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> Iterable["_models.ManagedClusterListResult"]: + ) -> Iterable[_models.ManagedClusterListResult]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. The operation returns properties @@ -671,13 +685,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_09_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-09-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -685,9 +702,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -695,9 +714,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -735,7 +756,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.ManagedClusterListResult"]: + ) -> Iterable[_models.ManagedClusterListResult]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. The operation returns @@ -750,13 +771,16 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_09_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-09-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -765,9 +789,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -776,9 +802,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -817,7 +845,7 @@ def get_upgrade_profile( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedClusterUpgradeProfile": + ) -> _models.ManagedClusterUpgradeProfile: """Gets upgrade profile for a managed cluster. Gets the details of the upgrade profile for a managed cluster with a specified resource group @@ -832,13 +860,16 @@ def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2020_09_01.models.ManagedClusterUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-09-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] request = build_get_upgrade_profile_request( @@ -847,11 +878,13 @@ def get_upgrade_profile( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -879,7 +912,7 @@ def get_access_profile( resource_name: str, role_name: str, **kwargs: Any - ) -> "_models.ManagedClusterAccessProfile": + ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. Gets the accessProfile for the specified role name of the managed cluster with a specified @@ -900,13 +933,16 @@ def get_access_profile( :rtype: ~azure.mgmt.containerservice.v2020_09_01.models.ManagedClusterAccessProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterAccessProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-09-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] request = build_get_access_profile_request( @@ -916,11 +952,13 @@ def get_access_profile( role_name=role_name, api_version=api_version, template_url=self.get_access_profile.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -947,7 +985,7 @@ def list_cluster_admin_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster admin credential of a managed cluster. Gets cluster admin credential of the managed cluster with a specified resource group and name. @@ -961,13 +999,16 @@ def list_cluster_admin_credentials( :rtype: ~azure.mgmt.containerservice.v2020_09_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-09-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_admin_credentials_request( @@ -976,11 +1017,13 @@ def list_cluster_admin_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_admin_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1007,7 +1050,7 @@ def list_cluster_user_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster user credential of a managed cluster. Gets cluster user credential of the managed cluster with a specified resource group and name. @@ -1021,13 +1064,16 @@ def list_cluster_user_credentials( :rtype: ~azure.mgmt.containerservice.v2020_09_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-09-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_user_credentials_request( @@ -1036,11 +1082,13 @@ def list_cluster_user_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1067,7 +1115,7 @@ def list_cluster_monitoring_user_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster monitoring user credential of a managed cluster. Gets cluster monitoring user credential of the managed cluster with a specified resource group @@ -1082,13 +1130,16 @@ def list_cluster_monitoring_user_credentials( :rtype: ~azure.mgmt.containerservice.v2020_09_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-09-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_monitoring_user_credentials_request( @@ -1097,11 +1148,13 @@ def list_cluster_monitoring_user_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1128,7 +1181,7 @@ def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedCluster": + ) -> _models.ManagedCluster: """Gets a managed cluster. Gets the details of the managed cluster with a specified resource group and name. @@ -1142,13 +1195,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2020_09_01.models.ManagedCluster :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-09-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] request = build_get_request( @@ -1157,11 +1213,13 @@ def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1186,17 +1244,20 @@ def _create_or_update_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-09-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'ManagedCluster') @@ -1208,11 +1269,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1242,9 +1305,9 @@ def begin_create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> LROPoller["_models.ManagedCluster"]: + ) -> LROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. Creates or updates a managed cluster with the specified configuration for agents and Kubernetes @@ -1270,37 +1333,47 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_09_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-09-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1317,17 +1390,20 @@ def _update_tags_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-09-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'TagsObject') @@ -1339,11 +1415,13 @@ def _update_tags_initial( content_type=content_type, json=_json, template_url=self._update_tags_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1369,9 +1447,9 @@ def begin_update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> LROPoller["_models.ManagedCluster"]: + ) -> LROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates a managed cluster with the specified tags. @@ -1396,37 +1474,47 @@ def begin_update_tags( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_09_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-09-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._update_tags_initial( + raw_result = self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1445,13 +1533,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-09-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -1460,11 +1551,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1508,20 +1601,25 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-09-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_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) @@ -1531,8 +1629,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1549,17 +1653,20 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2020-09-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') @@ -1571,11 +1678,13 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re content_type=content_type, json=_json, template_url=self._reset_service_principal_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1597,7 +1706,7 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> LROPoller[None]: """Reset Service Principal Profile of a managed cluster. @@ -1624,23 +1733,28 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-09-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._reset_service_principal_profile_initial( + raw_result = self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1650,8 +1764,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1668,17 +1788,20 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-09-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') @@ -1690,11 +1813,13 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement content_type=content_type, json=_json, template_url=self._reset_aad_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1716,7 +1841,7 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> LROPoller[None]: """Reset AAD Profile of a managed cluster. @@ -1742,23 +1867,28 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-09-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._reset_aad_profile_initial( + raw_result = self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1768,8 +1898,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1788,13 +1924,16 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-09-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_rotate_cluster_certificates_request_initial( @@ -1803,11 +1942,13 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return resource_name=resource_name, api_version=api_version, template_url=self._rotate_cluster_certificates_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1851,20 +1992,25 @@ def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-st :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-09-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._rotate_cluster_certificates_initial( + raw_result = self._rotate_cluster_certificates_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) @@ -1874,8 +2020,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1894,13 +2046,16 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-09-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_stop_request_initial( @@ -1909,11 +2064,13 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_name, api_version=api_version, template_url=self._stop_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1957,20 +2114,25 @@ def begin_stop( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-09-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._stop_initial( + raw_result = self._stop_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) @@ -1980,8 +2142,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2000,13 +2168,16 @@ def _start_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-09-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_start_request_initial( @@ -2015,11 +2186,13 @@ def _start_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_name, api_version=api_version, template_url=self._start_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2063,20 +2236,25 @@ def begin_start( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-09-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._start_initial( + raw_result = self._start_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) @@ -2086,8 +2264,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/operations/_operations.py index 058bfd92a874..6fd09a9df09d 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/operations/_operations.py @@ -16,6 +16,7 @@ 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 @@ -29,55 +30,54 @@ def build_list_request( **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-09-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.ContainerService/operations") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class Operations(object): - """Operations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2020_09_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2020_09_01.ContainerServiceClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> Iterable["_models.OperationListResult"]: + ) -> Iterable[_models.OperationListResult]: """Gets a list of compute operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -86,31 +86,38 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_09_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-09-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/operations/_private_endpoint_connections_operations.py index 6c0935f492e9..cf02deff8bcb 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/operations/_private_endpoint_connections_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast from msrest import Serializer @@ -16,13 +16,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -34,9 +34,12 @@ def build_list_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-09-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections") # pylint: disable=line-too-long path_format_arguments = { @@ -48,18 +51,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -71,9 +72,12 @@ def build_get_request( private_endpoint_connection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-09-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -86,18 +90,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -108,14 +110,17 @@ def build_update_request( resource_name: str, private_endpoint_connection_name: str, *, - json: JSONType = None, + json: Optional[_models.PrivateEndpointConnection] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-09-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -128,20 +133,18 @@ def build_update_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -155,9 +158,12 @@ def build_delete_request_initial( private_endpoint_connection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-09-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -170,42 +176,38 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class PrivateEndpointConnectionsOperations(object): - """PrivateEndpointConnectionsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class PrivateEndpointConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2020_09_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2020_09_01.ContainerServiceClient`'s + :attr:`private_endpoint_connections` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -213,7 +215,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnectionListResult": + ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. Gets a list of private endpoint connections in the specified managed cluster. The operation @@ -228,13 +230,16 @@ def list( :rtype: ~azure.mgmt.containerservice.v2020_09_01.models.PrivateEndpointConnectionListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-09-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] request = build_list_request( @@ -243,11 +248,13 @@ def list( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -275,7 +282,7 @@ def get( resource_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Gets the private endpoint connection. Gets the details of the private endpoint connection by managed cluster and resource group. @@ -291,13 +298,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2020_09_01.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-09-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] request = build_get_request( @@ -307,11 +317,13 @@ def get( private_endpoint_connection_name=private_endpoint_connection_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -338,9 +350,9 @@ def update( resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - parameters: "_models.PrivateEndpointConnection", + parameters: _models.PrivateEndpointConnection, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. Updates a private endpoint connection in the specified managed cluster. @@ -358,14 +370,17 @@ def update( :rtype: ~azure.mgmt.containerservice.v2020_09_01.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-09-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] _json = self._serialize.body(parameters, 'PrivateEndpointConnection') @@ -378,11 +393,13 @@ def update( content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -410,13 +427,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-09-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -426,11 +446,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name=private_endpoint_connection_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -477,21 +499,26 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-09-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -501,8 +528,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/operations/_private_link_resources_operations.py index 95e2d4a880ba..f31e3cc4497f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/operations/_private_link_resources_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/operations/_private_link_resources_operations.py @@ -15,6 +15,7 @@ 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 @@ -31,9 +32,12 @@ def build_list_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-09-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources") # pylint: disable=line-too-long path_format_arguments = { @@ -45,42 +49,38 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class PrivateLinkResourcesOperations(object): - """PrivateLinkResourcesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class PrivateLinkResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2020_09_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2020_09_01.ContainerServiceClient`'s + :attr:`private_link_resources` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -88,7 +88,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.PrivateLinkResourcesListResult": + ) -> _models.PrivateLinkResourcesListResult: """Gets a list of private link resources in the specified managed cluster. Gets a list of private link resources in the specified managed cluster. The operation returns @@ -103,13 +103,16 @@ def list( :rtype: ~azure.mgmt.containerservice.v2020_09_01.models.PrivateLinkResourcesListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourcesListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-09-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] request = build_list_request( @@ -118,11 +121,13 @@ def list( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/operations/_resolve_private_link_service_id_operations.py index b41d44eb467d..fbe88eeffcda 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/operations/_resolve_private_link_service_id_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_09_01/operations/_resolve_private_link_service_id_operations.py @@ -15,12 +15,12 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -31,14 +31,17 @@ def build_post_request( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.PrivateLinkResource] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-09-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId") # pylint: disable=line-too-long path_format_arguments = { @@ -50,55 +53,51 @@ def build_post_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs ) -class ResolvePrivateLinkServiceIdOperations(object): - """ResolvePrivateLinkServiceIdOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ResolvePrivateLinkServiceIdOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2020_09_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2020_09_01.ContainerServiceClient`'s + :attr:`resolve_private_link_service_id` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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 post( self, resource_group_name: str, resource_name: str, - parameters: "_models.PrivateLinkResource", + parameters: _models.PrivateLinkResource, **kwargs: Any - ) -> "_models.PrivateLinkResource": + ) -> _models.PrivateLinkResource: """Gets the private link service ID for the specified managed cluster. Gets the private link service ID the specified managed cluster. @@ -115,14 +114,17 @@ def post( :rtype: ~azure.mgmt.containerservice.v2020_09_01.models.PrivateLinkResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2020-09-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] _json = self._serialize.body(parameters, 'PrivateLinkResource') @@ -134,11 +136,13 @@ def post( content_type=content_type, json=_json, template_url=self.post.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/__init__.py index 53c675bd95e2..37a5f9e02e6f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._container_service_client import ContainerServiceClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['ContainerServiceClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/_container_service_client.py index 42df62738cf2..ea8bfb2a321e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/_container_service_client.py @@ -69,12 +69,24 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.managed_clusters = ManagedClustersOperations(self._client, self._config, self._serialize, self._deserialize) - self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) - self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_clusters = ManagedClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.agent_pools = AgentPoolsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/aio/__init__.py index 53c675bd95e2..37a5f9e02e6f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/aio/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/aio/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._container_service_client import ContainerServiceClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['ContainerServiceClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/aio/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/aio/_container_service_client.py index 2f7095daac25..30f0b9dadd72 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/aio/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/aio/_container_service_client.py @@ -70,12 +70,24 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.managed_clusters = ManagedClustersOperations(self._client, self._config, self._serialize, self._deserialize) - self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) - self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_clusters = ManagedClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.agent_pools = AgentPoolsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/aio/operations/__init__.py index 653c03870023..eb76d54a688d 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/aio/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/aio/operations/__init__.py @@ -13,6 +13,9 @@ from ._private_link_resources_operations import PrivateLinkResourcesOperations from ._resolve_private_link_service_id_operations import ResolvePrivateLinkServiceIdOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'Operations', 'ManagedClustersOperations', @@ -21,3 +24,5 @@ 'PrivateLinkResourcesOperations', 'ResolvePrivateLinkServiceIdOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/aio/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/aio/operations/_agent_pools_operations.py index 09f6b2111c86..8ee57914f1ff 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/aio/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/aio/operations/_agent_pools_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. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ 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 @@ -26,26 +27,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class AgentPoolsOperations: - """AgentPoolsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2020_11_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2020_11_01.aio.ContainerServiceClient`'s + :attr:`agent_pools` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -53,7 +52,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> AsyncIterable["_models.AgentPoolListResult"]: + ) -> AsyncIterable[_models.AgentPoolListResult]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. The operation returns properties @@ -69,13 +68,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_11_01.models.AgentPoolListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-11-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -85,9 +87,11 @@ def prepare_request(next_link=None): resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -97,9 +101,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -139,7 +145,7 @@ async def get( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPool": + ) -> _models.AgentPool: """Gets the agent pool. Gets the details of the agent pool by managed cluster and resource group. @@ -155,13 +161,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2020_11_01.models.AgentPool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-11-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] request = build_get_request( @@ -171,11 +180,13 @@ async def get( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -201,17 +212,20 @@ async def _create_or_update_initial( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> "_models.AgentPool": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] + ) -> _models.AgentPool: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2020-11-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] _json = self._serialize.body(parameters, 'AgentPool') @@ -224,11 +238,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -259,9 +275,9 @@ async def begin_create_or_update( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> AsyncLROPoller["_models.AgentPool"]: + ) -> AsyncLROPoller[_models.AgentPool]: """Creates or updates an agent pool. Creates or updates an agent pool in the specified managed cluster. @@ -288,17 +304,20 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_11_01.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-11-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, @@ -306,20 +325,27 @@ async def begin_create_or_update( 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): - response = pipeline_response.http_response deserialized = self._deserialize('AgentPool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -339,13 +365,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements agent_pool_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-11-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -355,11 +384,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -406,21 +437,26 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-11-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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) @@ -430,8 +466,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -451,7 +493,7 @@ async def get_upgrade_profile( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPoolUpgradeProfile": + ) -> _models.AgentPoolUpgradeProfile: """Gets upgrade profile for an agent pool. Gets the details of the upgrade profile for an agent pool with a specified resource group and @@ -468,13 +510,16 @@ async def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2020_11_01.models.AgentPoolUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-11-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] request = build_get_upgrade_profile_request( @@ -484,11 +529,13 @@ async def get_upgrade_profile( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -515,7 +562,7 @@ async def get_available_agent_pool_versions( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.AgentPoolAvailableVersions": + ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported versions for the specified agent pool. Gets a list of supported versions for the specified agent pool. @@ -529,13 +576,16 @@ async def get_available_agent_pool_versions( :rtype: ~azure.mgmt.containerservice.v2020_11_01.models.AgentPoolAvailableVersions :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolAvailableVersions"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-11-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] request = build_get_available_agent_pool_versions_request( @@ -544,11 +594,13 @@ async def get_available_agent_pool_versions( resource_name=resource_name, api_version=api_version, template_url=self.get_available_agent_pool_versions.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -575,14 +627,17 @@ async def _upgrade_node_image_version_initial( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> Optional["_models.AgentPool"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.AgentPool"]] + ) -> Optional[_models.AgentPool]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-11-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] request = build_upgrade_node_image_version_request_initial( @@ -592,11 +647,13 @@ async def _upgrade_node_image_version_initial( agent_pool_name=agent_pool_name, api_version=api_version, template_url=self._upgrade_node_image_version_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -626,7 +683,7 @@ async def begin_upgrade_node_image_version( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> AsyncLROPoller["_models.AgentPool"]: + ) -> AsyncLROPoller[_models.AgentPool]: """Upgrade node image version of an agent pool to the latest. Upgrade node image version of an agent pool to the latest. @@ -651,35 +708,45 @@ async def begin_upgrade_node_image_version( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_11_01.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-11-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._upgrade_node_image_version_initial( + raw_result = await self._upgrade_node_image_version_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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): - response = pipeline_response.http_response deserialized = self._deserialize('AgentPool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/aio/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/aio/operations/_managed_clusters_operations.py index e72bb85f8de4..9d727cd7b5d7 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/aio/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/aio/operations/_managed_clusters_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. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ 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 @@ -26,32 +27,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ManagedClustersOperations: # pylint: disable=too-many-public-methods - """ManagedClustersOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2020_11_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2020_11_01.aio.ContainerServiceClient`'s + :attr:`managed_clusters` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.ManagedClusterListResult"]: + ) -> AsyncIterable[_models.ManagedClusterListResult]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. The operation returns properties @@ -64,13 +63,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_11_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-11-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -78,9 +80,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -88,9 +92,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -128,7 +134,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ManagedClusterListResult"]: + ) -> AsyncIterable[_models.ManagedClusterListResult]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. The operation returns @@ -143,13 +149,16 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_11_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-11-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -158,9 +167,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -169,9 +180,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -210,7 +223,7 @@ async def get_upgrade_profile( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedClusterUpgradeProfile": + ) -> _models.ManagedClusterUpgradeProfile: """Gets upgrade profile for a managed cluster. Gets the details of the upgrade profile for a managed cluster with a specified resource group @@ -225,13 +238,16 @@ async def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2020_11_01.models.ManagedClusterUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-11-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] request = build_get_upgrade_profile_request( @@ -240,11 +256,13 @@ async def get_upgrade_profile( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -272,7 +290,7 @@ async def get_access_profile( resource_name: str, role_name: str, **kwargs: Any - ) -> "_models.ManagedClusterAccessProfile": + ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. Gets the accessProfile for the specified role name of the managed cluster with a specified @@ -293,13 +311,16 @@ async def get_access_profile( :rtype: ~azure.mgmt.containerservice.v2020_11_01.models.ManagedClusterAccessProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterAccessProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-11-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] request = build_get_access_profile_request( @@ -309,11 +330,13 @@ async def get_access_profile( role_name=role_name, api_version=api_version, template_url=self.get_access_profile.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -340,7 +363,7 @@ async def list_cluster_admin_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster admin credential of a managed cluster. Gets cluster admin credential of the managed cluster with a specified resource group and name. @@ -354,13 +377,16 @@ async def list_cluster_admin_credentials( :rtype: ~azure.mgmt.containerservice.v2020_11_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-11-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_admin_credentials_request( @@ -369,11 +395,13 @@ async def list_cluster_admin_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_admin_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -400,7 +428,7 @@ async def list_cluster_user_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster user credential of a managed cluster. Gets cluster user credential of the managed cluster with a specified resource group and name. @@ -414,13 +442,16 @@ async def list_cluster_user_credentials( :rtype: ~azure.mgmt.containerservice.v2020_11_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-11-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_user_credentials_request( @@ -429,11 +460,13 @@ async def list_cluster_user_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -460,7 +493,7 @@ async def list_cluster_monitoring_user_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster monitoring user credential of a managed cluster. Gets cluster monitoring user credential of the managed cluster with a specified resource group @@ -475,13 +508,16 @@ async def list_cluster_monitoring_user_credentials( :rtype: ~azure.mgmt.containerservice.v2020_11_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-11-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_monitoring_user_credentials_request( @@ -490,11 +526,13 @@ async def list_cluster_monitoring_user_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -521,7 +559,7 @@ async def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedCluster": + ) -> _models.ManagedCluster: """Gets a managed cluster. Gets the details of the managed cluster with a specified resource group and name. @@ -535,13 +573,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2020_11_01.models.ManagedCluster :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-11-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] request = build_get_request( @@ -550,11 +591,13 @@ async def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -579,17 +622,20 @@ async def _create_or_update_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2020-11-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'ManagedCluster') @@ -601,11 +647,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -635,9 +683,9 @@ async def begin_create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> AsyncLROPoller["_models.ManagedCluster"]: + ) -> AsyncLROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. Creates or updates a managed cluster with the specified configuration for agents and Kubernetes @@ -663,37 +711,47 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_11_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-11-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -710,17 +768,20 @@ async def _update_tags_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2020-11-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'TagsObject') @@ -732,11 +793,13 @@ async def _update_tags_initial( content_type=content_type, json=_json, template_url=self._update_tags_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -762,9 +825,9 @@ async def begin_update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> AsyncLROPoller["_models.ManagedCluster"]: + ) -> AsyncLROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates a managed cluster with the specified tags. @@ -789,37 +852,47 @@ async def begin_update_tags( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_11_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-11-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._update_tags_initial( + raw_result = await self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -838,13 +911,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-11-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -853,11 +929,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -901,20 +979,25 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-11-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_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) @@ -924,8 +1007,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -942,17 +1031,20 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-11-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') @@ -964,11 +1056,13 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist content_type=content_type, json=_json, template_url=self._reset_service_principal_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -990,7 +1084,7 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> AsyncLROPoller[None]: """Reset Service Principal Profile of a managed cluster. @@ -1017,23 +1111,28 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-11-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._reset_service_principal_profile_initial( + raw_result = await self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1043,8 +1142,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1061,17 +1166,20 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-11-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') @@ -1083,11 +1191,13 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta content_type=content_type, json=_json, template_url=self._reset_aad_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1109,7 +1219,7 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> AsyncLROPoller[None]: """Reset AAD Profile of a managed cluster. @@ -1135,23 +1245,28 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-11-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._reset_aad_profile_initial( + raw_result = await self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1161,8 +1276,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1181,13 +1302,16 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-11-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_rotate_cluster_certificates_request_initial( @@ -1196,11 +1320,13 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- resource_name=resource_name, api_version=api_version, template_url=self._rotate_cluster_certificates_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1244,20 +1370,25 @@ async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-ret :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-11-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._rotate_cluster_certificates_initial( + raw_result = await self._rotate_cluster_certificates_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) @@ -1267,8 +1398,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1287,13 +1424,16 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-11-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_stop_request_initial( @@ -1302,11 +1442,13 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_name, api_version=api_version, template_url=self._stop_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1350,20 +1492,25 @@ async def begin_stop( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-11-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._stop_initial( + raw_result = await self._stop_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) @@ -1373,8 +1520,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1393,13 +1546,16 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-11-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_start_request_initial( @@ -1408,11 +1564,13 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_name, api_version=api_version, template_url=self._start_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1456,20 +1614,25 @@ async def begin_start( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-11-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._start_initial( + raw_result = await self._start_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) @@ -1479,8 +1642,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/aio/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/aio/operations/_operations.py index c9e290193489..833db596b9b3 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/aio/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/aio/operations/_operations.py @@ -14,6 +14,7 @@ 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 @@ -23,32 +24,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class Operations: - """Operations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2020_11_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2020_11_01.aio.ContainerServiceClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.OperationListResult"]: + ) -> AsyncIterable[_models.OperationListResult]: """Gets a list of compute operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -57,31 +56,38 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_11_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-11-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/aio/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/aio/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/aio/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/aio/operations/_private_endpoint_connections_operations.py index b7b4d8d654ed..8019d0d4876a 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/aio/operations/_private_endpoint_connections_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -14,6 +14,7 @@ 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 @@ -24,26 +25,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class PrivateEndpointConnectionsOperations: - """PrivateEndpointConnectionsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2020_11_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2020_11_01.aio.ContainerServiceClient`'s + :attr:`private_endpoint_connections` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -51,7 +50,7 @@ async def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnectionListResult": + ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. Gets a list of private endpoint connections in the specified managed cluster. The operation @@ -66,13 +65,16 @@ async def list( :rtype: ~azure.mgmt.containerservice.v2020_11_01.models.PrivateEndpointConnectionListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-11-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] request = build_list_request( @@ -81,11 +83,13 @@ async def list( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -113,7 +117,7 @@ async def get( resource_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Gets the private endpoint connection. Gets the details of the private endpoint connection by managed cluster and resource group. @@ -129,13 +133,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2020_11_01.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-11-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] request = build_get_request( @@ -145,11 +152,13 @@ async def get( private_endpoint_connection_name=private_endpoint_connection_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -176,9 +185,9 @@ async def update( resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - parameters: "_models.PrivateEndpointConnection", + parameters: _models.PrivateEndpointConnection, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. Updates a private endpoint connection in the specified managed cluster. @@ -196,14 +205,17 @@ async def update( :rtype: ~azure.mgmt.containerservice.v2020_11_01.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2020-11-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] _json = self._serialize.body(parameters, 'PrivateEndpointConnection') @@ -216,11 +228,13 @@ async def update( content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -248,13 +262,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-11-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -264,11 +281,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name=private_endpoint_connection_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -315,21 +334,26 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-11-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -339,8 +363,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/aio/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/aio/operations/_private_link_resources_operations.py index 0b8d5eb37552..66037b98cc9f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/aio/operations/_private_link_resources_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/aio/operations/_private_link_resources_operations.py @@ -13,6 +13,7 @@ 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 @@ -22,26 +23,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class PrivateLinkResourcesOperations: - """PrivateLinkResourcesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2020_11_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2020_11_01.aio.ContainerServiceClient`'s + :attr:`private_link_resources` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -49,7 +48,7 @@ async def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.PrivateLinkResourcesListResult": + ) -> _models.PrivateLinkResourcesListResult: """Gets a list of private link resources in the specified managed cluster. Gets a list of private link resources in the specified managed cluster. The operation returns @@ -64,13 +63,16 @@ async def list( :rtype: ~azure.mgmt.containerservice.v2020_11_01.models.PrivateLinkResourcesListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourcesListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-11-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] request = build_list_request( @@ -79,11 +81,13 @@ async def list( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/aio/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/aio/operations/_resolve_private_link_service_id_operations.py index be809cb9c260..23f1958ae8ae 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/aio/operations/_resolve_private_link_service_id_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/aio/operations/_resolve_private_link_service_id_operations.py @@ -13,6 +13,7 @@ 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 @@ -22,35 +23,33 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ResolvePrivateLinkServiceIdOperations: - """ResolvePrivateLinkServiceIdOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2020_11_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2020_11_01.aio.ContainerServiceClient`'s + :attr:`resolve_private_link_service_id` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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 post( self, resource_group_name: str, resource_name: str, - parameters: "_models.PrivateLinkResource", + parameters: _models.PrivateLinkResource, **kwargs: Any - ) -> "_models.PrivateLinkResource": + ) -> _models.PrivateLinkResource: """Gets the private link service ID for the specified managed cluster. Gets the private link service ID the specified managed cluster. @@ -67,14 +66,17 @@ async def post( :rtype: ~azure.mgmt.containerservice.v2020_11_01.models.PrivateLinkResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2020-11-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] _json = self._serialize.body(parameters, 'PrivateLinkResource') @@ -86,11 +88,13 @@ async def post( content_type=content_type, json=_json, template_url=self.post.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/models/__init__.py index a12fd51d8174..92aee945b85a 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/models/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/models/__init__.py @@ -98,7 +98,9 @@ ScaleSetPriority, UpgradeChannel, ) - +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'AgentPool', 'AgentPoolAvailableVersions', @@ -189,3 +191,5 @@ 'ScaleSetPriority', 'UpgradeChannel', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/models/_container_service_client_enums.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/models/_container_service_client_enums.py index c3452f896bfa..8594b1e58606 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/models/_container_service_client_enums.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/models/_container_service_client_enums.py @@ -7,32 +7,31 @@ # -------------------------------------------------------------------------- from enum import Enum -from six import with_metaclass from azure.core import CaseInsensitiveEnumMeta -class AgentPoolMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class AgentPoolMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """AgentPoolMode represents mode of an agent pool. """ SYSTEM = "System" USER = "User" -class AgentPoolType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class AgentPoolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """AgentPoolType represents types of an agent pool. """ VIRTUAL_MACHINE_SCALE_SETS = "VirtualMachineScaleSets" AVAILABILITY_SET = "AvailabilitySet" -class Code(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class Code(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Tells whether the cluster is Running or Stopped """ RUNNING = "Running" STOPPED = "Stopped" -class ConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The private link service connection status. """ @@ -41,7 +40,7 @@ class ConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): REJECTED = "Rejected" DISCONNECTED = "Disconnected" -class ContainerServiceStorageProfileTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the orchestrator choice. """ @@ -49,7 +48,7 @@ class ContainerServiceStorageProfileTypes(with_metaclass(CaseInsensitiveEnumMeta STORAGE_ACCOUNT = "StorageAccount" MANAGED_DISKS = "ManagedDisks" -class ContainerServiceVMSizeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Size of agent VMs. """ @@ -228,7 +227,7 @@ class ContainerServiceVMSizeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, E STANDARD_NV24 = "Standard_NV24" STANDARD_NV6 = "Standard_NV6" -class Count(with_metaclass(CaseInsensitiveEnumMeta, int, Enum)): +class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): """Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, and 5. The default value is 1. """ @@ -237,13 +236,13 @@ class Count(with_metaclass(CaseInsensitiveEnumMeta, int, Enum)): THREE = 3 FIVE = 5 -class Expander(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class Expander(str, Enum, metaclass=CaseInsensitiveEnumMeta): LEAST_WASTE = "least-waste" MOST_PODS = "most-pods" RANDOM = "random" -class LicenseType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class LicenseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The licenseType to use for Windows VMs. Windows_Server is used to enable Azure Hybrid User Benefits for Windows VMs. """ @@ -251,14 +250,14 @@ class LicenseType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): NONE = "None" WINDOWS_SERVER = "Windows_Server" -class LoadBalancerSku(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class LoadBalancerSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The load balancer sku for the managed cluster. """ STANDARD = "standard" BASIC = "basic" -class ManagedClusterPodIdentityProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ManagedClusterPodIdentityProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The current provisioning state of the pod identity. """ @@ -267,62 +266,62 @@ class ManagedClusterPodIdentityProvisioningState(with_metaclass(CaseInsensitiveE DELETING = "Deleting" FAILED = "Failed" -class ManagedClusterSKUName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ManagedClusterSKUName(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Name of a managed cluster SKU. """ BASIC = "Basic" -class ManagedClusterSKUTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ManagedClusterSKUTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Tier of a managed cluster SKU. """ PAID = "Paid" FREE = "Free" -class NetworkMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Network mode used for building Kubernetes network. """ TRANSPARENT = "transparent" BRIDGE = "bridge" -class NetworkPlugin(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkPlugin(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Network plugin used for building Kubernetes network. """ AZURE = "azure" KUBENET = "kubenet" -class NetworkPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Network policy used for building Kubernetes network. """ CALICO = "calico" AZURE = "azure" -class OSDiskType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OSDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """OSDiskType represents the type of an OS disk on an agent pool. """ MANAGED = "Managed" EPHEMERAL = "Ephemeral" -class OSType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux. """ LINUX = "Linux" WINDOWS = "Windows" -class OutboundType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OutboundType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The outbound (egress) routing method. """ LOAD_BALANCER = "loadBalancer" USER_DEFINED_ROUTING = "userDefinedRouting" -class PrivateEndpointConnectionProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class PrivateEndpointConnectionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The current provisioning state. """ @@ -331,7 +330,7 @@ class PrivateEndpointConnectionProvisioningState(with_metaclass(CaseInsensitiveE DELETING = "Deleting" FAILED = "Failed" -class ResourceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ resource group in agent nodes. Type 'None' will not use MSI for the managed cluster, service @@ -342,7 +341,7 @@ class ResourceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): USER_ASSIGNED = "UserAssigned" NONE = "None" -class ScaleSetEvictionPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ScaleSetEvictionPolicy to be used to specify eviction policy for Spot virtual machine scale set. Default to Delete. """ @@ -350,14 +349,14 @@ class ScaleSetEvictionPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)) DELETE = "Delete" DEALLOCATE = "Deallocate" -class ScaleSetPriority(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ScaleSetPriority(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ScaleSetPriority to be used to specify virtual machine scale set priority. Default to regular. """ SPOT = "Spot" REGULAR = "Regular" -class UpgradeChannel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class UpgradeChannel(str, Enum, metaclass=CaseInsensitiveEnumMeta): """upgrade channel for auto upgrade. """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/models/_models_py3.py index 7438ca7e2022..b071690b509a 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/models/_models_py3.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/models/_models_py3.py @@ -6,11 +6,13 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Dict, List, Optional, Union +from typing import Dict, List, Optional, TYPE_CHECKING, Union import msrest.serialization -from ._container_service_client_enums import * +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + import __init__ as _models class SubResource(msrest.serialization.Model): @@ -67,7 +69,7 @@ class AgentPool(SubResource): range of 0 to 100 (inclusive) for user pools and in the range of 1 to 100 (inclusive) for system pools. The default value is 1. :vartype count: int - :ivar vm_size: Size of agent VMs. Possible values include: "Standard_A1", "Standard_A10", + :ivar vm_size: Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -114,8 +116,7 @@ class AgentPool(SubResource): :ivar os_disk_type: OS disk type to be used for machines in a given agent pool. Allowed values are 'Ephemeral' and 'Managed'. If unspecified, defaults to 'Ephemeral' when the VM supports ephemeral OS and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults - to 'Managed'. May not be changed after creation. Possible values include: "Managed", - "Ephemeral". + to 'Managed'. May not be changed after creation. Known values are: "Managed", "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2020_11_01.models.OSDiskType :ivar vnet_subnet_id: VNet SubnetID specifies the VNet's subnet identifier for nodes and maybe pods. @@ -125,7 +126,7 @@ class AgentPool(SubResource): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2020_11_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -133,12 +134,11 @@ class AgentPool(SubResource): :vartype min_count: int :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool - :ivar type_properties_type: AgentPoolType represents types of an agent pool. Possible values - include: "VirtualMachineScaleSets", "AvailabilitySet". + :ivar type_properties_type: AgentPoolType represents types of an agent pool. Known values are: + "VirtualMachineScaleSets", "AvailabilitySet". :vartype type_properties_type: str or ~azure.mgmt.containerservice.v2020_11_01.models.AgentPoolType - :ivar mode: AgentPoolMode represents mode of an agent pool. Possible values include: "System", - "User". + :ivar mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", "User". :vartype mode: str or ~azure.mgmt.containerservice.v2020_11_01.models.AgentPoolMode :ivar orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -159,12 +159,11 @@ class AgentPool(SubResource): :ivar enable_node_public_ip: Enable public IP for nodes. :vartype enable_node_public_ip: bool :ivar scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Possible values include: "Spot", "Regular". Default value: - "Regular". + priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_11_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy - for Spot virtual machine scale set. Default to Delete. Possible values include: "Delete", + for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", "Deallocate". Default value: "Delete". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_11_01.models.ScaleSetEvictionPolicy @@ -237,31 +236,31 @@ def __init__( self, *, count: Optional[int] = None, - vm_size: Optional[Union[str, "ContainerServiceVMSizeTypes"]] = None, + vm_size: Optional[Union[str, "_models.ContainerServiceVMSizeTypes"]] = None, os_disk_size_gb: Optional[int] = None, - os_disk_type: Optional[Union[str, "OSDiskType"]] = None, + os_disk_type: Optional[Union[str, "_models.OSDiskType"]] = None, vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - type_properties_type: Optional[Union[str, "AgentPoolType"]] = None, - mode: Optional[Union[str, "AgentPoolMode"]] = None, + type_properties_type: Optional[Union[str, "_models.AgentPoolType"]] = None, + mode: Optional[Union[str, "_models.AgentPoolMode"]] = None, orchestrator_version: Optional[str] = None, - upgrade_settings: Optional["AgentPoolUpgradeSettings"] = None, + upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, - scale_set_priority: Optional[Union[str, "ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", spot_max_price: Optional[float] = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, proximity_placement_group_id: Optional[str] = None, - kubelet_config: Optional["KubeletConfig"] = None, - linux_os_config: Optional["LinuxOSConfig"] = None, + kubelet_config: Optional["_models.KubeletConfig"] = None, + linux_os_config: Optional["_models.LinuxOSConfig"] = None, **kwargs ): """ @@ -269,7 +268,7 @@ def __init__( range of 0 to 100 (inclusive) for user pools and in the range of 1 to 100 (inclusive) for system pools. The default value is 1. :paramtype count: int - :keyword vm_size: Size of agent VMs. Possible values include: "Standard_A1", "Standard_A10", + :keyword vm_size: Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -316,7 +315,7 @@ def __init__( :keyword os_disk_type: OS disk type to be used for machines in a given agent pool. Allowed values are 'Ephemeral' and 'Managed'. If unspecified, defaults to 'Ephemeral' when the VM supports ephemeral OS and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, - defaults to 'Managed'. May not be changed after creation. Possible values include: "Managed", + defaults to 'Managed'. May not be changed after creation. Known values are: "Managed", "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2020_11_01.models.OSDiskType :keyword vnet_subnet_id: VNet SubnetID specifies the VNet's subnet identifier for nodes and @@ -327,7 +326,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2020_11_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -335,12 +334,12 @@ def __init__( :paramtype min_count: int :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool - :keyword type_properties_type: AgentPoolType represents types of an agent pool. Possible values - include: "VirtualMachineScaleSets", "AvailabilitySet". + :keyword type_properties_type: AgentPoolType represents types of an agent pool. Known values + are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type_properties_type: str or ~azure.mgmt.containerservice.v2020_11_01.models.AgentPoolType - :keyword mode: AgentPoolMode represents mode of an agent pool. Possible values include: - "System", "User". + :keyword mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", + "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2020_11_01.models.AgentPoolMode :keyword orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -354,13 +353,12 @@ def __init__( :keyword enable_node_public_ip: Enable public IP for nodes. :paramtype enable_node_public_ip: bool :keyword scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Possible values include: "Spot", "Regular". Default value: - "Regular". + priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_11_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction - policy for Spot virtual machine scale set. Default to Delete. Possible values include: - "Delete", "Deallocate". Default value: "Delete". + policy for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", + "Deallocate". Default value: "Delete". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_11_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: SpotMaxPrice to be used to specify the maximum price you are willing @@ -446,7 +444,7 @@ class AgentPoolAvailableVersions(msrest.serialization.Model): def __init__( self, *, - agent_pool_versions: Optional[List["AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem"]] = None, + agent_pool_versions: Optional[List["_models.AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem"]] = None, **kwargs ): """ @@ -523,7 +521,7 @@ class AgentPoolListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["AgentPool"]] = None, + value: Optional[List["_models.AgentPool"]] = None, **kwargs ): """ @@ -551,7 +549,7 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): :ivar kubernetes_version: Required. Kubernetes version (major, minor, patch). :vartype kubernetes_version: str :ivar os_type: Required. OsType to be used to specify os type. Choose from Linux and Windows. - Default to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2020_11_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -583,8 +581,8 @@ def __init__( self, *, kubernetes_version: str, - os_type: Union[str, "OSType"] = "Linux", - upgrades: Optional[List["AgentPoolUpgradeProfilePropertiesUpgradesItem"]] = None, + os_type: Union[str, "_models.OSType"] = "Linux", + upgrades: Optional[List["_models.AgentPoolUpgradeProfilePropertiesUpgradesItem"]] = None, latest_node_image_version: Optional[str] = None, **kwargs ): @@ -592,7 +590,7 @@ def __init__( :keyword kubernetes_version: Required. Kubernetes version (major, minor, patch). :paramtype kubernetes_version: str :keyword os_type: Required. OsType to be used to specify os type. Choose from Linux and - Windows. Default to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Windows. Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2020_11_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: @@ -684,7 +682,7 @@ class CloudError(msrest.serialization.Model): def __init__( self, *, - error: Optional["CloudErrorBody"] = None, + error: Optional["_models.CloudErrorBody"] = None, **kwargs ): """ @@ -724,7 +722,7 @@ def __init__( code: Optional[str] = None, message: Optional[str] = None, target: Optional[str] = None, - details: Optional[List["CloudErrorBody"]] = None, + details: Optional[List["_models.CloudErrorBody"]] = None, **kwargs ): """ @@ -856,25 +854,25 @@ class Components1Q1Og48SchemasManagedclusterAllof1(msrest.serialization.Model): def __init__( self, *, - identity: Optional["ManagedClusterIdentity"] = None, + identity: Optional["_models.ManagedClusterIdentity"] = None, kubernetes_version: Optional[str] = None, dns_prefix: Optional[str] = None, - agent_pool_profiles: Optional[List["ManagedClusterAgentPoolProfile"]] = None, - linux_profile: Optional["ContainerServiceLinuxProfile"] = None, - windows_profile: Optional["ManagedClusterWindowsProfile"] = None, - service_principal_profile: Optional["ManagedClusterServicePrincipalProfile"] = None, - addon_profiles: Optional[Dict[str, "ManagedClusterAddonProfile"]] = None, - pod_identity_profile: Optional["ManagedClusterPodIdentityProfile"] = None, + agent_pool_profiles: Optional[List["_models.ManagedClusterAgentPoolProfile"]] = None, + linux_profile: Optional["_models.ContainerServiceLinuxProfile"] = None, + windows_profile: Optional["_models.ManagedClusterWindowsProfile"] = None, + service_principal_profile: Optional["_models.ManagedClusterServicePrincipalProfile"] = None, + addon_profiles: Optional[Dict[str, "_models.ManagedClusterAddonProfile"]] = None, + pod_identity_profile: Optional["_models.ManagedClusterPodIdentityProfile"] = None, node_resource_group: Optional[str] = None, enable_rbac: Optional[bool] = None, enable_pod_security_policy: Optional[bool] = None, - network_profile: Optional["ContainerServiceNetworkProfile"] = None, - aad_profile: Optional["ManagedClusterAADProfile"] = None, - auto_upgrade_profile: Optional["ManagedClusterAutoUpgradeProfile"] = None, - auto_scaler_profile: Optional["ManagedClusterPropertiesAutoScalerProfile"] = None, - api_server_access_profile: Optional["ManagedClusterAPIServerAccessProfile"] = None, + network_profile: Optional["_models.ContainerServiceNetworkProfile"] = None, + aad_profile: Optional["_models.ManagedClusterAADProfile"] = None, + auto_upgrade_profile: Optional["_models.ManagedClusterAutoUpgradeProfile"] = None, + auto_scaler_profile: Optional["_models.ManagedClusterPropertiesAutoScalerProfile"] = None, + api_server_access_profile: Optional["_models.ManagedClusterAPIServerAccessProfile"] = None, disk_encryption_set_id: Optional[str] = None, - identity_profile: Optional[Dict[str, "ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties"]] = None, + identity_profile: Optional[Dict[str, "_models.ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties"]] = None, **kwargs ): """ @@ -1088,7 +1086,7 @@ class ContainerServiceDiagnosticsProfile(msrest.serialization.Model): def __init__( self, *, - vm_diagnostics: "ContainerServiceVMDiagnostics", + vm_diagnostics: "_models.ContainerServiceVMDiagnostics", **kwargs ): """ @@ -1125,7 +1123,7 @@ def __init__( self, *, admin_username: str, - ssh: "ContainerServiceSshConfiguration", + ssh: "_models.ContainerServiceSshConfiguration", **kwargs ): """ @@ -1148,17 +1146,17 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar count: Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, - and 5. The default value is 1. Possible values include: 1, 3, 5. Default value: "1". + and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". :vartype count: int or ~azure.mgmt.containerservice.v2020_11_01.models.Count :ivar dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. :vartype dns_prefix: str - :ivar vm_size: Required. Size of agent VMs. Possible values include: "Standard_A1", - "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", - "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", - "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", - "Standard_A8m_v2", "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", - "Standard_B8ms", "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", - "Standard_D12", "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", + :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", + "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", + "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", + "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", "Standard_B8ms", + "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", "Standard_D12", + "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", "Standard_D13_v2_Promo", "Standard_D14", "Standard_D14_v2", "Standard_D14_v2_Promo", "Standard_D15_v2", "Standard_D16_v3", "Standard_D16s_v3", "Standard_D1_v2", "Standard_D2", "Standard_D2_v2", "Standard_D2_v2_Promo", "Standard_D2_v3", "Standard_D2s_v3", "Standard_D3", @@ -1203,7 +1201,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): :vartype first_consecutive_static_ip: str :ivar storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Possible values include: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". :vartype storage_profile: str or ~azure.mgmt.containerservice.v2020_11_01.models.ContainerServiceStorageProfileTypes :ivar fqdn: FQDN for the master pool. @@ -1232,27 +1230,27 @@ def __init__( self, *, dns_prefix: str, - vm_size: Union[str, "ContainerServiceVMSizeTypes"], - count: Optional[Union[int, "Count"]] = 1, + vm_size: Union[str, "_models.ContainerServiceVMSizeTypes"], + count: Optional[Union[int, "_models.Count"]] = 1, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, first_consecutive_static_ip: Optional[str] = "10.240.255.5", - storage_profile: Optional[Union[str, "ContainerServiceStorageProfileTypes"]] = None, + storage_profile: Optional[Union[str, "_models.ContainerServiceStorageProfileTypes"]] = None, **kwargs ): """ :keyword count: Number of masters (VMs) in the container service cluster. Allowed values are 1, - 3, and 5. The default value is 1. Possible values include: 1, 3, 5. Default value: "1". + 3, and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". :paramtype count: int or ~azure.mgmt.containerservice.v2020_11_01.models.Count :keyword dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. :paramtype dns_prefix: str - :keyword vm_size: Required. Size of agent VMs. Possible values include: "Standard_A1", - "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", - "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", - "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", - "Standard_A8m_v2", "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", - "Standard_B8ms", "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", - "Standard_D12", "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", + :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", + "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", + "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", + "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", "Standard_B8ms", + "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", "Standard_D12", + "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", "Standard_D13_v2_Promo", "Standard_D14", "Standard_D14_v2", "Standard_D14_v2_Promo", "Standard_D15_v2", "Standard_D16_v3", "Standard_D16s_v3", "Standard_D1_v2", "Standard_D2", "Standard_D2_v2", "Standard_D2_v2_Promo", "Standard_D2_v3", "Standard_D2s_v3", "Standard_D3", @@ -1297,7 +1295,7 @@ def __init__( :paramtype first_consecutive_static_ip: str :keyword storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Possible values include: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". :paramtype storage_profile: str or ~azure.mgmt.containerservice.v2020_11_01.models.ContainerServiceStorageProfileTypes """ @@ -1315,13 +1313,13 @@ def __init__( class ContainerServiceNetworkProfile(msrest.serialization.Model): """Profile of network configuration. - :ivar network_plugin: Network plugin used for building Kubernetes network. Possible values - include: "azure", "kubenet". Default value: "kubenet". + :ivar network_plugin: Network plugin used for building Kubernetes network. Known values are: + "azure", "kubenet". Default value: "kubenet". :vartype network_plugin: str or ~azure.mgmt.containerservice.v2020_11_01.models.NetworkPlugin - :ivar network_policy: Network policy used for building Kubernetes network. Possible values - include: "calico", "azure". + :ivar network_policy: Network policy used for building Kubernetes network. Known values are: + "calico", "azure". :vartype network_policy: str or ~azure.mgmt.containerservice.v2020_11_01.models.NetworkPolicy - :ivar network_mode: Network mode used for building Kubernetes network. Possible values include: + :ivar network_mode: Network mode used for building Kubernetes network. Known values are: "transparent", "bridge". :vartype network_mode: str or ~azure.mgmt.containerservice.v2020_11_01.models.NetworkMode :ivar pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. @@ -1335,11 +1333,11 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): :ivar docker_bridge_cidr: A CIDR notation IP range assigned to the Docker bridge network. It must not overlap with any Subnet IP ranges or the Kubernetes service address range. :vartype docker_bridge_cidr: str - :ivar outbound_type: The outbound (egress) routing method. Possible values include: - "loadBalancer", "userDefinedRouting". Default value: "loadBalancer". + :ivar outbound_type: The outbound (egress) routing method. Known values are: "loadBalancer", + "userDefinedRouting". Default value: "loadBalancer". :vartype outbound_type: str or ~azure.mgmt.containerservice.v2020_11_01.models.OutboundType - :ivar load_balancer_sku: The load balancer sku for the managed cluster. Possible values - include: "standard", "basic". + :ivar load_balancer_sku: The load balancer sku for the managed cluster. Known values are: + "standard", "basic". :vartype load_balancer_sku: str or ~azure.mgmt.containerservice.v2020_11_01.models.LoadBalancerSku :ivar load_balancer_profile: Profile of the cluster load balancer. @@ -1370,27 +1368,27 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): def __init__( self, *, - network_plugin: Optional[Union[str, "NetworkPlugin"]] = "kubenet", - network_policy: Optional[Union[str, "NetworkPolicy"]] = None, - network_mode: Optional[Union[str, "NetworkMode"]] = None, + network_plugin: Optional[Union[str, "_models.NetworkPlugin"]] = "kubenet", + network_policy: Optional[Union[str, "_models.NetworkPolicy"]] = None, + network_mode: Optional[Union[str, "_models.NetworkMode"]] = None, pod_cidr: Optional[str] = "10.244.0.0/16", service_cidr: Optional[str] = "10.0.0.0/16", dns_service_ip: Optional[str] = "10.0.0.10", docker_bridge_cidr: Optional[str] = "172.17.0.1/16", - outbound_type: Optional[Union[str, "OutboundType"]] = "loadBalancer", - load_balancer_sku: Optional[Union[str, "LoadBalancerSku"]] = None, - load_balancer_profile: Optional["ManagedClusterLoadBalancerProfile"] = None, + outbound_type: Optional[Union[str, "_models.OutboundType"]] = "loadBalancer", + load_balancer_sku: Optional[Union[str, "_models.LoadBalancerSku"]] = None, + load_balancer_profile: Optional["_models.ManagedClusterLoadBalancerProfile"] = None, **kwargs ): """ - :keyword network_plugin: Network plugin used for building Kubernetes network. Possible values - include: "azure", "kubenet". Default value: "kubenet". + :keyword network_plugin: Network plugin used for building Kubernetes network. Known values are: + "azure", "kubenet". Default value: "kubenet". :paramtype network_plugin: str or ~azure.mgmt.containerservice.v2020_11_01.models.NetworkPlugin - :keyword network_policy: Network policy used for building Kubernetes network. Possible values - include: "calico", "azure". + :keyword network_policy: Network policy used for building Kubernetes network. Known values are: + "calico", "azure". :paramtype network_policy: str or ~azure.mgmt.containerservice.v2020_11_01.models.NetworkPolicy - :keyword network_mode: Network mode used for building Kubernetes network. Possible values - include: "transparent", "bridge". + :keyword network_mode: Network mode used for building Kubernetes network. Known values are: + "transparent", "bridge". :paramtype network_mode: str or ~azure.mgmt.containerservice.v2020_11_01.models.NetworkMode :keyword pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :paramtype pod_cidr: str @@ -1403,11 +1401,11 @@ def __init__( :keyword docker_bridge_cidr: A CIDR notation IP range assigned to the Docker bridge network. It must not overlap with any Subnet IP ranges or the Kubernetes service address range. :paramtype docker_bridge_cidr: str - :keyword outbound_type: The outbound (egress) routing method. Possible values include: - "loadBalancer", "userDefinedRouting". Default value: "loadBalancer". + :keyword outbound_type: The outbound (egress) routing method. Known values are: "loadBalancer", + "userDefinedRouting". Default value: "loadBalancer". :paramtype outbound_type: str or ~azure.mgmt.containerservice.v2020_11_01.models.OutboundType - :keyword load_balancer_sku: The load balancer sku for the managed cluster. Possible values - include: "standard", "basic". + :keyword load_balancer_sku: The load balancer sku for the managed cluster. Known values are: + "standard", "basic". :paramtype load_balancer_sku: str or ~azure.mgmt.containerservice.v2020_11_01.models.LoadBalancerSku :keyword load_balancer_profile: Profile of the cluster load balancer. @@ -1449,7 +1447,7 @@ class ContainerServiceSshConfiguration(msrest.serialization.Model): def __init__( self, *, - public_keys: List["ContainerServiceSshPublicKey"], + public_keys: List["_models.ContainerServiceSshPublicKey"], **kwargs ): """ @@ -1699,7 +1697,7 @@ class LinuxOSConfig(msrest.serialization.Model): def __init__( self, *, - sysctls: Optional["SysctlConfig"] = None, + sysctls: Optional["_models.SysctlConfig"] = None, transparent_huge_page_enabled: Optional[str] = None, transparent_huge_page_defrag: Optional[str] = None, swap_file_size_mb: Optional[int] = None, @@ -1912,27 +1910,27 @@ def __init__( self, *, location: str, - identity: Optional["ManagedClusterIdentity"] = None, + identity: Optional["_models.ManagedClusterIdentity"] = None, kubernetes_version: Optional[str] = None, dns_prefix: Optional[str] = None, - agent_pool_profiles: Optional[List["ManagedClusterAgentPoolProfile"]] = None, - linux_profile: Optional["ContainerServiceLinuxProfile"] = None, - windows_profile: Optional["ManagedClusterWindowsProfile"] = None, - service_principal_profile: Optional["ManagedClusterServicePrincipalProfile"] = None, - addon_profiles: Optional[Dict[str, "ManagedClusterAddonProfile"]] = None, - pod_identity_profile: Optional["ManagedClusterPodIdentityProfile"] = None, + agent_pool_profiles: Optional[List["_models.ManagedClusterAgentPoolProfile"]] = None, + linux_profile: Optional["_models.ContainerServiceLinuxProfile"] = None, + windows_profile: Optional["_models.ManagedClusterWindowsProfile"] = None, + service_principal_profile: Optional["_models.ManagedClusterServicePrincipalProfile"] = None, + addon_profiles: Optional[Dict[str, "_models.ManagedClusterAddonProfile"]] = None, + pod_identity_profile: Optional["_models.ManagedClusterPodIdentityProfile"] = None, node_resource_group: Optional[str] = None, enable_rbac: Optional[bool] = None, enable_pod_security_policy: Optional[bool] = None, - network_profile: Optional["ContainerServiceNetworkProfile"] = None, - aad_profile: Optional["ManagedClusterAADProfile"] = None, - auto_upgrade_profile: Optional["ManagedClusterAutoUpgradeProfile"] = None, - auto_scaler_profile: Optional["ManagedClusterPropertiesAutoScalerProfile"] = None, - api_server_access_profile: Optional["ManagedClusterAPIServerAccessProfile"] = None, + network_profile: Optional["_models.ContainerServiceNetworkProfile"] = None, + aad_profile: Optional["_models.ManagedClusterAADProfile"] = None, + auto_upgrade_profile: Optional["_models.ManagedClusterAutoUpgradeProfile"] = None, + auto_scaler_profile: Optional["_models.ManagedClusterPropertiesAutoScalerProfile"] = None, + api_server_access_profile: Optional["_models.ManagedClusterAPIServerAccessProfile"] = None, disk_encryption_set_id: Optional[str] = None, - identity_profile: Optional[Dict[str, "ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties"]] = None, + identity_profile: Optional[Dict[str, "_models.ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties"]] = None, tags: Optional[Dict[str, str]] = None, - sku: Optional["ManagedClusterSKU"] = None, + sku: Optional["_models.ManagedClusterSKU"] = None, **kwargs ): """ @@ -2248,7 +2246,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): range of 0 to 100 (inclusive) for user pools and in the range of 1 to 100 (inclusive) for system pools. The default value is 1. :vartype count: int - :ivar vm_size: Size of agent VMs. Possible values include: "Standard_A1", "Standard_A10", + :ivar vm_size: Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -2295,8 +2293,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar os_disk_type: OS disk type to be used for machines in a given agent pool. Allowed values are 'Ephemeral' and 'Managed'. If unspecified, defaults to 'Ephemeral' when the VM supports ephemeral OS and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults - to 'Managed'. May not be changed after creation. Possible values include: "Managed", - "Ephemeral". + to 'Managed'. May not be changed after creation. Known values are: "Managed", "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2020_11_01.models.OSDiskType :ivar vnet_subnet_id: VNet SubnetID specifies the VNet's subnet identifier for nodes and maybe pods. @@ -2306,7 +2303,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2020_11_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -2314,11 +2311,10 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :vartype min_count: int :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool - :ivar type: AgentPoolType represents types of an agent pool. Possible values include: + :ivar type: AgentPoolType represents types of an agent pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2020_11_01.models.AgentPoolType - :ivar mode: AgentPoolMode represents mode of an agent pool. Possible values include: "System", - "User". + :ivar mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", "User". :vartype mode: str or ~azure.mgmt.containerservice.v2020_11_01.models.AgentPoolMode :ivar orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -2339,12 +2335,11 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar enable_node_public_ip: Enable public IP for nodes. :vartype enable_node_public_ip: bool :ivar scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Possible values include: "Spot", "Regular". Default value: - "Regular". + priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_11_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy - for Spot virtual machine scale set. Default to Delete. Possible values include: "Delete", + for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", "Deallocate". Default value: "Delete". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_11_01.models.ScaleSetEvictionPolicy @@ -2411,31 +2406,31 @@ def __init__( self, *, count: Optional[int] = None, - vm_size: Optional[Union[str, "ContainerServiceVMSizeTypes"]] = None, + vm_size: Optional[Union[str, "_models.ContainerServiceVMSizeTypes"]] = None, os_disk_size_gb: Optional[int] = None, - os_disk_type: Optional[Union[str, "OSDiskType"]] = None, + os_disk_type: Optional[Union[str, "_models.OSDiskType"]] = None, vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - type: Optional[Union[str, "AgentPoolType"]] = None, - mode: Optional[Union[str, "AgentPoolMode"]] = None, + type: Optional[Union[str, "_models.AgentPoolType"]] = None, + mode: Optional[Union[str, "_models.AgentPoolMode"]] = None, orchestrator_version: Optional[str] = None, - upgrade_settings: Optional["AgentPoolUpgradeSettings"] = None, + upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, - scale_set_priority: Optional[Union[str, "ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", spot_max_price: Optional[float] = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, proximity_placement_group_id: Optional[str] = None, - kubelet_config: Optional["KubeletConfig"] = None, - linux_os_config: Optional["LinuxOSConfig"] = None, + kubelet_config: Optional["_models.KubeletConfig"] = None, + linux_os_config: Optional["_models.LinuxOSConfig"] = None, **kwargs ): """ @@ -2443,7 +2438,7 @@ def __init__( range of 0 to 100 (inclusive) for user pools and in the range of 1 to 100 (inclusive) for system pools. The default value is 1. :paramtype count: int - :keyword vm_size: Size of agent VMs. Possible values include: "Standard_A1", "Standard_A10", + :keyword vm_size: Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -2490,7 +2485,7 @@ def __init__( :keyword os_disk_type: OS disk type to be used for machines in a given agent pool. Allowed values are 'Ephemeral' and 'Managed'. If unspecified, defaults to 'Ephemeral' when the VM supports ephemeral OS and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, - defaults to 'Managed'. May not be changed after creation. Possible values include: "Managed", + defaults to 'Managed'. May not be changed after creation. Known values are: "Managed", "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2020_11_01.models.OSDiskType :keyword vnet_subnet_id: VNet SubnetID specifies the VNet's subnet identifier for nodes and @@ -2501,7 +2496,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2020_11_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -2509,11 +2504,11 @@ def __init__( :paramtype min_count: int :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool - :keyword type: AgentPoolType represents types of an agent pool. Possible values include: + :keyword type: AgentPoolType represents types of an agent pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2020_11_01.models.AgentPoolType - :keyword mode: AgentPoolMode represents mode of an agent pool. Possible values include: - "System", "User". + :keyword mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", + "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2020_11_01.models.AgentPoolMode :keyword orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -2527,13 +2522,12 @@ def __init__( :keyword enable_node_public_ip: Enable public IP for nodes. :paramtype enable_node_public_ip: bool :keyword scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Possible values include: "Spot", "Regular". Default value: - "Regular". + priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_11_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction - policy for Spot virtual machine scale set. Default to Delete. Possible values include: - "Delete", "Deallocate". Default value: "Delete". + policy for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", + "Deallocate". Default value: "Delete". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_11_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: SpotMaxPrice to be used to specify the maximum price you are willing @@ -2598,7 +2592,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): range of 0 to 100 (inclusive) for user pools and in the range of 1 to 100 (inclusive) for system pools. The default value is 1. :vartype count: int - :ivar vm_size: Size of agent VMs. Possible values include: "Standard_A1", "Standard_A10", + :ivar vm_size: Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -2645,8 +2639,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar os_disk_type: OS disk type to be used for machines in a given agent pool. Allowed values are 'Ephemeral' and 'Managed'. If unspecified, defaults to 'Ephemeral' when the VM supports ephemeral OS and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults - to 'Managed'. May not be changed after creation. Possible values include: "Managed", - "Ephemeral". + to 'Managed'. May not be changed after creation. Known values are: "Managed", "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2020_11_01.models.OSDiskType :ivar vnet_subnet_id: VNet SubnetID specifies the VNet's subnet identifier for nodes and maybe pods. @@ -2656,7 +2649,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2020_11_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -2664,11 +2657,10 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :vartype min_count: int :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool - :ivar type: AgentPoolType represents types of an agent pool. Possible values include: + :ivar type: AgentPoolType represents types of an agent pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2020_11_01.models.AgentPoolType - :ivar mode: AgentPoolMode represents mode of an agent pool. Possible values include: "System", - "User". + :ivar mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", "User". :vartype mode: str or ~azure.mgmt.containerservice.v2020_11_01.models.AgentPoolMode :ivar orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -2689,12 +2681,11 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar enable_node_public_ip: Enable public IP for nodes. :vartype enable_node_public_ip: bool :ivar scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Possible values include: "Spot", "Regular". Default value: - "Regular". + priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_11_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy - for Spot virtual machine scale set. Default to Delete. Possible values include: "Delete", + for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", "Deallocate". Default value: "Delete". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_11_01.models.ScaleSetEvictionPolicy @@ -2767,31 +2758,31 @@ def __init__( *, name: str, count: Optional[int] = None, - vm_size: Optional[Union[str, "ContainerServiceVMSizeTypes"]] = None, + vm_size: Optional[Union[str, "_models.ContainerServiceVMSizeTypes"]] = None, os_disk_size_gb: Optional[int] = None, - os_disk_type: Optional[Union[str, "OSDiskType"]] = None, + os_disk_type: Optional[Union[str, "_models.OSDiskType"]] = None, vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - type: Optional[Union[str, "AgentPoolType"]] = None, - mode: Optional[Union[str, "AgentPoolMode"]] = None, + type: Optional[Union[str, "_models.AgentPoolType"]] = None, + mode: Optional[Union[str, "_models.AgentPoolMode"]] = None, orchestrator_version: Optional[str] = None, - upgrade_settings: Optional["AgentPoolUpgradeSettings"] = None, + upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, - scale_set_priority: Optional[Union[str, "ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", spot_max_price: Optional[float] = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, proximity_placement_group_id: Optional[str] = None, - kubelet_config: Optional["KubeletConfig"] = None, - linux_os_config: Optional["LinuxOSConfig"] = None, + kubelet_config: Optional["_models.KubeletConfig"] = None, + linux_os_config: Optional["_models.LinuxOSConfig"] = None, **kwargs ): """ @@ -2799,7 +2790,7 @@ def __init__( range of 0 to 100 (inclusive) for user pools and in the range of 1 to 100 (inclusive) for system pools. The default value is 1. :paramtype count: int - :keyword vm_size: Size of agent VMs. Possible values include: "Standard_A1", "Standard_A10", + :keyword vm_size: Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -2846,7 +2837,7 @@ def __init__( :keyword os_disk_type: OS disk type to be used for machines in a given agent pool. Allowed values are 'Ephemeral' and 'Managed'. If unspecified, defaults to 'Ephemeral' when the VM supports ephemeral OS and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, - defaults to 'Managed'. May not be changed after creation. Possible values include: "Managed", + defaults to 'Managed'. May not be changed after creation. Known values are: "Managed", "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2020_11_01.models.OSDiskType :keyword vnet_subnet_id: VNet SubnetID specifies the VNet's subnet identifier for nodes and @@ -2857,7 +2848,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2020_11_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -2865,11 +2856,11 @@ def __init__( :paramtype min_count: int :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool - :keyword type: AgentPoolType represents types of an agent pool. Possible values include: + :keyword type: AgentPoolType represents types of an agent pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2020_11_01.models.AgentPoolType - :keyword mode: AgentPoolMode represents mode of an agent pool. Possible values include: - "System", "User". + :keyword mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", + "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2020_11_01.models.AgentPoolMode :keyword orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -2883,13 +2874,12 @@ def __init__( :keyword enable_node_public_ip: Enable public IP for nodes. :paramtype enable_node_public_ip: bool :keyword scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Possible values include: "Spot", "Regular". Default value: - "Regular". + priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_11_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction - policy for Spot virtual machine scale set. Default to Delete. Possible values include: - "Delete", "Deallocate". Default value: "Delete". + policy for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", + "Deallocate". Default value: "Delete". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_11_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: SpotMaxPrice to be used to specify the maximum price you are willing @@ -2960,8 +2950,8 @@ def __init__( class ManagedClusterAutoUpgradeProfile(msrest.serialization.Model): """Auto upgrade profile for a managed cluster. - :ivar upgrade_channel: upgrade channel for auto upgrade. Possible values include: "rapid", - "stable", "patch", "none". + :ivar upgrade_channel: upgrade channel for auto upgrade. Known values are: "rapid", "stable", + "patch", "none". :vartype upgrade_channel: str or ~azure.mgmt.containerservice.v2020_11_01.models.UpgradeChannel """ @@ -2972,11 +2962,11 @@ class ManagedClusterAutoUpgradeProfile(msrest.serialization.Model): def __init__( self, *, - upgrade_channel: Optional[Union[str, "UpgradeChannel"]] = None, + upgrade_channel: Optional[Union[str, "_models.UpgradeChannel"]] = None, **kwargs ): """ - :keyword upgrade_channel: upgrade channel for auto upgrade. Possible values include: "rapid", + :keyword upgrade_channel: upgrade channel for auto upgrade. Known values are: "rapid", "stable", "patch", "none". :paramtype upgrade_channel: str or ~azure.mgmt.containerservice.v2020_11_01.models.UpgradeChannel @@ -2999,8 +2989,8 @@ class ManagedClusterIdentity(msrest.serialization.Model): :ivar type: The type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ resource group in agent nodes. Type 'None' will not use MSI for the managed cluster, - service principal will be used instead. Possible values include: "SystemAssigned", - "UserAssigned", "None". + service principal will be used instead. Known values are: "SystemAssigned", "UserAssigned", + "None". :vartype type: str or ~azure.mgmt.containerservice.v2020_11_01.models.ResourceIdentityType :ivar user_assigned_identities: The user identity associated with the managed cluster. This identity will be used in control plane and only one user assigned identity is allowed. The user @@ -3025,15 +3015,15 @@ class ManagedClusterIdentity(msrest.serialization.Model): def __init__( self, *, - type: Optional[Union[str, "ResourceIdentityType"]] = None, - user_assigned_identities: Optional[Dict[str, "Components1Umhcm8SchemasManagedclusteridentityPropertiesUserassignedidentitiesAdditionalproperties"]] = None, + type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, + user_assigned_identities: Optional[Dict[str, "_models.Components1Umhcm8SchemasManagedclusteridentityPropertiesUserassignedidentitiesAdditionalproperties"]] = None, **kwargs ): """ :keyword type: The type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ resource group in agent nodes. Type 'None' will not use MSI for the managed - cluster, service principal will be used instead. Possible values include: "SystemAssigned", + cluster, service principal will be used instead. Known values are: "SystemAssigned", "UserAssigned", "None". :paramtype type: str or ~azure.mgmt.containerservice.v2020_11_01.models.ResourceIdentityType :keyword user_assigned_identities: The user identity associated with the managed cluster. This @@ -3073,7 +3063,7 @@ class ManagedClusterListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["ManagedCluster"]] = None, + value: Optional[List["_models.ManagedCluster"]] = None, **kwargs ): """ @@ -3127,10 +3117,10 @@ class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): def __init__( self, *, - managed_outbound_i_ps: Optional["ManagedClusterLoadBalancerProfileManagedOutboundIPs"] = None, - outbound_ip_prefixes: Optional["ManagedClusterLoadBalancerProfileOutboundIPPrefixes"] = None, - outbound_i_ps: Optional["ManagedClusterLoadBalancerProfileOutboundIPs"] = None, - effective_outbound_i_ps: Optional[List["ResourceReference"]] = None, + managed_outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileManagedOutboundIPs"] = None, + outbound_ip_prefixes: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPPrefixes"] = None, + outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPs"] = None, + effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, allocated_outbound_ports: Optional[int] = 0, idle_timeout_in_minutes: Optional[int] = 30, **kwargs @@ -3213,7 +3203,7 @@ class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.M def __init__( self, *, - public_ip_prefixes: Optional[List["ResourceReference"]] = None, + public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, **kwargs ): """ @@ -3239,7 +3229,7 @@ class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): def __init__( self, *, - public_i_ps: Optional[List["ResourceReference"]] = None, + public_i_ps: Optional[List["_models.ResourceReference"]] = None, **kwargs ): """ @@ -3263,8 +3253,8 @@ class ManagedClusterPodIdentity(msrest.serialization.Model): :vartype namespace: str :ivar identity: Required. Information of the user assigned identity. :vartype identity: ~azure.mgmt.containerservice.v2020_11_01.models.UserAssignedIdentity - :ivar provisioning_state: The current provisioning state of the pod identity. Possible values - include: "Assigned", "Updating", "Deleting", "Failed". + :ivar provisioning_state: The current provisioning state of the pod identity. Known values are: + "Assigned", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2020_11_01.models.ManagedClusterPodIdentityProvisioningState :ivar provisioning_info: @@ -3293,7 +3283,7 @@ def __init__( *, name: str, namespace: str, - identity: "UserAssignedIdentity", + identity: "_models.UserAssignedIdentity", **kwargs ): """ @@ -3382,8 +3372,8 @@ def __init__( self, *, enabled: Optional[bool] = None, - user_assigned_identities: Optional[List["ManagedClusterPodIdentity"]] = None, - user_assigned_identity_exceptions: Optional[List["ManagedClusterPodIdentityException"]] = None, + user_assigned_identities: Optional[List["_models.ManagedClusterPodIdentity"]] = None, + user_assigned_identity_exceptions: Optional[List["_models.ManagedClusterPodIdentityException"]] = None, **kwargs ): """ @@ -3416,7 +3406,7 @@ class ManagedClusterPodIdentityProvisioningInfo(msrest.serialization.Model): def __init__( self, *, - error: Optional["CloudError"] = None, + error: Optional["_models.CloudError"] = None, **kwargs ): """ @@ -3437,7 +3427,7 @@ class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): :ivar name: Pool name. :vartype name: str :ivar os_type: Required. OsType to be used to specify os type. Choose from Linux and Windows. - Default to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2020_11_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -3460,9 +3450,9 @@ def __init__( self, *, kubernetes_version: str, - os_type: Union[str, "OSType"] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", name: Optional[str] = None, - upgrades: Optional[List["ManagedClusterPoolUpgradeProfileUpgradesItem"]] = None, + upgrades: Optional[List["_models.ManagedClusterPoolUpgradeProfileUpgradesItem"]] = None, **kwargs ): """ @@ -3471,7 +3461,7 @@ def __init__( :keyword name: Pool name. :paramtype name: str :keyword os_type: Required. OsType to be used to specify os type. Choose from Linux and - Windows. Default to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Windows. Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2020_11_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: @@ -3521,7 +3511,7 @@ class ManagedClusterPropertiesAutoScalerProfile(msrest.serialization.Model): :ivar balance_similar_node_groups: :vartype balance_similar_node_groups: str - :ivar expander: Possible values include: "least-waste", "most-pods", "random". + :ivar expander: Known values are: "least-waste", "most-pods", "random". :vartype expander: str or ~azure.mgmt.containerservice.v2020_11_01.models.Expander :ivar max_empty_bulk_delete: :vartype max_empty_bulk_delete: str @@ -3576,7 +3566,7 @@ def __init__( self, *, balance_similar_node_groups: Optional[str] = None, - expander: Optional[Union[str, "Expander"]] = None, + expander: Optional[Union[str, "_models.Expander"]] = None, max_empty_bulk_delete: Optional[str] = None, max_graceful_termination_sec: Optional[str] = None, max_total_unready_percentage: Optional[str] = None, @@ -3596,7 +3586,7 @@ def __init__( """ :keyword balance_similar_node_groups: :paramtype balance_similar_node_groups: str - :keyword expander: Possible values include: "least-waste", "most-pods", "random". + :keyword expander: Known values are: "least-waste", "most-pods", "random". :paramtype expander: str or ~azure.mgmt.containerservice.v2020_11_01.models.Expander :keyword max_empty_bulk_delete: :paramtype max_empty_bulk_delete: str @@ -3687,9 +3677,9 @@ def __init__( class ManagedClusterSKU(msrest.serialization.Model): """ManagedClusterSKU. - :ivar name: Name of a managed cluster SKU. Possible values include: "Basic". + :ivar name: Name of a managed cluster SKU. Known values are: "Basic". :vartype name: str or ~azure.mgmt.containerservice.v2020_11_01.models.ManagedClusterSKUName - :ivar tier: Tier of a managed cluster SKU. Possible values include: "Paid", "Free". + :ivar tier: Tier of a managed cluster SKU. Known values are: "Paid", "Free". :vartype tier: str or ~azure.mgmt.containerservice.v2020_11_01.models.ManagedClusterSKUTier """ @@ -3701,14 +3691,14 @@ class ManagedClusterSKU(msrest.serialization.Model): def __init__( self, *, - name: Optional[Union[str, "ManagedClusterSKUName"]] = None, - tier: Optional[Union[str, "ManagedClusterSKUTier"]] = None, + name: Optional[Union[str, "_models.ManagedClusterSKUName"]] = None, + tier: Optional[Union[str, "_models.ManagedClusterSKUTier"]] = None, **kwargs ): """ - :keyword name: Name of a managed cluster SKU. Possible values include: "Basic". + :keyword name: Name of a managed cluster SKU. Known values are: "Basic". :paramtype name: str or ~azure.mgmt.containerservice.v2020_11_01.models.ManagedClusterSKUName - :keyword tier: Tier of a managed cluster SKU. Possible values include: "Paid", "Free". + :keyword tier: Tier of a managed cluster SKU. Known values are: "Paid", "Free". :paramtype tier: str or ~azure.mgmt.containerservice.v2020_11_01.models.ManagedClusterSKUTier """ super(ManagedClusterSKU, self).__init__(**kwargs) @@ -3757,8 +3747,8 @@ class ManagedClusterUpgradeProfile(msrest.serialization.Model): def __init__( self, *, - control_plane_profile: "ManagedClusterPoolUpgradeProfile", - agent_pool_profiles: List["ManagedClusterPoolUpgradeProfile"], + control_plane_profile: "_models.ManagedClusterPoolUpgradeProfile", + agent_pool_profiles: List["_models.ManagedClusterPoolUpgradeProfile"], **kwargs ): """ @@ -3800,7 +3790,7 @@ class ManagedClusterWindowsProfile(msrest.serialization.Model): "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!". :vartype admin_password: str :ivar license_type: 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". + Azure Hybrid User Benefits for Windows VMs. Known values are: "None", "Windows_Server". :vartype license_type: str or ~azure.mgmt.containerservice.v2020_11_01.models.LicenseType """ @@ -3819,7 +3809,7 @@ def __init__( *, admin_username: str, admin_password: Optional[str] = None, - license_type: Optional[Union[str, "LicenseType"]] = None, + license_type: Optional[Union[str, "_models.LicenseType"]] = None, **kwargs ): """ @@ -3840,7 +3830,7 @@ def __init__( "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!". :paramtype admin_password: str :keyword license_type: 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". + Azure Hybrid User Benefits for Windows VMs. Known values are: "None", "Windows_Server". :paramtype license_type: str or ~azure.mgmt.containerservice.v2020_11_01.models.LicenseType """ super(ManagedClusterWindowsProfile, self).__init__(**kwargs) @@ -3931,8 +3921,8 @@ def __init__( class PowerState(msrest.serialization.Model): """Describes the Power State of the cluster. - :ivar code: Tells whether the cluster is Running or Stopped. Possible values include: - "Running", "Stopped". + :ivar code: Tells whether the cluster is Running or Stopped. Known values are: "Running", + "Stopped". :vartype code: str or ~azure.mgmt.containerservice.v2020_11_01.models.Code """ @@ -3943,12 +3933,12 @@ class PowerState(msrest.serialization.Model): def __init__( self, *, - code: Optional[Union[str, "Code"]] = None, + code: Optional[Union[str, "_models.Code"]] = None, **kwargs ): """ - :keyword code: Tells whether the cluster is Running or Stopped. Possible values include: - "Running", "Stopped". + :keyword code: Tells whether the cluster is Running or Stopped. Known values are: "Running", + "Stopped". :paramtype code: str or ~azure.mgmt.containerservice.v2020_11_01.models.Code """ super(PowerState, self).__init__(**kwargs) @@ -3991,7 +3981,7 @@ class PrivateEndpointConnection(msrest.serialization.Model): :vartype name: str :ivar type: The resource type. :vartype type: str - :ivar provisioning_state: The current provisioning state. Possible values include: "Succeeded", + :ivar provisioning_state: The current provisioning state. Known values are: "Succeeded", "Creating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2020_11_01.models.PrivateEndpointConnectionProvisioningState @@ -4022,8 +4012,8 @@ class PrivateEndpointConnection(msrest.serialization.Model): def __init__( self, *, - private_endpoint: Optional["PrivateEndpoint"] = None, - private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, + private_endpoint: Optional["_models.PrivateEndpoint"] = None, + private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionState"] = None, **kwargs ): """ @@ -4057,7 +4047,7 @@ class PrivateEndpointConnectionListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["PrivateEndpointConnection"]] = None, + value: Optional[List["_models.PrivateEndpointConnection"]] = None, **kwargs ): """ @@ -4147,7 +4137,7 @@ class PrivateLinkResourcesListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["PrivateLinkResource"]] = None, + value: Optional[List["_models.PrivateLinkResource"]] = None, **kwargs ): """ @@ -4161,7 +4151,7 @@ def __init__( class PrivateLinkServiceConnectionState(msrest.serialization.Model): """The state of a private link service connection. - :ivar status: The private link service connection status. Possible values include: "Pending", + :ivar status: The private link service connection status. Known values are: "Pending", "Approved", "Rejected", "Disconnected". :vartype status: str or ~azure.mgmt.containerservice.v2020_11_01.models.ConnectionStatus :ivar description: The private link service connection description. @@ -4176,13 +4166,13 @@ class PrivateLinkServiceConnectionState(msrest.serialization.Model): def __init__( self, *, - status: Optional[Union[str, "ConnectionStatus"]] = None, + status: Optional[Union[str, "_models.ConnectionStatus"]] = None, description: Optional[str] = None, **kwargs ): """ - :keyword status: The private link service connection status. Possible values include: - "Pending", "Approved", "Rejected", "Disconnected". + :keyword status: The private link service connection status. Known values are: "Pending", + "Approved", "Rejected", "Disconnected". :paramtype status: str or ~azure.mgmt.containerservice.v2020_11_01.models.ConnectionStatus :keyword description: The private link service connection description. :paramtype description: str diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/models/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/models/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/operations/__init__.py index 653c03870023..eb76d54a688d 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/operations/__init__.py @@ -13,6 +13,9 @@ from ._private_link_resources_operations import PrivateLinkResourcesOperations from ._resolve_private_link_service_id_operations import ResolvePrivateLinkServiceIdOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'Operations', 'ManagedClustersOperations', @@ -21,3 +24,5 @@ 'PrivateLinkResourcesOperations', 'ResolvePrivateLinkServiceIdOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/operations/_agent_pools_operations.py index 7d394be7ddfd..218afacf1374 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/operations/_agent_pools_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -35,9 +35,12 @@ def build_list_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-11-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools") # pylint: disable=line-too-long path_format_arguments = { @@ -49,18 +52,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -72,9 +73,12 @@ def build_get_request( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-11-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -87,18 +91,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -109,14 +111,17 @@ def build_create_or_update_request_initial( resource_name: str, agent_pool_name: str, *, - json: JSONType = None, + json: Optional[_models.AgentPool] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-11-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -129,20 +134,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -156,9 +159,12 @@ def build_delete_request_initial( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-11-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -171,18 +177,16 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -194,9 +198,12 @@ def build_get_upgrade_profile_request( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-11-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default") # pylint: disable=line-too-long path_format_arguments = { @@ -209,18 +216,16 @@ def build_get_upgrade_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -231,9 +236,12 @@ def build_get_available_agent_pool_versions_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-11-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions") # pylint: disable=line-too-long path_format_arguments = { @@ -245,18 +253,16 @@ def build_get_available_agent_pool_versions_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -268,9 +274,12 @@ def build_upgrade_node_image_version_request_initial( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-11-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion") # pylint: disable=line-too-long path_format_arguments = { @@ -283,42 +292,38 @@ def build_upgrade_node_image_version_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class AgentPoolsOperations(object): - """AgentPoolsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class AgentPoolsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2020_11_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2020_11_01.ContainerServiceClient`'s + :attr:`agent_pools` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -326,7 +331,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Iterable["_models.AgentPoolListResult"]: + ) -> Iterable[_models.AgentPoolListResult]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. The operation returns properties @@ -342,13 +347,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_11_01.models.AgentPoolListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-11-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -358,9 +366,11 @@ def prepare_request(next_link=None): resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -370,9 +380,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -412,7 +424,7 @@ def get( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPool": + ) -> _models.AgentPool: """Gets the agent pool. Gets the details of the agent pool by managed cluster and resource group. @@ -428,13 +440,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2020_11_01.models.AgentPool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-11-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] request = build_get_request( @@ -444,11 +459,13 @@ def get( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -474,17 +491,20 @@ def _create_or_update_initial( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> "_models.AgentPool": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] + ) -> _models.AgentPool: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-11-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] _json = self._serialize.body(parameters, 'AgentPool') @@ -497,11 +517,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -532,9 +554,9 @@ def begin_create_or_update( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> LROPoller["_models.AgentPool"]: + ) -> LROPoller[_models.AgentPool]: """Creates or updates an agent pool. Creates or updates an agent pool in the specified managed cluster. @@ -560,17 +582,20 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_11_01.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-11-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, @@ -578,20 +603,27 @@ def begin_create_or_update( 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): - response = pipeline_response.http_response deserialized = self._deserialize('AgentPool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -611,13 +643,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements agent_pool_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-11-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -627,11 +662,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -678,21 +715,26 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-11-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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) @@ -702,8 +744,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -723,7 +771,7 @@ def get_upgrade_profile( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPoolUpgradeProfile": + ) -> _models.AgentPoolUpgradeProfile: """Gets upgrade profile for an agent pool. Gets the details of the upgrade profile for an agent pool with a specified resource group and @@ -740,13 +788,16 @@ def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2020_11_01.models.AgentPoolUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-11-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] request = build_get_upgrade_profile_request( @@ -756,11 +807,13 @@ def get_upgrade_profile( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -787,7 +840,7 @@ def get_available_agent_pool_versions( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.AgentPoolAvailableVersions": + ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported versions for the specified agent pool. Gets a list of supported versions for the specified agent pool. @@ -801,13 +854,16 @@ def get_available_agent_pool_versions( :rtype: ~azure.mgmt.containerservice.v2020_11_01.models.AgentPoolAvailableVersions :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolAvailableVersions"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-11-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] request = build_get_available_agent_pool_versions_request( @@ -816,11 +872,13 @@ def get_available_agent_pool_versions( resource_name=resource_name, api_version=api_version, template_url=self.get_available_agent_pool_versions.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -847,14 +905,17 @@ def _upgrade_node_image_version_initial( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> Optional["_models.AgentPool"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.AgentPool"]] + ) -> Optional[_models.AgentPool]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-11-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] request = build_upgrade_node_image_version_request_initial( @@ -864,11 +925,13 @@ def _upgrade_node_image_version_initial( agent_pool_name=agent_pool_name, api_version=api_version, template_url=self._upgrade_node_image_version_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -898,7 +961,7 @@ def begin_upgrade_node_image_version( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> LROPoller["_models.AgentPool"]: + ) -> LROPoller[_models.AgentPool]: """Upgrade node image version of an agent pool to the latest. Upgrade node image version of an agent pool to the latest. @@ -922,35 +985,45 @@ def begin_upgrade_node_image_version( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_11_01.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-11-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._upgrade_node_image_version_initial( + raw_result = self._upgrade_node_image_version_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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): - response = pipeline_response.http_response deserialized = self._deserialize('AgentPool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/operations/_managed_clusters_operations.py index 301c7320acd1..59eec46cd15c 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/operations/_managed_clusters_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -33,9 +33,12 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-11-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters") path_format_arguments = { @@ -45,18 +48,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -66,9 +67,12 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-11-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters") # pylint: disable=line-too-long path_format_arguments = { @@ -79,18 +83,16 @@ def build_list_by_resource_group_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -101,9 +103,12 @@ def build_get_upgrade_profile_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-11-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default") # pylint: disable=line-too-long path_format_arguments = { @@ -115,18 +120,16 @@ def build_get_upgrade_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -138,9 +141,12 @@ def build_get_access_profile_request( role_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-11-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -153,18 +159,16 @@ def build_get_access_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -175,9 +179,12 @@ def build_list_cluster_admin_credentials_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-11-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -189,18 +196,16 @@ def build_list_cluster_admin_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -211,9 +216,12 @@ def build_list_cluster_user_credentials_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-11-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -225,18 +233,16 @@ def build_list_cluster_user_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -247,9 +253,12 @@ def build_list_cluster_monitoring_user_credentials_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-11-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -261,18 +270,16 @@ def build_list_cluster_monitoring_user_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -283,9 +290,12 @@ def build_get_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-11-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -297,18 +307,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -318,14 +326,17 @@ def build_create_or_update_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedCluster] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-11-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -337,20 +348,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -362,14 +371,17 @@ def build_update_tags_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.TagsObject] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-11-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -381,20 +393,18 @@ def build_update_tags_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -407,9 +417,12 @@ def build_delete_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-11-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -421,18 +434,16 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -442,14 +453,17 @@ def build_reset_service_principal_profile_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedClusterServicePrincipalProfile] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-11-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile") # pylint: disable=line-too-long path_format_arguments = { @@ -461,20 +475,18 @@ def build_reset_service_principal_profile_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -486,14 +498,17 @@ def build_reset_aad_profile_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedClusterAADProfile] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-11-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile") # pylint: disable=line-too-long path_format_arguments = { @@ -505,20 +520,18 @@ def build_reset_aad_profile_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -531,9 +544,12 @@ def build_rotate_cluster_certificates_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-11-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates") # pylint: disable=line-too-long path_format_arguments = { @@ -545,18 +561,16 @@ def build_rotate_cluster_certificates_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -567,9 +581,12 @@ def build_stop_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-11-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop") # pylint: disable=line-too-long path_format_arguments = { @@ -581,18 +598,16 @@ def build_stop_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -603,9 +618,12 @@ def build_start_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-11-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start") # pylint: disable=line-too-long path_format_arguments = { @@ -617,48 +635,44 @@ def build_start_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class ManagedClustersOperations(object): # pylint: disable=too-many-public-methods - """ManagedClustersOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ManagedClustersOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2020_11_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2020_11_01.ContainerServiceClient`'s + :attr:`managed_clusters` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> Iterable["_models.ManagedClusterListResult"]: + ) -> Iterable[_models.ManagedClusterListResult]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. The operation returns properties @@ -671,13 +685,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_11_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-11-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -685,9 +702,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -695,9 +714,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -735,7 +756,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.ManagedClusterListResult"]: + ) -> Iterable[_models.ManagedClusterListResult]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. The operation returns @@ -750,13 +771,16 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_11_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-11-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -765,9 +789,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -776,9 +802,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -817,7 +845,7 @@ def get_upgrade_profile( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedClusterUpgradeProfile": + ) -> _models.ManagedClusterUpgradeProfile: """Gets upgrade profile for a managed cluster. Gets the details of the upgrade profile for a managed cluster with a specified resource group @@ -832,13 +860,16 @@ def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2020_11_01.models.ManagedClusterUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-11-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] request = build_get_upgrade_profile_request( @@ -847,11 +878,13 @@ def get_upgrade_profile( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -879,7 +912,7 @@ def get_access_profile( resource_name: str, role_name: str, **kwargs: Any - ) -> "_models.ManagedClusterAccessProfile": + ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. Gets the accessProfile for the specified role name of the managed cluster with a specified @@ -900,13 +933,16 @@ def get_access_profile( :rtype: ~azure.mgmt.containerservice.v2020_11_01.models.ManagedClusterAccessProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterAccessProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-11-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] request = build_get_access_profile_request( @@ -916,11 +952,13 @@ def get_access_profile( role_name=role_name, api_version=api_version, template_url=self.get_access_profile.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -947,7 +985,7 @@ def list_cluster_admin_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster admin credential of a managed cluster. Gets cluster admin credential of the managed cluster with a specified resource group and name. @@ -961,13 +999,16 @@ def list_cluster_admin_credentials( :rtype: ~azure.mgmt.containerservice.v2020_11_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-11-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_admin_credentials_request( @@ -976,11 +1017,13 @@ def list_cluster_admin_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_admin_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1007,7 +1050,7 @@ def list_cluster_user_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster user credential of a managed cluster. Gets cluster user credential of the managed cluster with a specified resource group and name. @@ -1021,13 +1064,16 @@ def list_cluster_user_credentials( :rtype: ~azure.mgmt.containerservice.v2020_11_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-11-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_user_credentials_request( @@ -1036,11 +1082,13 @@ def list_cluster_user_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1067,7 +1115,7 @@ def list_cluster_monitoring_user_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster monitoring user credential of a managed cluster. Gets cluster monitoring user credential of the managed cluster with a specified resource group @@ -1082,13 +1130,16 @@ def list_cluster_monitoring_user_credentials( :rtype: ~azure.mgmt.containerservice.v2020_11_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-11-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_monitoring_user_credentials_request( @@ -1097,11 +1148,13 @@ def list_cluster_monitoring_user_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1128,7 +1181,7 @@ def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedCluster": + ) -> _models.ManagedCluster: """Gets a managed cluster. Gets the details of the managed cluster with a specified resource group and name. @@ -1142,13 +1195,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2020_11_01.models.ManagedCluster :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-11-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] request = build_get_request( @@ -1157,11 +1213,13 @@ def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1186,17 +1244,20 @@ def _create_or_update_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-11-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'ManagedCluster') @@ -1208,11 +1269,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1242,9 +1305,9 @@ def begin_create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> LROPoller["_models.ManagedCluster"]: + ) -> LROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. Creates or updates a managed cluster with the specified configuration for agents and Kubernetes @@ -1270,37 +1333,47 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_11_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-11-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1317,17 +1390,20 @@ def _update_tags_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-11-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'TagsObject') @@ -1339,11 +1415,13 @@ def _update_tags_initial( content_type=content_type, json=_json, template_url=self._update_tags_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1369,9 +1447,9 @@ def begin_update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> LROPoller["_models.ManagedCluster"]: + ) -> LROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates a managed cluster with the specified tags. @@ -1396,37 +1474,47 @@ def begin_update_tags( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_11_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-11-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._update_tags_initial( + raw_result = self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1445,13 +1533,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-11-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -1460,11 +1551,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1508,20 +1601,25 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-11-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_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) @@ -1531,8 +1629,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1549,17 +1653,20 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2020-11-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') @@ -1571,11 +1678,13 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re content_type=content_type, json=_json, template_url=self._reset_service_principal_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1597,7 +1706,7 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> LROPoller[None]: """Reset Service Principal Profile of a managed cluster. @@ -1624,23 +1733,28 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-11-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._reset_service_principal_profile_initial( + raw_result = self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1650,8 +1764,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1668,17 +1788,20 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-11-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') @@ -1690,11 +1813,13 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement content_type=content_type, json=_json, template_url=self._reset_aad_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1716,7 +1841,7 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> LROPoller[None]: """Reset AAD Profile of a managed cluster. @@ -1742,23 +1867,28 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-11-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._reset_aad_profile_initial( + raw_result = self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1768,8 +1898,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1788,13 +1924,16 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-11-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_rotate_cluster_certificates_request_initial( @@ -1803,11 +1942,13 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return resource_name=resource_name, api_version=api_version, template_url=self._rotate_cluster_certificates_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1851,20 +1992,25 @@ def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-st :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-11-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._rotate_cluster_certificates_initial( + raw_result = self._rotate_cluster_certificates_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) @@ -1874,8 +2020,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1894,13 +2046,16 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-11-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_stop_request_initial( @@ -1909,11 +2064,13 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_name, api_version=api_version, template_url=self._stop_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1957,20 +2114,25 @@ def begin_stop( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-11-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._stop_initial( + raw_result = self._stop_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) @@ -1980,8 +2142,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2000,13 +2168,16 @@ def _start_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-11-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_start_request_initial( @@ -2015,11 +2186,13 @@ def _start_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_name, api_version=api_version, template_url=self._start_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2063,20 +2236,25 @@ def begin_start( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-11-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._start_initial( + raw_result = self._start_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) @@ -2086,8 +2264,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/operations/_operations.py index 555001a1b891..c52e9624e511 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/operations/_operations.py @@ -16,6 +16,7 @@ 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 @@ -29,55 +30,54 @@ def build_list_request( **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-11-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.ContainerService/operations") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class Operations(object): - """Operations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2020_11_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2020_11_01.ContainerServiceClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> Iterable["_models.OperationListResult"]: + ) -> Iterable[_models.OperationListResult]: """Gets a list of compute operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -86,31 +86,38 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_11_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-11-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/operations/_private_endpoint_connections_operations.py index 8d10a3d618f0..9ecd5d738c59 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/operations/_private_endpoint_connections_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast from msrest import Serializer @@ -16,13 +16,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -34,9 +34,12 @@ def build_list_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-11-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections") # pylint: disable=line-too-long path_format_arguments = { @@ -48,18 +51,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -71,9 +72,12 @@ def build_get_request( private_endpoint_connection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-11-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -86,18 +90,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -108,14 +110,17 @@ def build_update_request( resource_name: str, private_endpoint_connection_name: str, *, - json: JSONType = None, + json: Optional[_models.PrivateEndpointConnection] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-11-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -128,20 +133,18 @@ def build_update_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -155,9 +158,12 @@ def build_delete_request_initial( private_endpoint_connection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-11-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -170,42 +176,38 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class PrivateEndpointConnectionsOperations(object): - """PrivateEndpointConnectionsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class PrivateEndpointConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2020_11_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2020_11_01.ContainerServiceClient`'s + :attr:`private_endpoint_connections` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -213,7 +215,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnectionListResult": + ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. Gets a list of private endpoint connections in the specified managed cluster. The operation @@ -228,13 +230,16 @@ def list( :rtype: ~azure.mgmt.containerservice.v2020_11_01.models.PrivateEndpointConnectionListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-11-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] request = build_list_request( @@ -243,11 +248,13 @@ def list( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -275,7 +282,7 @@ def get( resource_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Gets the private endpoint connection. Gets the details of the private endpoint connection by managed cluster and resource group. @@ -291,13 +298,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2020_11_01.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-11-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] request = build_get_request( @@ -307,11 +317,13 @@ def get( private_endpoint_connection_name=private_endpoint_connection_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -338,9 +350,9 @@ def update( resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - parameters: "_models.PrivateEndpointConnection", + parameters: _models.PrivateEndpointConnection, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. Updates a private endpoint connection in the specified managed cluster. @@ -358,14 +370,17 @@ def update( :rtype: ~azure.mgmt.containerservice.v2020_11_01.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-11-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] _json = self._serialize.body(parameters, 'PrivateEndpointConnection') @@ -378,11 +393,13 @@ def update( content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -410,13 +427,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-11-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -426,11 +446,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name=private_endpoint_connection_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -477,21 +499,26 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-11-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -501,8 +528,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/operations/_private_link_resources_operations.py index 65d8fb359f52..a6d4e0d782ef 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/operations/_private_link_resources_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/operations/_private_link_resources_operations.py @@ -15,6 +15,7 @@ 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 @@ -31,9 +32,12 @@ def build_list_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-11-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources") # pylint: disable=line-too-long path_format_arguments = { @@ -45,42 +49,38 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class PrivateLinkResourcesOperations(object): - """PrivateLinkResourcesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class PrivateLinkResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2020_11_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2020_11_01.ContainerServiceClient`'s + :attr:`private_link_resources` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -88,7 +88,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.PrivateLinkResourcesListResult": + ) -> _models.PrivateLinkResourcesListResult: """Gets a list of private link resources in the specified managed cluster. Gets a list of private link resources in the specified managed cluster. The operation returns @@ -103,13 +103,16 @@ def list( :rtype: ~azure.mgmt.containerservice.v2020_11_01.models.PrivateLinkResourcesListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourcesListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-11-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] request = build_list_request( @@ -118,11 +121,13 @@ def list( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/operations/_resolve_private_link_service_id_operations.py index 27237444a028..391170934689 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/operations/_resolve_private_link_service_id_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/operations/_resolve_private_link_service_id_operations.py @@ -15,12 +15,12 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -31,14 +31,17 @@ def build_post_request( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.PrivateLinkResource] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-11-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId") # pylint: disable=line-too-long path_format_arguments = { @@ -50,55 +53,51 @@ def build_post_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs ) -class ResolvePrivateLinkServiceIdOperations(object): - """ResolvePrivateLinkServiceIdOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ResolvePrivateLinkServiceIdOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2020_11_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2020_11_01.ContainerServiceClient`'s + :attr:`resolve_private_link_service_id` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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 post( self, resource_group_name: str, resource_name: str, - parameters: "_models.PrivateLinkResource", + parameters: _models.PrivateLinkResource, **kwargs: Any - ) -> "_models.PrivateLinkResource": + ) -> _models.PrivateLinkResource: """Gets the private link service ID for the specified managed cluster. Gets the private link service ID the specified managed cluster. @@ -115,14 +114,17 @@ def post( :rtype: ~azure.mgmt.containerservice.v2020_11_01.models.PrivateLinkResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2020-11-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-11-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] _json = self._serialize.body(parameters, 'PrivateLinkResource') @@ -134,11 +136,13 @@ def post( content_type=content_type, json=_json, template_url=self.post.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/__init__.py index 53c675bd95e2..37a5f9e02e6f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._container_service_client import ContainerServiceClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['ContainerServiceClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/_container_service_client.py index d27c03e6f7f5..a2548045810c 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/_container_service_client.py @@ -72,13 +72,27 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.managed_clusters = ManagedClustersOperations(self._client, self._config, self._serialize, self._deserialize) - self.maintenance_configurations = MaintenanceConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) - self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) - self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_clusters = ManagedClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.maintenance_configurations = MaintenanceConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.agent_pools = AgentPoolsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/__init__.py index 53c675bd95e2..37a5f9e02e6f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._container_service_client import ContainerServiceClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['ContainerServiceClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/_container_service_client.py index baeef62627c7..3c197000ebe3 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/_container_service_client.py @@ -73,13 +73,27 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.managed_clusters = ManagedClustersOperations(self._client, self._config, self._serialize, self._deserialize) - self.maintenance_configurations = MaintenanceConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) - self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) - self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_clusters = ManagedClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.maintenance_configurations = MaintenanceConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.agent_pools = AgentPoolsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/operations/__init__.py index 3942e0ca6a01..f0e265d9f2f4 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/operations/__init__.py @@ -14,6 +14,9 @@ from ._private_link_resources_operations import PrivateLinkResourcesOperations from ._resolve_private_link_service_id_operations import ResolvePrivateLinkServiceIdOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'Operations', 'ManagedClustersOperations', @@ -23,3 +26,5 @@ 'PrivateLinkResourcesOperations', 'ResolvePrivateLinkServiceIdOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/operations/_agent_pools_operations.py index 6faeb5440edd..fa4a7d5d4adf 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/operations/_agent_pools_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. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ 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 @@ -26,26 +27,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class AgentPoolsOperations: - """AgentPoolsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2020_12_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2020_12_01.aio.ContainerServiceClient`'s + :attr:`agent_pools` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -53,7 +52,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> AsyncIterable["_models.AgentPoolListResult"]: + ) -> AsyncIterable[_models.AgentPoolListResult]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. The operation returns properties @@ -69,13 +68,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_12_01.models.AgentPoolListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-12-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -85,9 +87,11 @@ def prepare_request(next_link=None): resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -97,9 +101,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -139,7 +145,7 @@ async def get( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPool": + ) -> _models.AgentPool: """Gets the agent pool. Gets the details of the agent pool by managed cluster and resource group. @@ -155,13 +161,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2020_12_01.models.AgentPool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-12-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] request = build_get_request( @@ -171,11 +180,13 @@ async def get( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -201,17 +212,20 @@ async def _create_or_update_initial( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> "_models.AgentPool": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] + ) -> _models.AgentPool: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2020-12-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] _json = self._serialize.body(parameters, 'AgentPool') @@ -224,11 +238,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -259,9 +275,9 @@ async def begin_create_or_update( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> AsyncLROPoller["_models.AgentPool"]: + ) -> AsyncLROPoller[_models.AgentPool]: """Creates or updates an agent pool. Creates or updates an agent pool in the specified managed cluster. @@ -288,17 +304,20 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_12_01.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-12-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, @@ -306,20 +325,27 @@ async def begin_create_or_update( 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): - response = pipeline_response.http_response deserialized = self._deserialize('AgentPool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -339,13 +365,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements agent_pool_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-12-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -355,11 +384,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -406,21 +437,26 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-12-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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) @@ -430,8 +466,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -451,7 +493,7 @@ async def get_upgrade_profile( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPoolUpgradeProfile": + ) -> _models.AgentPoolUpgradeProfile: """Gets upgrade profile for an agent pool. Gets the details of the upgrade profile for an agent pool with a specified resource group and @@ -468,13 +510,16 @@ async def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2020_12_01.models.AgentPoolUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-12-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] request = build_get_upgrade_profile_request( @@ -484,11 +529,13 @@ async def get_upgrade_profile( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -515,7 +562,7 @@ async def get_available_agent_pool_versions( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.AgentPoolAvailableVersions": + ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported versions for the specified agent pool. Gets a list of supported versions for the specified agent pool. @@ -529,13 +576,16 @@ async def get_available_agent_pool_versions( :rtype: ~azure.mgmt.containerservice.v2020_12_01.models.AgentPoolAvailableVersions :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolAvailableVersions"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-12-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] request = build_get_available_agent_pool_versions_request( @@ -544,11 +594,13 @@ async def get_available_agent_pool_versions( resource_name=resource_name, api_version=api_version, template_url=self.get_available_agent_pool_versions.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -575,14 +627,17 @@ async def _upgrade_node_image_version_initial( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> Optional["_models.AgentPool"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.AgentPool"]] + ) -> Optional[_models.AgentPool]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-12-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] request = build_upgrade_node_image_version_request_initial( @@ -592,11 +647,13 @@ async def _upgrade_node_image_version_initial( agent_pool_name=agent_pool_name, api_version=api_version, template_url=self._upgrade_node_image_version_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -626,7 +683,7 @@ async def begin_upgrade_node_image_version( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> AsyncLROPoller["_models.AgentPool"]: + ) -> AsyncLROPoller[_models.AgentPool]: """Upgrade node image version of an agent pool to the latest. Upgrade node image version of an agent pool to the latest. @@ -651,35 +708,45 @@ async def begin_upgrade_node_image_version( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_12_01.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-12-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._upgrade_node_image_version_initial( + raw_result = await self._upgrade_node_image_version_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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): - response = pipeline_response.http_response deserialized = self._deserialize('AgentPool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/operations/_maintenance_configurations_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/operations/_maintenance_configurations_operations.py index 9c7b7f01b492..c9cbad256630 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/operations/_maintenance_configurations_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/operations/_maintenance_configurations_operations.py @@ -15,6 +15,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -24,26 +25,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class MaintenanceConfigurationsOperations: - """MaintenanceConfigurationsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2020_12_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2020_12_01.aio.ContainerServiceClient`'s + :attr:`maintenance_configurations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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_by_managed_cluster( @@ -51,7 +50,7 @@ def list_by_managed_cluster( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> AsyncIterable["_models.MaintenanceConfigurationListResult"]: + ) -> AsyncIterable[_models.MaintenanceConfigurationListResult]: """Gets a list of maintenance configurations in the specified managed cluster. Gets a list of maintenance configurations in the specified managed cluster. The operation @@ -68,13 +67,16 @@ def list_by_managed_cluster( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_12_01.models.MaintenanceConfigurationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-12-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfigurationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfigurationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -84,9 +86,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=self.list_by_managed_cluster.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -96,9 +100,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -138,7 +144,7 @@ async def get( resource_name: str, config_name: str, **kwargs: Any - ) -> "_models.MaintenanceConfiguration": + ) -> _models.MaintenanceConfiguration: """Gets the maintenance configuration. Gets the details of maintenance configurations by managed cluster and resource group. @@ -154,13 +160,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2020_12_01.models.MaintenanceConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfiguration"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-12-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] request = build_get_request( @@ -170,11 +179,13 @@ async def get( config_name=config_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -201,9 +212,9 @@ async def create_or_update( resource_group_name: str, resource_name: str, config_name: str, - parameters: "_models.MaintenanceConfiguration", + parameters: _models.MaintenanceConfiguration, **kwargs: Any - ) -> "_models.MaintenanceConfiguration": + ) -> _models.MaintenanceConfiguration: """Creates or updates a maintenance configurations. Creates or updates a maintenance configuration in the specified managed cluster. @@ -222,14 +233,17 @@ async def create_or_update( :rtype: ~azure.mgmt.containerservice.v2020_12_01.models.MaintenanceConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfiguration"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-12-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] _json = self._serialize.body(parameters, 'MaintenanceConfiguration') @@ -242,11 +256,13 @@ async def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -290,13 +306,16 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-12-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -306,11 +325,13 @@ async def delete( # pylint: disable=inconsistent-return-statements config_name=config_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/operations/_managed_clusters_operations.py index 6e48edcd30fe..f79d7b7fb019 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/operations/_managed_clusters_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. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ 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 @@ -26,32 +27,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ManagedClustersOperations: # pylint: disable=too-many-public-methods - """ManagedClustersOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2020_12_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2020_12_01.aio.ContainerServiceClient`'s + :attr:`managed_clusters` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.ManagedClusterListResult"]: + ) -> AsyncIterable[_models.ManagedClusterListResult]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. The operation returns properties @@ -64,13 +63,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_12_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-12-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -78,9 +80,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -88,9 +92,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -128,7 +134,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ManagedClusterListResult"]: + ) -> AsyncIterable[_models.ManagedClusterListResult]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. The operation returns @@ -143,13 +149,16 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_12_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-12-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -158,9 +167,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -169,9 +180,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -210,7 +223,7 @@ async def get_upgrade_profile( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedClusterUpgradeProfile": + ) -> _models.ManagedClusterUpgradeProfile: """Gets upgrade profile for a managed cluster. Gets the details of the upgrade profile for a managed cluster with a specified resource group @@ -225,13 +238,16 @@ async def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2020_12_01.models.ManagedClusterUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-12-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] request = build_get_upgrade_profile_request( @@ -240,11 +256,13 @@ async def get_upgrade_profile( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -272,7 +290,7 @@ async def get_access_profile( resource_name: str, role_name: str, **kwargs: Any - ) -> "_models.ManagedClusterAccessProfile": + ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. Gets the accessProfile for the specified role name of the managed cluster with a specified @@ -293,13 +311,16 @@ async def get_access_profile( :rtype: ~azure.mgmt.containerservice.v2020_12_01.models.ManagedClusterAccessProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterAccessProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-12-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] request = build_get_access_profile_request( @@ -309,11 +330,13 @@ async def get_access_profile( role_name=role_name, api_version=api_version, template_url=self.get_access_profile.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -340,7 +363,7 @@ async def list_cluster_admin_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster admin credential of a managed cluster. Gets cluster admin credential of the managed cluster with a specified resource group and name. @@ -354,13 +377,16 @@ async def list_cluster_admin_credentials( :rtype: ~azure.mgmt.containerservice.v2020_12_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-12-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_admin_credentials_request( @@ -369,11 +395,13 @@ async def list_cluster_admin_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_admin_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -400,7 +428,7 @@ async def list_cluster_user_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster user credential of a managed cluster. Gets cluster user credential of the managed cluster with a specified resource group and name. @@ -414,13 +442,16 @@ async def list_cluster_user_credentials( :rtype: ~azure.mgmt.containerservice.v2020_12_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-12-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_user_credentials_request( @@ -429,11 +460,13 @@ async def list_cluster_user_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -460,7 +493,7 @@ async def list_cluster_monitoring_user_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster monitoring user credential of a managed cluster. Gets cluster monitoring user credential of the managed cluster with a specified resource group @@ -475,13 +508,16 @@ async def list_cluster_monitoring_user_credentials( :rtype: ~azure.mgmt.containerservice.v2020_12_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-12-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_monitoring_user_credentials_request( @@ -490,11 +526,13 @@ async def list_cluster_monitoring_user_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -521,7 +559,7 @@ async def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedCluster": + ) -> _models.ManagedCluster: """Gets a managed cluster. Gets the details of the managed cluster with a specified resource group and name. @@ -535,13 +573,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2020_12_01.models.ManagedCluster :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-12-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] request = build_get_request( @@ -550,11 +591,13 @@ async def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -579,17 +622,20 @@ async def _create_or_update_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2020-12-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'ManagedCluster') @@ -601,11 +647,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -635,9 +683,9 @@ async def begin_create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> AsyncLROPoller["_models.ManagedCluster"]: + ) -> AsyncLROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. Creates or updates a managed cluster with the specified configuration for agents and Kubernetes @@ -663,37 +711,47 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_12_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-12-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -710,17 +768,20 @@ async def _update_tags_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2020-12-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'TagsObject') @@ -732,11 +793,13 @@ async def _update_tags_initial( content_type=content_type, json=_json, template_url=self._update_tags_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -762,9 +825,9 @@ async def begin_update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> AsyncLROPoller["_models.ManagedCluster"]: + ) -> AsyncLROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates a managed cluster with the specified tags. @@ -789,37 +852,47 @@ async def begin_update_tags( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2020_12_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-12-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._update_tags_initial( + raw_result = await self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -838,13 +911,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-12-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -853,11 +929,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -901,20 +979,25 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-12-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_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) @@ -924,8 +1007,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -942,17 +1031,20 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-12-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') @@ -964,11 +1056,13 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist content_type=content_type, json=_json, template_url=self._reset_service_principal_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -990,7 +1084,7 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> AsyncLROPoller[None]: """Reset Service Principal Profile of a managed cluster. @@ -1017,23 +1111,28 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-12-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._reset_service_principal_profile_initial( + raw_result = await self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1043,8 +1142,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1061,17 +1166,20 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-12-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') @@ -1083,11 +1191,13 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta content_type=content_type, json=_json, template_url=self._reset_aad_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1109,7 +1219,7 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> AsyncLROPoller[None]: """Reset AAD Profile of a managed cluster. @@ -1135,23 +1245,28 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-12-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._reset_aad_profile_initial( + raw_result = await self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1161,8 +1276,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1181,13 +1302,16 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-12-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_rotate_cluster_certificates_request_initial( @@ -1196,11 +1320,13 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- resource_name=resource_name, api_version=api_version, template_url=self._rotate_cluster_certificates_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1244,20 +1370,25 @@ async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-ret :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-12-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._rotate_cluster_certificates_initial( + raw_result = await self._rotate_cluster_certificates_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) @@ -1267,8 +1398,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1287,13 +1424,16 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-12-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_stop_request_initial( @@ -1302,11 +1442,13 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_name, api_version=api_version, template_url=self._stop_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1350,20 +1492,25 @@ async def begin_stop( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-12-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._stop_initial( + raw_result = await self._stop_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) @@ -1373,8 +1520,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1393,13 +1546,16 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-12-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_start_request_initial( @@ -1408,11 +1564,13 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_name, api_version=api_version, template_url=self._start_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1456,20 +1614,25 @@ async def begin_start( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-12-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._start_initial( + raw_result = await self._start_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) @@ -1479,8 +1642,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/operations/_operations.py index 6a68e0ffac6a..a7fc7fcd0629 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/operations/_operations.py @@ -14,6 +14,7 @@ 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 @@ -23,32 +24,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class Operations: - """Operations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2020_12_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2020_12_01.aio.ContainerServiceClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.OperationListResult"]: + ) -> AsyncIterable[_models.OperationListResult]: """Gets a list of compute operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -57,31 +56,38 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2020_12_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-12-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/operations/_private_endpoint_connections_operations.py index c54b75939d84..095e525d66a8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/operations/_private_endpoint_connections_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -14,6 +14,7 @@ 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 @@ -24,26 +25,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class PrivateEndpointConnectionsOperations: - """PrivateEndpointConnectionsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2020_12_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2020_12_01.aio.ContainerServiceClient`'s + :attr:`private_endpoint_connections` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -51,7 +50,7 @@ async def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnectionListResult": + ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. Gets a list of private endpoint connections in the specified managed cluster. The operation @@ -66,13 +65,16 @@ async def list( :rtype: ~azure.mgmt.containerservice.v2020_12_01.models.PrivateEndpointConnectionListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-12-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] request = build_list_request( @@ -81,11 +83,13 @@ async def list( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -113,7 +117,7 @@ async def get( resource_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Gets the private endpoint connection. Gets the details of the private endpoint connection by managed cluster and resource group. @@ -129,13 +133,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2020_12_01.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-12-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] request = build_get_request( @@ -145,11 +152,13 @@ async def get( private_endpoint_connection_name=private_endpoint_connection_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -176,9 +185,9 @@ async def update( resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - parameters: "_models.PrivateEndpointConnection", + parameters: _models.PrivateEndpointConnection, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. Updates a private endpoint connection in the specified managed cluster. @@ -196,14 +205,17 @@ async def update( :rtype: ~azure.mgmt.containerservice.v2020_12_01.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2020-12-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] _json = self._serialize.body(parameters, 'PrivateEndpointConnection') @@ -216,11 +228,13 @@ async def update( content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -248,13 +262,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-12-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -264,11 +281,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name=private_endpoint_connection_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -315,21 +334,26 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-12-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -339,8 +363,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/operations/_private_link_resources_operations.py index 904b46920950..2c5a8f962f88 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/operations/_private_link_resources_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/operations/_private_link_resources_operations.py @@ -13,6 +13,7 @@ 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 @@ -22,26 +23,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class PrivateLinkResourcesOperations: - """PrivateLinkResourcesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2020_12_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2020_12_01.aio.ContainerServiceClient`'s + :attr:`private_link_resources` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -49,7 +48,7 @@ async def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.PrivateLinkResourcesListResult": + ) -> _models.PrivateLinkResourcesListResult: """Gets a list of private link resources in the specified managed cluster. Gets a list of private link resources in the specified managed cluster. The operation returns @@ -64,13 +63,16 @@ async def list( :rtype: ~azure.mgmt.containerservice.v2020_12_01.models.PrivateLinkResourcesListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourcesListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-12-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] request = build_list_request( @@ -79,11 +81,13 @@ async def list( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/operations/_resolve_private_link_service_id_operations.py index 5ed3333fcd16..dfee2f6625b1 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/operations/_resolve_private_link_service_id_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/aio/operations/_resolve_private_link_service_id_operations.py @@ -13,6 +13,7 @@ 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 @@ -22,35 +23,33 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ResolvePrivateLinkServiceIdOperations: - """ResolvePrivateLinkServiceIdOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2020_12_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2020_12_01.aio.ContainerServiceClient`'s + :attr:`resolve_private_link_service_id` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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 post( self, resource_group_name: str, resource_name: str, - parameters: "_models.PrivateLinkResource", + parameters: _models.PrivateLinkResource, **kwargs: Any - ) -> "_models.PrivateLinkResource": + ) -> _models.PrivateLinkResource: """Gets the private link service ID for the specified managed cluster. Gets the private link service ID the specified managed cluster. @@ -67,14 +66,17 @@ async def post( :rtype: ~azure.mgmt.containerservice.v2020_12_01.models.PrivateLinkResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2020-12-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] _json = self._serialize.body(parameters, 'PrivateLinkResource') @@ -86,11 +88,13 @@ async def post( content_type=content_type, json=_json, template_url=self.post.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/models/__init__.py index 9e976fe25bb3..2b519b694a35 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/models/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/models/__init__.py @@ -106,7 +106,9 @@ UpgradeChannel, WeekDay, ) - +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'AgentPool', 'AgentPoolAvailableVersions', @@ -205,3 +207,5 @@ 'UpgradeChannel', 'WeekDay', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/models/_container_service_client_enums.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/models/_container_service_client_enums.py index 4188985eff74..4e881844aa0f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/models/_container_service_client_enums.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/models/_container_service_client_enums.py @@ -7,32 +7,31 @@ # -------------------------------------------------------------------------- from enum import Enum -from six import with_metaclass from azure.core import CaseInsensitiveEnumMeta -class AgentPoolMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class AgentPoolMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """AgentPoolMode represents mode of an agent pool. """ SYSTEM = "System" USER = "User" -class AgentPoolType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class AgentPoolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """AgentPoolType represents types of an agent pool. """ VIRTUAL_MACHINE_SCALE_SETS = "VirtualMachineScaleSets" AVAILABILITY_SET = "AvailabilitySet" -class Code(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class Code(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Tells whether the cluster is Running or Stopped """ RUNNING = "Running" STOPPED = "Stopped" -class ConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The private link service connection status. """ @@ -41,7 +40,7 @@ class ConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): REJECTED = "Rejected" DISCONNECTED = "Disconnected" -class ContainerServiceStorageProfileTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the orchestrator choice. """ @@ -49,7 +48,7 @@ class ContainerServiceStorageProfileTypes(with_metaclass(CaseInsensitiveEnumMeta STORAGE_ACCOUNT = "StorageAccount" MANAGED_DISKS = "ManagedDisks" -class ContainerServiceVMSizeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Size of agent VMs. """ @@ -228,7 +227,7 @@ class ContainerServiceVMSizeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, E STANDARD_NV24 = "Standard_NV24" STANDARD_NV6 = "Standard_NV6" -class Count(with_metaclass(CaseInsensitiveEnumMeta, int, Enum)): +class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): """Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, and 5. The default value is 1. """ @@ -237,7 +236,7 @@ class Count(with_metaclass(CaseInsensitiveEnumMeta, int, Enum)): THREE = 3 FIVE = 5 -class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of identity that created the resource. """ @@ -246,14 +245,14 @@ class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class Expander(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class Expander(str, Enum, metaclass=CaseInsensitiveEnumMeta): LEAST_WASTE = "least-waste" MOST_PODS = "most-pods" PRIORITY = "priority" RANDOM = "random" -class KubeletDiskType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class KubeletDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """KubeletDiskType determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. Currently allows one value, OS, resulting in Kubelet using the OS disk for data. @@ -261,7 +260,7 @@ class KubeletDiskType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): OS = "OS" -class LicenseType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class LicenseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The licenseType to use for Windows VMs. Windows_Server is used to enable Azure Hybrid User Benefits for Windows VMs. """ @@ -269,14 +268,14 @@ class LicenseType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): NONE = "None" WINDOWS_SERVER = "Windows_Server" -class LoadBalancerSku(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class LoadBalancerSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The load balancer sku for the managed cluster. """ STANDARD = "standard" BASIC = "basic" -class ManagedClusterPodIdentityProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ManagedClusterPodIdentityProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The current provisioning state of the pod identity. """ @@ -285,62 +284,62 @@ class ManagedClusterPodIdentityProvisioningState(with_metaclass(CaseInsensitiveE DELETING = "Deleting" FAILED = "Failed" -class ManagedClusterSKUName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ManagedClusterSKUName(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Name of a managed cluster SKU. """ BASIC = "Basic" -class ManagedClusterSKUTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ManagedClusterSKUTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Tier of a managed cluster SKU. """ PAID = "Paid" FREE = "Free" -class NetworkMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Network mode used for building Kubernetes network. """ TRANSPARENT = "transparent" BRIDGE = "bridge" -class NetworkPlugin(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkPlugin(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Network plugin used for building Kubernetes network. """ AZURE = "azure" KUBENET = "kubenet" -class NetworkPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Network policy used for building Kubernetes network. """ CALICO = "calico" AZURE = "azure" -class OSDiskType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OSDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """OSDiskType represents the type of an OS disk on an agent pool. """ MANAGED = "Managed" EPHEMERAL = "Ephemeral" -class OSType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux. """ LINUX = "Linux" WINDOWS = "Windows" -class OutboundType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OutboundType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The outbound (egress) routing method. """ LOAD_BALANCER = "loadBalancer" USER_DEFINED_ROUTING = "userDefinedRouting" -class PrivateEndpointConnectionProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class PrivateEndpointConnectionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The current provisioning state. """ @@ -349,7 +348,7 @@ class PrivateEndpointConnectionProvisioningState(with_metaclass(CaseInsensitiveE DELETING = "Deleting" FAILED = "Failed" -class ResourceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ resource group in agent nodes. Type 'None' will not use MSI for the managed cluster, service @@ -360,7 +359,7 @@ class ResourceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): USER_ASSIGNED = "UserAssigned" NONE = "None" -class ScaleSetEvictionPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ScaleSetEvictionPolicy to be used to specify eviction policy for Spot virtual machine scale set. Default to Delete. """ @@ -368,14 +367,14 @@ class ScaleSetEvictionPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)) DELETE = "Delete" DEALLOCATE = "Deallocate" -class ScaleSetPriority(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ScaleSetPriority(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ScaleSetPriority to be used to specify virtual machine scale set priority. Default to regular. """ SPOT = "Spot" REGULAR = "Regular" -class UpgradeChannel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class UpgradeChannel(str, Enum, metaclass=CaseInsensitiveEnumMeta): """upgrade channel for auto upgrade. """ @@ -384,7 +383,7 @@ class UpgradeChannel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): PATCH = "patch" NONE = "none" -class WeekDay(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class WeekDay(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The weekday enum. """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/models/_models_py3.py index 6d70c3a3917d..975b312a106b 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/models/_models_py3.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/models/_models_py3.py @@ -7,11 +7,13 @@ # -------------------------------------------------------------------------- import datetime -from typing import Dict, List, Optional, Union +from typing import Dict, List, Optional, TYPE_CHECKING, Union import msrest.serialization -from ._container_service_client_enums import * +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + import __init__ as _models class SubResource(msrest.serialization.Model): @@ -68,7 +70,7 @@ class AgentPool(SubResource): range of 0 to 100 (inclusive) for user pools and in the range of 1 to 100 (inclusive) for system pools. The default value is 1. :vartype count: int - :ivar vm_size: Size of agent VMs. Possible values include: "Standard_A1", "Standard_A10", + :ivar vm_size: Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -115,12 +117,11 @@ class AgentPool(SubResource): :ivar os_disk_type: OS disk type to be used for machines in a given agent pool. Allowed values are 'Ephemeral' and 'Managed'. If unspecified, defaults to 'Ephemeral' when the VM supports ephemeral OS and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults - to 'Managed'. May not be changed after creation. Possible values include: "Managed", - "Ephemeral". + to 'Managed'. May not be changed after creation. Known values are: "Managed", "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2020_12_01.models.OSDiskType :ivar kubelet_disk_type: KubeletDiskType determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. Currently allows one value, OS, - resulting in Kubelet using the OS disk for data. Possible values include: "OS". + resulting in Kubelet using the OS disk for data. Known values are: "OS". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2020_12_01.models.KubeletDiskType :ivar vnet_subnet_id: VNet SubnetID specifies the VNet's subnet identifier for nodes and maybe @@ -131,7 +132,7 @@ class AgentPool(SubResource): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2020_12_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -139,12 +140,11 @@ class AgentPool(SubResource): :vartype min_count: int :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool - :ivar type_properties_type: AgentPoolType represents types of an agent pool. Possible values - include: "VirtualMachineScaleSets", "AvailabilitySet". + :ivar type_properties_type: AgentPoolType represents types of an agent pool. Known values are: + "VirtualMachineScaleSets", "AvailabilitySet". :vartype type_properties_type: str or ~azure.mgmt.containerservice.v2020_12_01.models.AgentPoolType - :ivar mode: AgentPoolMode represents mode of an agent pool. Possible values include: "System", - "User". + :ivar mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", "User". :vartype mode: str or ~azure.mgmt.containerservice.v2020_12_01.models.AgentPoolMode :ivar orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -165,12 +165,11 @@ class AgentPool(SubResource): :ivar enable_node_public_ip: Enable public IP for nodes. :vartype enable_node_public_ip: bool :ivar scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Possible values include: "Spot", "Regular". Default value: - "Regular". + priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_12_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy - for Spot virtual machine scale set. Default to Delete. Possible values include: "Delete", + for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", "Deallocate". Default value: "Delete". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_12_01.models.ScaleSetEvictionPolicy @@ -247,32 +246,32 @@ def __init__( self, *, count: Optional[int] = None, - vm_size: Optional[Union[str, "ContainerServiceVMSizeTypes"]] = None, + vm_size: Optional[Union[str, "_models.ContainerServiceVMSizeTypes"]] = None, os_disk_size_gb: Optional[int] = None, - os_disk_type: Optional[Union[str, "OSDiskType"]] = None, - kubelet_disk_type: Optional[Union[str, "KubeletDiskType"]] = None, + os_disk_type: Optional[Union[str, "_models.OSDiskType"]] = None, + kubelet_disk_type: Optional[Union[str, "_models.KubeletDiskType"]] = None, vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - type_properties_type: Optional[Union[str, "AgentPoolType"]] = None, - mode: Optional[Union[str, "AgentPoolMode"]] = None, + type_properties_type: Optional[Union[str, "_models.AgentPoolType"]] = None, + mode: Optional[Union[str, "_models.AgentPoolMode"]] = None, orchestrator_version: Optional[str] = None, - upgrade_settings: Optional["AgentPoolUpgradeSettings"] = None, + upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, - scale_set_priority: Optional[Union[str, "ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", spot_max_price: Optional[float] = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, proximity_placement_group_id: Optional[str] = None, - kubelet_config: Optional["KubeletConfig"] = None, - linux_os_config: Optional["LinuxOSConfig"] = None, + kubelet_config: Optional["_models.KubeletConfig"] = None, + linux_os_config: Optional["_models.LinuxOSConfig"] = None, enable_encryption_at_host: Optional[bool] = None, **kwargs ): @@ -281,7 +280,7 @@ def __init__( range of 0 to 100 (inclusive) for user pools and in the range of 1 to 100 (inclusive) for system pools. The default value is 1. :paramtype count: int - :keyword vm_size: Size of agent VMs. Possible values include: "Standard_A1", "Standard_A10", + :keyword vm_size: Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -328,12 +327,12 @@ def __init__( :keyword os_disk_type: OS disk type to be used for machines in a given agent pool. Allowed values are 'Ephemeral' and 'Managed'. If unspecified, defaults to 'Ephemeral' when the VM supports ephemeral OS and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, - defaults to 'Managed'. May not be changed after creation. Possible values include: "Managed", + defaults to 'Managed'. May not be changed after creation. Known values are: "Managed", "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2020_12_01.models.OSDiskType :keyword kubelet_disk_type: KubeletDiskType determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. Currently allows one value, OS, - resulting in Kubelet using the OS disk for data. Possible values include: "OS". + resulting in Kubelet using the OS disk for data. Known values are: "OS". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2020_12_01.models.KubeletDiskType :keyword vnet_subnet_id: VNet SubnetID specifies the VNet's subnet identifier for nodes and @@ -344,7 +343,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2020_12_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -352,12 +351,12 @@ def __init__( :paramtype min_count: int :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool - :keyword type_properties_type: AgentPoolType represents types of an agent pool. Possible values - include: "VirtualMachineScaleSets", "AvailabilitySet". + :keyword type_properties_type: AgentPoolType represents types of an agent pool. Known values + are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type_properties_type: str or ~azure.mgmt.containerservice.v2020_12_01.models.AgentPoolType - :keyword mode: AgentPoolMode represents mode of an agent pool. Possible values include: - "System", "User". + :keyword mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", + "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2020_12_01.models.AgentPoolMode :keyword orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -371,13 +370,12 @@ def __init__( :keyword enable_node_public_ip: Enable public IP for nodes. :paramtype enable_node_public_ip: bool :keyword scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Possible values include: "Spot", "Regular". Default value: - "Regular". + priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_12_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction - policy for Spot virtual machine scale set. Default to Delete. Possible values include: - "Delete", "Deallocate". Default value: "Delete". + policy for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", + "Deallocate". Default value: "Delete". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_12_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: SpotMaxPrice to be used to specify the maximum price you are willing @@ -467,7 +465,7 @@ class AgentPoolAvailableVersions(msrest.serialization.Model): def __init__( self, *, - agent_pool_versions: Optional[List["AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem"]] = None, + agent_pool_versions: Optional[List["_models.AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem"]] = None, **kwargs ): """ @@ -544,7 +542,7 @@ class AgentPoolListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["AgentPool"]] = None, + value: Optional[List["_models.AgentPool"]] = None, **kwargs ): """ @@ -572,7 +570,7 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): :ivar kubernetes_version: Required. Kubernetes version (major, minor, patch). :vartype kubernetes_version: str :ivar os_type: Required. OsType to be used to specify os type. Choose from Linux and Windows. - Default to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2020_12_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -604,8 +602,8 @@ def __init__( self, *, kubernetes_version: str, - os_type: Union[str, "OSType"] = "Linux", - upgrades: Optional[List["AgentPoolUpgradeProfilePropertiesUpgradesItem"]] = None, + os_type: Union[str, "_models.OSType"] = "Linux", + upgrades: Optional[List["_models.AgentPoolUpgradeProfilePropertiesUpgradesItem"]] = None, latest_node_image_version: Optional[str] = None, **kwargs ): @@ -613,7 +611,7 @@ def __init__( :keyword kubernetes_version: Required. Kubernetes version (major, minor, patch). :paramtype kubernetes_version: str :keyword os_type: Required. OsType to be used to specify os type. Choose from Linux and - Windows. Default to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Windows. Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2020_12_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: @@ -705,7 +703,7 @@ class CloudError(msrest.serialization.Model): def __init__( self, *, - error: Optional["CloudErrorBody"] = None, + error: Optional["_models.CloudErrorBody"] = None, **kwargs ): """ @@ -745,7 +743,7 @@ def __init__( code: Optional[str] = None, message: Optional[str] = None, target: Optional[str] = None, - details: Optional[List["CloudErrorBody"]] = None, + details: Optional[List["_models.CloudErrorBody"]] = None, **kwargs ): """ @@ -877,25 +875,25 @@ class Components1Q1Og48SchemasManagedclusterAllof1(msrest.serialization.Model): def __init__( self, *, - identity: Optional["ManagedClusterIdentity"] = None, + identity: Optional["_models.ManagedClusterIdentity"] = None, kubernetes_version: Optional[str] = None, dns_prefix: Optional[str] = None, - agent_pool_profiles: Optional[List["ManagedClusterAgentPoolProfile"]] = None, - linux_profile: Optional["ContainerServiceLinuxProfile"] = None, - windows_profile: Optional["ManagedClusterWindowsProfile"] = None, - service_principal_profile: Optional["ManagedClusterServicePrincipalProfile"] = None, - addon_profiles: Optional[Dict[str, "ManagedClusterAddonProfile"]] = None, - pod_identity_profile: Optional["ManagedClusterPodIdentityProfile"] = None, + agent_pool_profiles: Optional[List["_models.ManagedClusterAgentPoolProfile"]] = None, + linux_profile: Optional["_models.ContainerServiceLinuxProfile"] = None, + windows_profile: Optional["_models.ManagedClusterWindowsProfile"] = None, + service_principal_profile: Optional["_models.ManagedClusterServicePrincipalProfile"] = None, + addon_profiles: Optional[Dict[str, "_models.ManagedClusterAddonProfile"]] = None, + pod_identity_profile: Optional["_models.ManagedClusterPodIdentityProfile"] = None, node_resource_group: Optional[str] = None, enable_rbac: Optional[bool] = None, enable_pod_security_policy: Optional[bool] = None, - network_profile: Optional["ContainerServiceNetworkProfile"] = None, - aad_profile: Optional["ManagedClusterAADProfile"] = None, - auto_upgrade_profile: Optional["ManagedClusterAutoUpgradeProfile"] = None, - auto_scaler_profile: Optional["ManagedClusterPropertiesAutoScalerProfile"] = None, - api_server_access_profile: Optional["ManagedClusterAPIServerAccessProfile"] = None, + network_profile: Optional["_models.ContainerServiceNetworkProfile"] = None, + aad_profile: Optional["_models.ManagedClusterAADProfile"] = None, + auto_upgrade_profile: Optional["_models.ManagedClusterAutoUpgradeProfile"] = None, + auto_scaler_profile: Optional["_models.ManagedClusterPropertiesAutoScalerProfile"] = None, + api_server_access_profile: Optional["_models.ManagedClusterAPIServerAccessProfile"] = None, disk_encryption_set_id: Optional[str] = None, - identity_profile: Optional[Dict[str, "ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties"]] = None, + identity_profile: Optional[Dict[str, "_models.ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties"]] = None, **kwargs ): """ @@ -1109,7 +1107,7 @@ class ContainerServiceDiagnosticsProfile(msrest.serialization.Model): def __init__( self, *, - vm_diagnostics: "ContainerServiceVMDiagnostics", + vm_diagnostics: "_models.ContainerServiceVMDiagnostics", **kwargs ): """ @@ -1146,7 +1144,7 @@ def __init__( self, *, admin_username: str, - ssh: "ContainerServiceSshConfiguration", + ssh: "_models.ContainerServiceSshConfiguration", **kwargs ): """ @@ -1169,17 +1167,17 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar count: Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, - and 5. The default value is 1. Possible values include: 1, 3, 5. Default value: "1". + and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". :vartype count: int or ~azure.mgmt.containerservice.v2020_12_01.models.Count :ivar dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. :vartype dns_prefix: str - :ivar vm_size: Required. Size of agent VMs. Possible values include: "Standard_A1", - "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", - "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", - "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", - "Standard_A8m_v2", "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", - "Standard_B8ms", "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", - "Standard_D12", "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", + :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", + "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", + "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", + "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", "Standard_B8ms", + "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", "Standard_D12", + "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", "Standard_D13_v2_Promo", "Standard_D14", "Standard_D14_v2", "Standard_D14_v2_Promo", "Standard_D15_v2", "Standard_D16_v3", "Standard_D16s_v3", "Standard_D1_v2", "Standard_D2", "Standard_D2_v2", "Standard_D2_v2_Promo", "Standard_D2_v3", "Standard_D2s_v3", "Standard_D3", @@ -1224,7 +1222,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): :vartype first_consecutive_static_ip: str :ivar storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Possible values include: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". :vartype storage_profile: str or ~azure.mgmt.containerservice.v2020_12_01.models.ContainerServiceStorageProfileTypes :ivar fqdn: FQDN for the master pool. @@ -1253,27 +1251,27 @@ def __init__( self, *, dns_prefix: str, - vm_size: Union[str, "ContainerServiceVMSizeTypes"], - count: Optional[Union[int, "Count"]] = 1, + vm_size: Union[str, "_models.ContainerServiceVMSizeTypes"], + count: Optional[Union[int, "_models.Count"]] = 1, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, first_consecutive_static_ip: Optional[str] = "10.240.255.5", - storage_profile: Optional[Union[str, "ContainerServiceStorageProfileTypes"]] = None, + storage_profile: Optional[Union[str, "_models.ContainerServiceStorageProfileTypes"]] = None, **kwargs ): """ :keyword count: Number of masters (VMs) in the container service cluster. Allowed values are 1, - 3, and 5. The default value is 1. Possible values include: 1, 3, 5. Default value: "1". + 3, and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". :paramtype count: int or ~azure.mgmt.containerservice.v2020_12_01.models.Count :keyword dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. :paramtype dns_prefix: str - :keyword vm_size: Required. Size of agent VMs. Possible values include: "Standard_A1", - "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", - "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", - "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", - "Standard_A8m_v2", "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", - "Standard_B8ms", "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", - "Standard_D12", "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", + :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", + "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", + "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", + "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", "Standard_B8ms", + "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", "Standard_D12", + "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", "Standard_D13_v2_Promo", "Standard_D14", "Standard_D14_v2", "Standard_D14_v2_Promo", "Standard_D15_v2", "Standard_D16_v3", "Standard_D16s_v3", "Standard_D1_v2", "Standard_D2", "Standard_D2_v2", "Standard_D2_v2_Promo", "Standard_D2_v3", "Standard_D2s_v3", "Standard_D3", @@ -1318,7 +1316,7 @@ def __init__( :paramtype first_consecutive_static_ip: str :keyword storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Possible values include: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". :paramtype storage_profile: str or ~azure.mgmt.containerservice.v2020_12_01.models.ContainerServiceStorageProfileTypes """ @@ -1336,13 +1334,13 @@ def __init__( class ContainerServiceNetworkProfile(msrest.serialization.Model): """Profile of network configuration. - :ivar network_plugin: Network plugin used for building Kubernetes network. Possible values - include: "azure", "kubenet". Default value: "kubenet". + :ivar network_plugin: Network plugin used for building Kubernetes network. Known values are: + "azure", "kubenet". Default value: "kubenet". :vartype network_plugin: str or ~azure.mgmt.containerservice.v2020_12_01.models.NetworkPlugin - :ivar network_policy: Network policy used for building Kubernetes network. Possible values - include: "calico", "azure". + :ivar network_policy: Network policy used for building Kubernetes network. Known values are: + "calico", "azure". :vartype network_policy: str or ~azure.mgmt.containerservice.v2020_12_01.models.NetworkPolicy - :ivar network_mode: Network mode used for building Kubernetes network. Possible values include: + :ivar network_mode: Network mode used for building Kubernetes network. Known values are: "transparent", "bridge". :vartype network_mode: str or ~azure.mgmt.containerservice.v2020_12_01.models.NetworkMode :ivar pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. @@ -1356,11 +1354,11 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): :ivar docker_bridge_cidr: A CIDR notation IP range assigned to the Docker bridge network. It must not overlap with any Subnet IP ranges or the Kubernetes service address range. :vartype docker_bridge_cidr: str - :ivar outbound_type: The outbound (egress) routing method. Possible values include: - "loadBalancer", "userDefinedRouting". Default value: "loadBalancer". + :ivar outbound_type: The outbound (egress) routing method. Known values are: "loadBalancer", + "userDefinedRouting". Default value: "loadBalancer". :vartype outbound_type: str or ~azure.mgmt.containerservice.v2020_12_01.models.OutboundType - :ivar load_balancer_sku: The load balancer sku for the managed cluster. Possible values - include: "standard", "basic". + :ivar load_balancer_sku: The load balancer sku for the managed cluster. Known values are: + "standard", "basic". :vartype load_balancer_sku: str or ~azure.mgmt.containerservice.v2020_12_01.models.LoadBalancerSku :ivar load_balancer_profile: Profile of the cluster load balancer. @@ -1391,27 +1389,27 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): def __init__( self, *, - network_plugin: Optional[Union[str, "NetworkPlugin"]] = "kubenet", - network_policy: Optional[Union[str, "NetworkPolicy"]] = None, - network_mode: Optional[Union[str, "NetworkMode"]] = None, + network_plugin: Optional[Union[str, "_models.NetworkPlugin"]] = "kubenet", + network_policy: Optional[Union[str, "_models.NetworkPolicy"]] = None, + network_mode: Optional[Union[str, "_models.NetworkMode"]] = None, pod_cidr: Optional[str] = "10.244.0.0/16", service_cidr: Optional[str] = "10.0.0.0/16", dns_service_ip: Optional[str] = "10.0.0.10", docker_bridge_cidr: Optional[str] = "172.17.0.1/16", - outbound_type: Optional[Union[str, "OutboundType"]] = "loadBalancer", - load_balancer_sku: Optional[Union[str, "LoadBalancerSku"]] = None, - load_balancer_profile: Optional["ManagedClusterLoadBalancerProfile"] = None, + outbound_type: Optional[Union[str, "_models.OutboundType"]] = "loadBalancer", + load_balancer_sku: Optional[Union[str, "_models.LoadBalancerSku"]] = None, + load_balancer_profile: Optional["_models.ManagedClusterLoadBalancerProfile"] = None, **kwargs ): """ - :keyword network_plugin: Network plugin used for building Kubernetes network. Possible values - include: "azure", "kubenet". Default value: "kubenet". + :keyword network_plugin: Network plugin used for building Kubernetes network. Known values are: + "azure", "kubenet". Default value: "kubenet". :paramtype network_plugin: str or ~azure.mgmt.containerservice.v2020_12_01.models.NetworkPlugin - :keyword network_policy: Network policy used for building Kubernetes network. Possible values - include: "calico", "azure". + :keyword network_policy: Network policy used for building Kubernetes network. Known values are: + "calico", "azure". :paramtype network_policy: str or ~azure.mgmt.containerservice.v2020_12_01.models.NetworkPolicy - :keyword network_mode: Network mode used for building Kubernetes network. Possible values - include: "transparent", "bridge". + :keyword network_mode: Network mode used for building Kubernetes network. Known values are: + "transparent", "bridge". :paramtype network_mode: str or ~azure.mgmt.containerservice.v2020_12_01.models.NetworkMode :keyword pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :paramtype pod_cidr: str @@ -1424,11 +1422,11 @@ def __init__( :keyword docker_bridge_cidr: A CIDR notation IP range assigned to the Docker bridge network. It must not overlap with any Subnet IP ranges or the Kubernetes service address range. :paramtype docker_bridge_cidr: str - :keyword outbound_type: The outbound (egress) routing method. Possible values include: - "loadBalancer", "userDefinedRouting". Default value: "loadBalancer". + :keyword outbound_type: The outbound (egress) routing method. Known values are: "loadBalancer", + "userDefinedRouting". Default value: "loadBalancer". :paramtype outbound_type: str or ~azure.mgmt.containerservice.v2020_12_01.models.OutboundType - :keyword load_balancer_sku: The load balancer sku for the managed cluster. Possible values - include: "standard", "basic". + :keyword load_balancer_sku: The load balancer sku for the managed cluster. Known values are: + "standard", "basic". :paramtype load_balancer_sku: str or ~azure.mgmt.containerservice.v2020_12_01.models.LoadBalancerSku :keyword load_balancer_profile: Profile of the cluster load balancer. @@ -1470,7 +1468,7 @@ class ContainerServiceSshConfiguration(msrest.serialization.Model): def __init__( self, *, - public_keys: List["ContainerServiceSshPublicKey"], + public_keys: List["_models.ContainerServiceSshPublicKey"], **kwargs ): """ @@ -1749,7 +1747,7 @@ class LinuxOSConfig(msrest.serialization.Model): def __init__( self, *, - sysctls: Optional["SysctlConfig"] = None, + sysctls: Optional["_models.SysctlConfig"] = None, transparent_huge_page_enabled: Optional[str] = None, transparent_huge_page_defrag: Optional[str] = None, swap_file_size_mb: Optional[int] = None, @@ -1812,8 +1810,8 @@ class MaintenanceConfiguration(SubResource): def __init__( self, *, - time_in_week: Optional[List["TimeInWeek"]] = None, - not_allowed_time: Optional[List["TimeSpan"]] = None, + time_in_week: Optional[List["_models.TimeInWeek"]] = None, + not_allowed_time: Optional[List["_models.TimeSpan"]] = None, **kwargs ): """ @@ -1851,7 +1849,7 @@ class MaintenanceConfigurationListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["MaintenanceConfiguration"]] = None, + value: Optional[List["_models.MaintenanceConfiguration"]] = None, **kwargs ): """ @@ -2053,27 +2051,27 @@ def __init__( self, *, location: str, - identity: Optional["ManagedClusterIdentity"] = None, + identity: Optional["_models.ManagedClusterIdentity"] = None, kubernetes_version: Optional[str] = None, dns_prefix: Optional[str] = None, - agent_pool_profiles: Optional[List["ManagedClusterAgentPoolProfile"]] = None, - linux_profile: Optional["ContainerServiceLinuxProfile"] = None, - windows_profile: Optional["ManagedClusterWindowsProfile"] = None, - service_principal_profile: Optional["ManagedClusterServicePrincipalProfile"] = None, - addon_profiles: Optional[Dict[str, "ManagedClusterAddonProfile"]] = None, - pod_identity_profile: Optional["ManagedClusterPodIdentityProfile"] = None, + agent_pool_profiles: Optional[List["_models.ManagedClusterAgentPoolProfile"]] = None, + linux_profile: Optional["_models.ContainerServiceLinuxProfile"] = None, + windows_profile: Optional["_models.ManagedClusterWindowsProfile"] = None, + service_principal_profile: Optional["_models.ManagedClusterServicePrincipalProfile"] = None, + addon_profiles: Optional[Dict[str, "_models.ManagedClusterAddonProfile"]] = None, + pod_identity_profile: Optional["_models.ManagedClusterPodIdentityProfile"] = None, node_resource_group: Optional[str] = None, enable_rbac: Optional[bool] = None, enable_pod_security_policy: Optional[bool] = None, - network_profile: Optional["ContainerServiceNetworkProfile"] = None, - aad_profile: Optional["ManagedClusterAADProfile"] = None, - auto_upgrade_profile: Optional["ManagedClusterAutoUpgradeProfile"] = None, - auto_scaler_profile: Optional["ManagedClusterPropertiesAutoScalerProfile"] = None, - api_server_access_profile: Optional["ManagedClusterAPIServerAccessProfile"] = None, + network_profile: Optional["_models.ContainerServiceNetworkProfile"] = None, + aad_profile: Optional["_models.ManagedClusterAADProfile"] = None, + auto_upgrade_profile: Optional["_models.ManagedClusterAutoUpgradeProfile"] = None, + auto_scaler_profile: Optional["_models.ManagedClusterPropertiesAutoScalerProfile"] = None, + api_server_access_profile: Optional["_models.ManagedClusterAPIServerAccessProfile"] = None, disk_encryption_set_id: Optional[str] = None, - identity_profile: Optional[Dict[str, "ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties"]] = None, + identity_profile: Optional[Dict[str, "_models.ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties"]] = None, tags: Optional[Dict[str, str]] = None, - sku: Optional["ManagedClusterSKU"] = None, + sku: Optional["_models.ManagedClusterSKU"] = None, **kwargs ): """ @@ -2389,7 +2387,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): range of 0 to 100 (inclusive) for user pools and in the range of 1 to 100 (inclusive) for system pools. The default value is 1. :vartype count: int - :ivar vm_size: Size of agent VMs. Possible values include: "Standard_A1", "Standard_A10", + :ivar vm_size: Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -2436,12 +2434,11 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar os_disk_type: OS disk type to be used for machines in a given agent pool. Allowed values are 'Ephemeral' and 'Managed'. If unspecified, defaults to 'Ephemeral' when the VM supports ephemeral OS and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults - to 'Managed'. May not be changed after creation. Possible values include: "Managed", - "Ephemeral". + to 'Managed'. May not be changed after creation. Known values are: "Managed", "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2020_12_01.models.OSDiskType :ivar kubelet_disk_type: KubeletDiskType determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. Currently allows one value, OS, - resulting in Kubelet using the OS disk for data. Possible values include: "OS". + resulting in Kubelet using the OS disk for data. Known values are: "OS". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2020_12_01.models.KubeletDiskType :ivar vnet_subnet_id: VNet SubnetID specifies the VNet's subnet identifier for nodes and maybe @@ -2452,7 +2449,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2020_12_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -2460,11 +2457,10 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :vartype min_count: int :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool - :ivar type: AgentPoolType represents types of an agent pool. Possible values include: + :ivar type: AgentPoolType represents types of an agent pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2020_12_01.models.AgentPoolType - :ivar mode: AgentPoolMode represents mode of an agent pool. Possible values include: "System", - "User". + :ivar mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", "User". :vartype mode: str or ~azure.mgmt.containerservice.v2020_12_01.models.AgentPoolMode :ivar orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -2485,12 +2481,11 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar enable_node_public_ip: Enable public IP for nodes. :vartype enable_node_public_ip: bool :ivar scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Possible values include: "Spot", "Regular". Default value: - "Regular". + priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_12_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy - for Spot virtual machine scale set. Default to Delete. Possible values include: "Delete", + for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", "Deallocate". Default value: "Delete". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_12_01.models.ScaleSetEvictionPolicy @@ -2561,32 +2556,32 @@ def __init__( self, *, count: Optional[int] = None, - vm_size: Optional[Union[str, "ContainerServiceVMSizeTypes"]] = None, + vm_size: Optional[Union[str, "_models.ContainerServiceVMSizeTypes"]] = None, os_disk_size_gb: Optional[int] = None, - os_disk_type: Optional[Union[str, "OSDiskType"]] = None, - kubelet_disk_type: Optional[Union[str, "KubeletDiskType"]] = None, + os_disk_type: Optional[Union[str, "_models.OSDiskType"]] = None, + kubelet_disk_type: Optional[Union[str, "_models.KubeletDiskType"]] = None, vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - type: Optional[Union[str, "AgentPoolType"]] = None, - mode: Optional[Union[str, "AgentPoolMode"]] = None, + type: Optional[Union[str, "_models.AgentPoolType"]] = None, + mode: Optional[Union[str, "_models.AgentPoolMode"]] = None, orchestrator_version: Optional[str] = None, - upgrade_settings: Optional["AgentPoolUpgradeSettings"] = None, + upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, - scale_set_priority: Optional[Union[str, "ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", spot_max_price: Optional[float] = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, proximity_placement_group_id: Optional[str] = None, - kubelet_config: Optional["KubeletConfig"] = None, - linux_os_config: Optional["LinuxOSConfig"] = None, + kubelet_config: Optional["_models.KubeletConfig"] = None, + linux_os_config: Optional["_models.LinuxOSConfig"] = None, enable_encryption_at_host: Optional[bool] = None, **kwargs ): @@ -2595,7 +2590,7 @@ def __init__( range of 0 to 100 (inclusive) for user pools and in the range of 1 to 100 (inclusive) for system pools. The default value is 1. :paramtype count: int - :keyword vm_size: Size of agent VMs. Possible values include: "Standard_A1", "Standard_A10", + :keyword vm_size: Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -2642,12 +2637,12 @@ def __init__( :keyword os_disk_type: OS disk type to be used for machines in a given agent pool. Allowed values are 'Ephemeral' and 'Managed'. If unspecified, defaults to 'Ephemeral' when the VM supports ephemeral OS and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, - defaults to 'Managed'. May not be changed after creation. Possible values include: "Managed", + defaults to 'Managed'. May not be changed after creation. Known values are: "Managed", "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2020_12_01.models.OSDiskType :keyword kubelet_disk_type: KubeletDiskType determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. Currently allows one value, OS, - resulting in Kubelet using the OS disk for data. Possible values include: "OS". + resulting in Kubelet using the OS disk for data. Known values are: "OS". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2020_12_01.models.KubeletDiskType :keyword vnet_subnet_id: VNet SubnetID specifies the VNet's subnet identifier for nodes and @@ -2658,7 +2653,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2020_12_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -2666,11 +2661,11 @@ def __init__( :paramtype min_count: int :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool - :keyword type: AgentPoolType represents types of an agent pool. Possible values include: + :keyword type: AgentPoolType represents types of an agent pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2020_12_01.models.AgentPoolType - :keyword mode: AgentPoolMode represents mode of an agent pool. Possible values include: - "System", "User". + :keyword mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", + "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2020_12_01.models.AgentPoolMode :keyword orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -2684,13 +2679,12 @@ def __init__( :keyword enable_node_public_ip: Enable public IP for nodes. :paramtype enable_node_public_ip: bool :keyword scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Possible values include: "Spot", "Regular". Default value: - "Regular". + priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_12_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction - policy for Spot virtual machine scale set. Default to Delete. Possible values include: - "Delete", "Deallocate". Default value: "Delete". + policy for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", + "Deallocate". Default value: "Delete". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_12_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: SpotMaxPrice to be used to specify the maximum price you are willing @@ -2759,7 +2753,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): range of 0 to 100 (inclusive) for user pools and in the range of 1 to 100 (inclusive) for system pools. The default value is 1. :vartype count: int - :ivar vm_size: Size of agent VMs. Possible values include: "Standard_A1", "Standard_A10", + :ivar vm_size: Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -2806,12 +2800,11 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar os_disk_type: OS disk type to be used for machines in a given agent pool. Allowed values are 'Ephemeral' and 'Managed'. If unspecified, defaults to 'Ephemeral' when the VM supports ephemeral OS and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults - to 'Managed'. May not be changed after creation. Possible values include: "Managed", - "Ephemeral". + to 'Managed'. May not be changed after creation. Known values are: "Managed", "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2020_12_01.models.OSDiskType :ivar kubelet_disk_type: KubeletDiskType determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. Currently allows one value, OS, - resulting in Kubelet using the OS disk for data. Possible values include: "OS". + resulting in Kubelet using the OS disk for data. Known values are: "OS". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2020_12_01.models.KubeletDiskType :ivar vnet_subnet_id: VNet SubnetID specifies the VNet's subnet identifier for nodes and maybe @@ -2822,7 +2815,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2020_12_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -2830,11 +2823,10 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :vartype min_count: int :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool - :ivar type: AgentPoolType represents types of an agent pool. Possible values include: + :ivar type: AgentPoolType represents types of an agent pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2020_12_01.models.AgentPoolType - :ivar mode: AgentPoolMode represents mode of an agent pool. Possible values include: "System", - "User". + :ivar mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", "User". :vartype mode: str or ~azure.mgmt.containerservice.v2020_12_01.models.AgentPoolMode :ivar orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -2855,12 +2847,11 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar enable_node_public_ip: Enable public IP for nodes. :vartype enable_node_public_ip: bool :ivar scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Possible values include: "Spot", "Regular". Default value: - "Regular". + priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_12_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy - for Spot virtual machine scale set. Default to Delete. Possible values include: "Delete", + for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", "Deallocate". Default value: "Delete". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_12_01.models.ScaleSetEvictionPolicy @@ -2937,32 +2928,32 @@ def __init__( *, name: str, count: Optional[int] = None, - vm_size: Optional[Union[str, "ContainerServiceVMSizeTypes"]] = None, + vm_size: Optional[Union[str, "_models.ContainerServiceVMSizeTypes"]] = None, os_disk_size_gb: Optional[int] = None, - os_disk_type: Optional[Union[str, "OSDiskType"]] = None, - kubelet_disk_type: Optional[Union[str, "KubeletDiskType"]] = None, + os_disk_type: Optional[Union[str, "_models.OSDiskType"]] = None, + kubelet_disk_type: Optional[Union[str, "_models.KubeletDiskType"]] = None, vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - type: Optional[Union[str, "AgentPoolType"]] = None, - mode: Optional[Union[str, "AgentPoolMode"]] = None, + type: Optional[Union[str, "_models.AgentPoolType"]] = None, + mode: Optional[Union[str, "_models.AgentPoolMode"]] = None, orchestrator_version: Optional[str] = None, - upgrade_settings: Optional["AgentPoolUpgradeSettings"] = None, + upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, - scale_set_priority: Optional[Union[str, "ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", spot_max_price: Optional[float] = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, proximity_placement_group_id: Optional[str] = None, - kubelet_config: Optional["KubeletConfig"] = None, - linux_os_config: Optional["LinuxOSConfig"] = None, + kubelet_config: Optional["_models.KubeletConfig"] = None, + linux_os_config: Optional["_models.LinuxOSConfig"] = None, enable_encryption_at_host: Optional[bool] = None, **kwargs ): @@ -2971,7 +2962,7 @@ def __init__( range of 0 to 100 (inclusive) for user pools and in the range of 1 to 100 (inclusive) for system pools. The default value is 1. :paramtype count: int - :keyword vm_size: Size of agent VMs. Possible values include: "Standard_A1", "Standard_A10", + :keyword vm_size: Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -3018,12 +3009,12 @@ def __init__( :keyword os_disk_type: OS disk type to be used for machines in a given agent pool. Allowed values are 'Ephemeral' and 'Managed'. If unspecified, defaults to 'Ephemeral' when the VM supports ephemeral OS and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, - defaults to 'Managed'. May not be changed after creation. Possible values include: "Managed", + defaults to 'Managed'. May not be changed after creation. Known values are: "Managed", "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2020_12_01.models.OSDiskType :keyword kubelet_disk_type: KubeletDiskType determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. Currently allows one value, OS, - resulting in Kubelet using the OS disk for data. Possible values include: "OS". + resulting in Kubelet using the OS disk for data. Known values are: "OS". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2020_12_01.models.KubeletDiskType :keyword vnet_subnet_id: VNet SubnetID specifies the VNet's subnet identifier for nodes and @@ -3034,7 +3025,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2020_12_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -3042,11 +3033,11 @@ def __init__( :paramtype min_count: int :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool - :keyword type: AgentPoolType represents types of an agent pool. Possible values include: + :keyword type: AgentPoolType represents types of an agent pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2020_12_01.models.AgentPoolType - :keyword mode: AgentPoolMode represents mode of an agent pool. Possible values include: - "System", "User". + :keyword mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", + "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2020_12_01.models.AgentPoolMode :keyword orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -3060,13 +3051,12 @@ def __init__( :keyword enable_node_public_ip: Enable public IP for nodes. :paramtype enable_node_public_ip: bool :keyword scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Possible values include: "Spot", "Regular". Default value: - "Regular". + priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2020_12_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction - policy for Spot virtual machine scale set. Default to Delete. Possible values include: - "Delete", "Deallocate". Default value: "Delete". + policy for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", + "Deallocate". Default value: "Delete". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2020_12_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: SpotMaxPrice to be used to specify the maximum price you are willing @@ -3139,8 +3129,8 @@ def __init__( class ManagedClusterAutoUpgradeProfile(msrest.serialization.Model): """Auto upgrade profile for a managed cluster. - :ivar upgrade_channel: upgrade channel for auto upgrade. Possible values include: "rapid", - "stable", "patch", "none". + :ivar upgrade_channel: upgrade channel for auto upgrade. Known values are: "rapid", "stable", + "patch", "none". :vartype upgrade_channel: str or ~azure.mgmt.containerservice.v2020_12_01.models.UpgradeChannel """ @@ -3151,11 +3141,11 @@ class ManagedClusterAutoUpgradeProfile(msrest.serialization.Model): def __init__( self, *, - upgrade_channel: Optional[Union[str, "UpgradeChannel"]] = None, + upgrade_channel: Optional[Union[str, "_models.UpgradeChannel"]] = None, **kwargs ): """ - :keyword upgrade_channel: upgrade channel for auto upgrade. Possible values include: "rapid", + :keyword upgrade_channel: upgrade channel for auto upgrade. Known values are: "rapid", "stable", "patch", "none". :paramtype upgrade_channel: str or ~azure.mgmt.containerservice.v2020_12_01.models.UpgradeChannel @@ -3178,8 +3168,8 @@ class ManagedClusterIdentity(msrest.serialization.Model): :ivar type: The type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ resource group in agent nodes. Type 'None' will not use MSI for the managed cluster, - service principal will be used instead. Possible values include: "SystemAssigned", - "UserAssigned", "None". + service principal will be used instead. Known values are: "SystemAssigned", "UserAssigned", + "None". :vartype type: str or ~azure.mgmt.containerservice.v2020_12_01.models.ResourceIdentityType :ivar user_assigned_identities: The user identity associated with the managed cluster. This identity will be used in control plane and only one user assigned identity is allowed. The user @@ -3204,15 +3194,15 @@ class ManagedClusterIdentity(msrest.serialization.Model): def __init__( self, *, - type: Optional[Union[str, "ResourceIdentityType"]] = None, - user_assigned_identities: Optional[Dict[str, "Components1Umhcm8SchemasManagedclusteridentityPropertiesUserassignedidentitiesAdditionalproperties"]] = None, + type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, + user_assigned_identities: Optional[Dict[str, "_models.Components1Umhcm8SchemasManagedclusteridentityPropertiesUserassignedidentitiesAdditionalproperties"]] = None, **kwargs ): """ :keyword type: The type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ resource group in agent nodes. Type 'None' will not use MSI for the managed - cluster, service principal will be used instead. Possible values include: "SystemAssigned", + cluster, service principal will be used instead. Known values are: "SystemAssigned", "UserAssigned", "None". :paramtype type: str or ~azure.mgmt.containerservice.v2020_12_01.models.ResourceIdentityType :keyword user_assigned_identities: The user identity associated with the managed cluster. This @@ -3252,7 +3242,7 @@ class ManagedClusterListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["ManagedCluster"]] = None, + value: Optional[List["_models.ManagedCluster"]] = None, **kwargs ): """ @@ -3306,10 +3296,10 @@ class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): def __init__( self, *, - managed_outbound_i_ps: Optional["ManagedClusterLoadBalancerProfileManagedOutboundIPs"] = None, - outbound_ip_prefixes: Optional["ManagedClusterLoadBalancerProfileOutboundIPPrefixes"] = None, - outbound_i_ps: Optional["ManagedClusterLoadBalancerProfileOutboundIPs"] = None, - effective_outbound_i_ps: Optional[List["ResourceReference"]] = None, + managed_outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileManagedOutboundIPs"] = None, + outbound_ip_prefixes: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPPrefixes"] = None, + outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPs"] = None, + effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, allocated_outbound_ports: Optional[int] = 0, idle_timeout_in_minutes: Optional[int] = 30, **kwargs @@ -3392,7 +3382,7 @@ class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.M def __init__( self, *, - public_ip_prefixes: Optional[List["ResourceReference"]] = None, + public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, **kwargs ): """ @@ -3418,7 +3408,7 @@ class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): def __init__( self, *, - public_i_ps: Optional[List["ResourceReference"]] = None, + public_i_ps: Optional[List["_models.ResourceReference"]] = None, **kwargs ): """ @@ -3442,8 +3432,8 @@ class ManagedClusterPodIdentity(msrest.serialization.Model): :vartype namespace: str :ivar identity: Required. Information of the user assigned identity. :vartype identity: ~azure.mgmt.containerservice.v2020_12_01.models.UserAssignedIdentity - :ivar provisioning_state: The current provisioning state of the pod identity. Possible values - include: "Assigned", "Updating", "Deleting", "Failed". + :ivar provisioning_state: The current provisioning state of the pod identity. Known values are: + "Assigned", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2020_12_01.models.ManagedClusterPodIdentityProvisioningState :ivar provisioning_info: @@ -3472,7 +3462,7 @@ def __init__( *, name: str, namespace: str, - identity: "UserAssignedIdentity", + identity: "_models.UserAssignedIdentity", **kwargs ): """ @@ -3561,8 +3551,8 @@ def __init__( self, *, enabled: Optional[bool] = None, - user_assigned_identities: Optional[List["ManagedClusterPodIdentity"]] = None, - user_assigned_identity_exceptions: Optional[List["ManagedClusterPodIdentityException"]] = None, + user_assigned_identities: Optional[List["_models.ManagedClusterPodIdentity"]] = None, + user_assigned_identity_exceptions: Optional[List["_models.ManagedClusterPodIdentityException"]] = None, **kwargs ): """ @@ -3595,7 +3585,7 @@ class ManagedClusterPodIdentityProvisioningInfo(msrest.serialization.Model): def __init__( self, *, - error: Optional["CloudError"] = None, + error: Optional["_models.CloudError"] = None, **kwargs ): """ @@ -3616,7 +3606,7 @@ class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): :ivar name: Pool name. :vartype name: str :ivar os_type: Required. OsType to be used to specify os type. Choose from Linux and Windows. - Default to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2020_12_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -3639,9 +3629,9 @@ def __init__( self, *, kubernetes_version: str, - os_type: Union[str, "OSType"] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", name: Optional[str] = None, - upgrades: Optional[List["ManagedClusterPoolUpgradeProfileUpgradesItem"]] = None, + upgrades: Optional[List["_models.ManagedClusterPoolUpgradeProfileUpgradesItem"]] = None, **kwargs ): """ @@ -3650,7 +3640,7 @@ def __init__( :keyword name: Pool name. :paramtype name: str :keyword os_type: Required. OsType to be used to specify os type. Choose from Linux and - Windows. Default to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Windows. Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2020_12_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: @@ -3700,7 +3690,7 @@ class ManagedClusterPropertiesAutoScalerProfile(msrest.serialization.Model): :ivar balance_similar_node_groups: :vartype balance_similar_node_groups: str - :ivar expander: Possible values include: "least-waste", "most-pods", "priority", "random". + :ivar expander: Known values are: "least-waste", "most-pods", "priority", "random". :vartype expander: str or ~azure.mgmt.containerservice.v2020_12_01.models.Expander :ivar max_empty_bulk_delete: :vartype max_empty_bulk_delete: str @@ -3758,7 +3748,7 @@ def __init__( self, *, balance_similar_node_groups: Optional[str] = None, - expander: Optional[Union[str, "Expander"]] = None, + expander: Optional[Union[str, "_models.Expander"]] = None, max_empty_bulk_delete: Optional[str] = None, max_graceful_termination_sec: Optional[str] = None, max_node_provision_time: Optional[str] = None, @@ -3779,7 +3769,7 @@ def __init__( """ :keyword balance_similar_node_groups: :paramtype balance_similar_node_groups: str - :keyword expander: Possible values include: "least-waste", "most-pods", "priority", "random". + :keyword expander: Known values are: "least-waste", "most-pods", "priority", "random". :paramtype expander: str or ~azure.mgmt.containerservice.v2020_12_01.models.Expander :keyword max_empty_bulk_delete: :paramtype max_empty_bulk_delete: str @@ -3873,9 +3863,9 @@ def __init__( class ManagedClusterSKU(msrest.serialization.Model): """ManagedClusterSKU. - :ivar name: Name of a managed cluster SKU. Possible values include: "Basic". + :ivar name: Name of a managed cluster SKU. Known values are: "Basic". :vartype name: str or ~azure.mgmt.containerservice.v2020_12_01.models.ManagedClusterSKUName - :ivar tier: Tier of a managed cluster SKU. Possible values include: "Paid", "Free". + :ivar tier: Tier of a managed cluster SKU. Known values are: "Paid", "Free". :vartype tier: str or ~azure.mgmt.containerservice.v2020_12_01.models.ManagedClusterSKUTier """ @@ -3887,14 +3877,14 @@ class ManagedClusterSKU(msrest.serialization.Model): def __init__( self, *, - name: Optional[Union[str, "ManagedClusterSKUName"]] = None, - tier: Optional[Union[str, "ManagedClusterSKUTier"]] = None, + name: Optional[Union[str, "_models.ManagedClusterSKUName"]] = None, + tier: Optional[Union[str, "_models.ManagedClusterSKUTier"]] = None, **kwargs ): """ - :keyword name: Name of a managed cluster SKU. Possible values include: "Basic". + :keyword name: Name of a managed cluster SKU. Known values are: "Basic". :paramtype name: str or ~azure.mgmt.containerservice.v2020_12_01.models.ManagedClusterSKUName - :keyword tier: Tier of a managed cluster SKU. Possible values include: "Paid", "Free". + :keyword tier: Tier of a managed cluster SKU. Known values are: "Paid", "Free". :paramtype tier: str or ~azure.mgmt.containerservice.v2020_12_01.models.ManagedClusterSKUTier """ super(ManagedClusterSKU, self).__init__(**kwargs) @@ -3943,8 +3933,8 @@ class ManagedClusterUpgradeProfile(msrest.serialization.Model): def __init__( self, *, - control_plane_profile: "ManagedClusterPoolUpgradeProfile", - agent_pool_profiles: List["ManagedClusterPoolUpgradeProfile"], + control_plane_profile: "_models.ManagedClusterPoolUpgradeProfile", + agent_pool_profiles: List["_models.ManagedClusterPoolUpgradeProfile"], **kwargs ): """ @@ -3986,7 +3976,7 @@ class ManagedClusterWindowsProfile(msrest.serialization.Model): "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!". :vartype admin_password: str :ivar license_type: 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". + Azure Hybrid User Benefits for Windows VMs. Known values are: "None", "Windows_Server". :vartype license_type: str or ~azure.mgmt.containerservice.v2020_12_01.models.LicenseType """ @@ -4005,7 +3995,7 @@ def __init__( *, admin_username: str, admin_password: Optional[str] = None, - license_type: Optional[Union[str, "LicenseType"]] = None, + license_type: Optional[Union[str, "_models.LicenseType"]] = None, **kwargs ): """ @@ -4026,7 +4016,7 @@ def __init__( "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!". :paramtype admin_password: str :keyword license_type: 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". + Azure Hybrid User Benefits for Windows VMs. Known values are: "None", "Windows_Server". :paramtype license_type: str or ~azure.mgmt.containerservice.v2020_12_01.models.LicenseType """ super(ManagedClusterWindowsProfile, self).__init__(**kwargs) @@ -4117,8 +4107,8 @@ def __init__( class PowerState(msrest.serialization.Model): """Describes the Power State of the cluster. - :ivar code: Tells whether the cluster is Running or Stopped. Possible values include: - "Running", "Stopped". + :ivar code: Tells whether the cluster is Running or Stopped. Known values are: "Running", + "Stopped". :vartype code: str or ~azure.mgmt.containerservice.v2020_12_01.models.Code """ @@ -4129,12 +4119,12 @@ class PowerState(msrest.serialization.Model): def __init__( self, *, - code: Optional[Union[str, "Code"]] = None, + code: Optional[Union[str, "_models.Code"]] = None, **kwargs ): """ - :keyword code: Tells whether the cluster is Running or Stopped. Possible values include: - "Running", "Stopped". + :keyword code: Tells whether the cluster is Running or Stopped. Known values are: "Running", + "Stopped". :paramtype code: str or ~azure.mgmt.containerservice.v2020_12_01.models.Code """ super(PowerState, self).__init__(**kwargs) @@ -4177,7 +4167,7 @@ class PrivateEndpointConnection(msrest.serialization.Model): :vartype name: str :ivar type: The resource type. :vartype type: str - :ivar provisioning_state: The current provisioning state. Possible values include: "Succeeded", + :ivar provisioning_state: The current provisioning state. Known values are: "Succeeded", "Creating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2020_12_01.models.PrivateEndpointConnectionProvisioningState @@ -4208,8 +4198,8 @@ class PrivateEndpointConnection(msrest.serialization.Model): def __init__( self, *, - private_endpoint: Optional["PrivateEndpoint"] = None, - private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, + private_endpoint: Optional["_models.PrivateEndpoint"] = None, + private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionState"] = None, **kwargs ): """ @@ -4243,7 +4233,7 @@ class PrivateEndpointConnectionListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["PrivateEndpointConnection"]] = None, + value: Optional[List["_models.PrivateEndpointConnection"]] = None, **kwargs ): """ @@ -4333,7 +4323,7 @@ class PrivateLinkResourcesListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["PrivateLinkResource"]] = None, + value: Optional[List["_models.PrivateLinkResource"]] = None, **kwargs ): """ @@ -4347,7 +4337,7 @@ def __init__( class PrivateLinkServiceConnectionState(msrest.serialization.Model): """The state of a private link service connection. - :ivar status: The private link service connection status. Possible values include: "Pending", + :ivar status: The private link service connection status. Known values are: "Pending", "Approved", "Rejected", "Disconnected". :vartype status: str or ~azure.mgmt.containerservice.v2020_12_01.models.ConnectionStatus :ivar description: The private link service connection description. @@ -4362,13 +4352,13 @@ class PrivateLinkServiceConnectionState(msrest.serialization.Model): def __init__( self, *, - status: Optional[Union[str, "ConnectionStatus"]] = None, + status: Optional[Union[str, "_models.ConnectionStatus"]] = None, description: Optional[str] = None, **kwargs ): """ - :keyword status: The private link service connection status. Possible values include: - "Pending", "Approved", "Rejected", "Disconnected". + :keyword status: The private link service connection status. Known values are: "Pending", + "Approved", "Rejected", "Disconnected". :paramtype status: str or ~azure.mgmt.containerservice.v2020_12_01.models.ConnectionStatus :keyword description: The private link service connection description. :paramtype description: str @@ -4622,15 +4612,15 @@ class SystemData(msrest.serialization.Model): :ivar created_by: The identity that created the resource. :vartype created_by: str - :ivar created_by_type: The type of identity that created the resource. Possible values include: + :ivar created_by_type: The type of identity that created the resource. Known values are: "User", "Application", "ManagedIdentity", "Key". :vartype created_by_type: str or ~azure.mgmt.containerservice.v2020_12_01.models.CreatedByType :ivar created_at: The timestamp of resource creation (UTC). :vartype created_at: ~datetime.datetime :ivar last_modified_by: The identity that last modified the resource. :vartype last_modified_by: str - :ivar last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". + :ivar last_modified_by_type: The type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", "Key". :vartype last_modified_by_type: str or ~azure.mgmt.containerservice.v2020_12_01.models.CreatedByType :ivar last_modified_at: The type of identity that last modified the resource. @@ -4650,26 +4640,26 @@ def __init__( self, *, created_by: Optional[str] = None, - created_by_type: Optional[Union[str, "CreatedByType"]] = None, + created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, created_at: Optional[datetime.datetime] = None, last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[Union[str, "CreatedByType"]] = None, + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, last_modified_at: Optional[datetime.datetime] = None, **kwargs ): """ :keyword created_by: The identity that created the resource. :paramtype created_by: str - :keyword created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". + :keyword created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", "Key". :paramtype created_by_type: str or ~azure.mgmt.containerservice.v2020_12_01.models.CreatedByType :keyword created_at: The timestamp of resource creation (UTC). :paramtype created_at: ~datetime.datetime :keyword last_modified_by: The identity that last modified the resource. :paramtype last_modified_by: str - :keyword last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". + :keyword last_modified_by_type: The type of identity that last modified the resource. Known + values are: "User", "Application", "ManagedIdentity", "Key". :paramtype last_modified_by_type: str or ~azure.mgmt.containerservice.v2020_12_01.models.CreatedByType :keyword last_modified_at: The type of identity that last modified the resource. @@ -4712,8 +4702,8 @@ def __init__( class TimeInWeek(msrest.serialization.Model): """Time in a week. - :ivar day: A day in a week. Possible values include: "Sunday", "Monday", "Tuesday", - "Wednesday", "Thursday", "Friday", "Saturday". + :ivar day: A day in a week. Known values are: "Sunday", "Monday", "Tuesday", "Wednesday", + "Thursday", "Friday", "Saturday". :vartype day: str or ~azure.mgmt.containerservice.v2020_12_01.models.WeekDay :ivar hour_slots: hour slots in a day. :vartype hour_slots: list[int] @@ -4727,13 +4717,13 @@ class TimeInWeek(msrest.serialization.Model): def __init__( self, *, - day: Optional[Union[str, "WeekDay"]] = None, + day: Optional[Union[str, "_models.WeekDay"]] = None, hour_slots: Optional[List[int]] = None, **kwargs ): """ - :keyword day: A day in a week. Possible values include: "Sunday", "Monday", "Tuesday", - "Wednesday", "Thursday", "Friday", "Saturday". + :keyword day: A day in a week. Known values are: "Sunday", "Monday", "Tuesday", "Wednesday", + "Thursday", "Friday", "Saturday". :paramtype day: str or ~azure.mgmt.containerservice.v2020_12_01.models.WeekDay :keyword hour_slots: hour slots in a day. :paramtype hour_slots: list[int] diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/models/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/models/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/operations/__init__.py index 3942e0ca6a01..f0e265d9f2f4 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/operations/__init__.py @@ -14,6 +14,9 @@ from ._private_link_resources_operations import PrivateLinkResourcesOperations from ._resolve_private_link_service_id_operations import ResolvePrivateLinkServiceIdOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'Operations', 'ManagedClustersOperations', @@ -23,3 +26,5 @@ 'PrivateLinkResourcesOperations', 'ResolvePrivateLinkServiceIdOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/operations/_agent_pools_operations.py index 3815e879a359..fbc8ae77123f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/operations/_agent_pools_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -35,9 +35,12 @@ def build_list_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-12-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools") # pylint: disable=line-too-long path_format_arguments = { @@ -49,18 +52,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -72,9 +73,12 @@ def build_get_request( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-12-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -87,18 +91,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -109,14 +111,17 @@ def build_create_or_update_request_initial( resource_name: str, agent_pool_name: str, *, - json: JSONType = None, + json: Optional[_models.AgentPool] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-12-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -129,20 +134,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -156,9 +159,12 @@ def build_delete_request_initial( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-12-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -171,18 +177,16 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -194,9 +198,12 @@ def build_get_upgrade_profile_request( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-12-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default") # pylint: disable=line-too-long path_format_arguments = { @@ -209,18 +216,16 @@ def build_get_upgrade_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -231,9 +236,12 @@ def build_get_available_agent_pool_versions_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-12-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions") # pylint: disable=line-too-long path_format_arguments = { @@ -245,18 +253,16 @@ def build_get_available_agent_pool_versions_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -268,9 +274,12 @@ def build_upgrade_node_image_version_request_initial( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-12-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion") # pylint: disable=line-too-long path_format_arguments = { @@ -283,42 +292,38 @@ def build_upgrade_node_image_version_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class AgentPoolsOperations(object): - """AgentPoolsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class AgentPoolsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2020_12_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2020_12_01.ContainerServiceClient`'s + :attr:`agent_pools` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -326,7 +331,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Iterable["_models.AgentPoolListResult"]: + ) -> Iterable[_models.AgentPoolListResult]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. The operation returns properties @@ -342,13 +347,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_12_01.models.AgentPoolListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-12-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -358,9 +366,11 @@ def prepare_request(next_link=None): resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -370,9 +380,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -412,7 +424,7 @@ def get( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPool": + ) -> _models.AgentPool: """Gets the agent pool. Gets the details of the agent pool by managed cluster and resource group. @@ -428,13 +440,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2020_12_01.models.AgentPool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-12-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] request = build_get_request( @@ -444,11 +459,13 @@ def get( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -474,17 +491,20 @@ def _create_or_update_initial( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> "_models.AgentPool": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] + ) -> _models.AgentPool: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-12-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] _json = self._serialize.body(parameters, 'AgentPool') @@ -497,11 +517,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -532,9 +554,9 @@ def begin_create_or_update( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> LROPoller["_models.AgentPool"]: + ) -> LROPoller[_models.AgentPool]: """Creates or updates an agent pool. Creates or updates an agent pool in the specified managed cluster. @@ -560,17 +582,20 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_12_01.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-12-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, @@ -578,20 +603,27 @@ def begin_create_or_update( 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): - response = pipeline_response.http_response deserialized = self._deserialize('AgentPool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -611,13 +643,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements agent_pool_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-12-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -627,11 +662,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -678,21 +715,26 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-12-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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) @@ -702,8 +744,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -723,7 +771,7 @@ def get_upgrade_profile( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPoolUpgradeProfile": + ) -> _models.AgentPoolUpgradeProfile: """Gets upgrade profile for an agent pool. Gets the details of the upgrade profile for an agent pool with a specified resource group and @@ -740,13 +788,16 @@ def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2020_12_01.models.AgentPoolUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-12-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] request = build_get_upgrade_profile_request( @@ -756,11 +807,13 @@ def get_upgrade_profile( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -787,7 +840,7 @@ def get_available_agent_pool_versions( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.AgentPoolAvailableVersions": + ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported versions for the specified agent pool. Gets a list of supported versions for the specified agent pool. @@ -801,13 +854,16 @@ def get_available_agent_pool_versions( :rtype: ~azure.mgmt.containerservice.v2020_12_01.models.AgentPoolAvailableVersions :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolAvailableVersions"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-12-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] request = build_get_available_agent_pool_versions_request( @@ -816,11 +872,13 @@ def get_available_agent_pool_versions( resource_name=resource_name, api_version=api_version, template_url=self.get_available_agent_pool_versions.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -847,14 +905,17 @@ def _upgrade_node_image_version_initial( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> Optional["_models.AgentPool"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.AgentPool"]] + ) -> Optional[_models.AgentPool]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-12-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] request = build_upgrade_node_image_version_request_initial( @@ -864,11 +925,13 @@ def _upgrade_node_image_version_initial( agent_pool_name=agent_pool_name, api_version=api_version, template_url=self._upgrade_node_image_version_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -898,7 +961,7 @@ def begin_upgrade_node_image_version( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> LROPoller["_models.AgentPool"]: + ) -> LROPoller[_models.AgentPool]: """Upgrade node image version of an agent pool to the latest. Upgrade node image version of an agent pool to the latest. @@ -922,35 +985,45 @@ def begin_upgrade_node_image_version( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_12_01.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-12-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._upgrade_node_image_version_initial( + raw_result = self._upgrade_node_image_version_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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): - response = pipeline_response.http_response deserialized = self._deserialize('AgentPool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/operations/_maintenance_configurations_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/operations/_maintenance_configurations_operations.py index 2d865b38947a..74057e5a7aac 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/operations/_maintenance_configurations_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/operations/_maintenance_configurations_operations.py @@ -16,12 +16,12 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -33,9 +33,12 @@ def build_list_by_managed_cluster_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-12-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations") # pylint: disable=line-too-long path_format_arguments = { @@ -47,18 +50,16 @@ def build_list_by_managed_cluster_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -70,9 +71,12 @@ def build_get_request( config_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-12-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long path_format_arguments = { @@ -85,18 +89,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -107,14 +109,17 @@ def build_create_or_update_request( resource_name: str, config_name: str, *, - json: JSONType = None, + json: Optional[_models.MaintenanceConfiguration] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-12-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long path_format_arguments = { @@ -127,20 +132,18 @@ def build_create_or_update_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -154,9 +157,12 @@ def build_delete_request( config_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-12-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long path_format_arguments = { @@ -169,42 +175,38 @@ def build_delete_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class MaintenanceConfigurationsOperations(object): - """MaintenanceConfigurationsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class MaintenanceConfigurationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2020_12_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2020_12_01.ContainerServiceClient`'s + :attr:`maintenance_configurations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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_by_managed_cluster( @@ -212,7 +214,7 @@ def list_by_managed_cluster( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Iterable["_models.MaintenanceConfigurationListResult"]: + ) -> Iterable[_models.MaintenanceConfigurationListResult]: """Gets a list of maintenance configurations in the specified managed cluster. Gets a list of maintenance configurations in the specified managed cluster. The operation @@ -229,13 +231,16 @@ def list_by_managed_cluster( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_12_01.models.MaintenanceConfigurationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-12-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfigurationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfigurationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -245,9 +250,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=self.list_by_managed_cluster.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -257,9 +264,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -299,7 +308,7 @@ def get( resource_name: str, config_name: str, **kwargs: Any - ) -> "_models.MaintenanceConfiguration": + ) -> _models.MaintenanceConfiguration: """Gets the maintenance configuration. Gets the details of maintenance configurations by managed cluster and resource group. @@ -315,13 +324,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2020_12_01.models.MaintenanceConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfiguration"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-12-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] request = build_get_request( @@ -331,11 +343,13 @@ def get( config_name=config_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -362,9 +376,9 @@ def create_or_update( resource_group_name: str, resource_name: str, config_name: str, - parameters: "_models.MaintenanceConfiguration", + parameters: _models.MaintenanceConfiguration, **kwargs: Any - ) -> "_models.MaintenanceConfiguration": + ) -> _models.MaintenanceConfiguration: """Creates or updates a maintenance configurations. Creates or updates a maintenance configuration in the specified managed cluster. @@ -383,14 +397,17 @@ def create_or_update( :rtype: ~azure.mgmt.containerservice.v2020_12_01.models.MaintenanceConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfiguration"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2020-12-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] _json = self._serialize.body(parameters, 'MaintenanceConfiguration') @@ -403,11 +420,13 @@ def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -451,13 +470,16 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-12-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -467,11 +489,13 @@ def delete( # pylint: disable=inconsistent-return-statements config_name=config_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/operations/_managed_clusters_operations.py index 4ebcad30c7f8..293f2c66f701 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/operations/_managed_clusters_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -33,9 +33,12 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-12-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters") path_format_arguments = { @@ -45,18 +48,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -66,9 +67,12 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-12-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters") # pylint: disable=line-too-long path_format_arguments = { @@ -79,18 +83,16 @@ def build_list_by_resource_group_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -101,9 +103,12 @@ def build_get_upgrade_profile_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-12-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default") # pylint: disable=line-too-long path_format_arguments = { @@ -115,18 +120,16 @@ def build_get_upgrade_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -138,9 +141,12 @@ def build_get_access_profile_request( role_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-12-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -153,18 +159,16 @@ def build_get_access_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -175,9 +179,12 @@ def build_list_cluster_admin_credentials_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-12-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -189,18 +196,16 @@ def build_list_cluster_admin_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -211,9 +216,12 @@ def build_list_cluster_user_credentials_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-12-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -225,18 +233,16 @@ def build_list_cluster_user_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -247,9 +253,12 @@ def build_list_cluster_monitoring_user_credentials_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-12-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -261,18 +270,16 @@ def build_list_cluster_monitoring_user_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -283,9 +290,12 @@ def build_get_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-12-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -297,18 +307,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -318,14 +326,17 @@ def build_create_or_update_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedCluster] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-12-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -337,20 +348,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -362,14 +371,17 @@ def build_update_tags_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.TagsObject] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-12-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -381,20 +393,18 @@ def build_update_tags_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -407,9 +417,12 @@ def build_delete_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-12-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -421,18 +434,16 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -442,14 +453,17 @@ def build_reset_service_principal_profile_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedClusterServicePrincipalProfile] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-12-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile") # pylint: disable=line-too-long path_format_arguments = { @@ -461,20 +475,18 @@ def build_reset_service_principal_profile_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -486,14 +498,17 @@ def build_reset_aad_profile_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedClusterAADProfile] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-12-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile") # pylint: disable=line-too-long path_format_arguments = { @@ -505,20 +520,18 @@ def build_reset_aad_profile_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -531,9 +544,12 @@ def build_rotate_cluster_certificates_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-12-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates") # pylint: disable=line-too-long path_format_arguments = { @@ -545,18 +561,16 @@ def build_rotate_cluster_certificates_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -567,9 +581,12 @@ def build_stop_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-12-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop") # pylint: disable=line-too-long path_format_arguments = { @@ -581,18 +598,16 @@ def build_stop_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -603,9 +618,12 @@ def build_start_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-12-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start") # pylint: disable=line-too-long path_format_arguments = { @@ -617,48 +635,44 @@ def build_start_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class ManagedClustersOperations(object): # pylint: disable=too-many-public-methods - """ManagedClustersOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ManagedClustersOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2020_12_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2020_12_01.ContainerServiceClient`'s + :attr:`managed_clusters` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> Iterable["_models.ManagedClusterListResult"]: + ) -> Iterable[_models.ManagedClusterListResult]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. The operation returns properties @@ -671,13 +685,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_12_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-12-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -685,9 +702,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -695,9 +714,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -735,7 +756,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.ManagedClusterListResult"]: + ) -> Iterable[_models.ManagedClusterListResult]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. The operation returns @@ -750,13 +771,16 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_12_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-12-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -765,9 +789,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -776,9 +802,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -817,7 +845,7 @@ def get_upgrade_profile( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedClusterUpgradeProfile": + ) -> _models.ManagedClusterUpgradeProfile: """Gets upgrade profile for a managed cluster. Gets the details of the upgrade profile for a managed cluster with a specified resource group @@ -832,13 +860,16 @@ def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2020_12_01.models.ManagedClusterUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-12-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] request = build_get_upgrade_profile_request( @@ -847,11 +878,13 @@ def get_upgrade_profile( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -879,7 +912,7 @@ def get_access_profile( resource_name: str, role_name: str, **kwargs: Any - ) -> "_models.ManagedClusterAccessProfile": + ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. Gets the accessProfile for the specified role name of the managed cluster with a specified @@ -900,13 +933,16 @@ def get_access_profile( :rtype: ~azure.mgmt.containerservice.v2020_12_01.models.ManagedClusterAccessProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterAccessProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-12-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] request = build_get_access_profile_request( @@ -916,11 +952,13 @@ def get_access_profile( role_name=role_name, api_version=api_version, template_url=self.get_access_profile.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -947,7 +985,7 @@ def list_cluster_admin_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster admin credential of a managed cluster. Gets cluster admin credential of the managed cluster with a specified resource group and name. @@ -961,13 +999,16 @@ def list_cluster_admin_credentials( :rtype: ~azure.mgmt.containerservice.v2020_12_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-12-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_admin_credentials_request( @@ -976,11 +1017,13 @@ def list_cluster_admin_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_admin_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1007,7 +1050,7 @@ def list_cluster_user_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster user credential of a managed cluster. Gets cluster user credential of the managed cluster with a specified resource group and name. @@ -1021,13 +1064,16 @@ def list_cluster_user_credentials( :rtype: ~azure.mgmt.containerservice.v2020_12_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-12-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_user_credentials_request( @@ -1036,11 +1082,13 @@ def list_cluster_user_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1067,7 +1115,7 @@ def list_cluster_monitoring_user_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster monitoring user credential of a managed cluster. Gets cluster monitoring user credential of the managed cluster with a specified resource group @@ -1082,13 +1130,16 @@ def list_cluster_monitoring_user_credentials( :rtype: ~azure.mgmt.containerservice.v2020_12_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-12-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_monitoring_user_credentials_request( @@ -1097,11 +1148,13 @@ def list_cluster_monitoring_user_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1128,7 +1181,7 @@ def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedCluster": + ) -> _models.ManagedCluster: """Gets a managed cluster. Gets the details of the managed cluster with a specified resource group and name. @@ -1142,13 +1195,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2020_12_01.models.ManagedCluster :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-12-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] request = build_get_request( @@ -1157,11 +1213,13 @@ def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1186,17 +1244,20 @@ def _create_or_update_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-12-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'ManagedCluster') @@ -1208,11 +1269,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1242,9 +1305,9 @@ def begin_create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> LROPoller["_models.ManagedCluster"]: + ) -> LROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. Creates or updates a managed cluster with the specified configuration for agents and Kubernetes @@ -1270,37 +1333,47 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_12_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-12-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1317,17 +1390,20 @@ def _update_tags_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-12-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'TagsObject') @@ -1339,11 +1415,13 @@ def _update_tags_initial( content_type=content_type, json=_json, template_url=self._update_tags_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1369,9 +1447,9 @@ def begin_update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> LROPoller["_models.ManagedCluster"]: + ) -> LROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates a managed cluster with the specified tags. @@ -1396,37 +1474,47 @@ def begin_update_tags( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2020_12_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-12-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._update_tags_initial( + raw_result = self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1445,13 +1533,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-12-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -1460,11 +1551,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1508,20 +1601,25 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-12-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_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) @@ -1531,8 +1629,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1549,17 +1653,20 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2020-12-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') @@ -1571,11 +1678,13 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re content_type=content_type, json=_json, template_url=self._reset_service_principal_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1597,7 +1706,7 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> LROPoller[None]: """Reset Service Principal Profile of a managed cluster. @@ -1624,23 +1733,28 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-12-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._reset_service_principal_profile_initial( + raw_result = self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1650,8 +1764,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1668,17 +1788,20 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-12-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') @@ -1690,11 +1813,13 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement content_type=content_type, json=_json, template_url=self._reset_aad_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1716,7 +1841,7 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> LROPoller[None]: """Reset AAD Profile of a managed cluster. @@ -1742,23 +1867,28 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-12-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._reset_aad_profile_initial( + raw_result = self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1768,8 +1898,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1788,13 +1924,16 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-12-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_rotate_cluster_certificates_request_initial( @@ -1803,11 +1942,13 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return resource_name=resource_name, api_version=api_version, template_url=self._rotate_cluster_certificates_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1851,20 +1992,25 @@ def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-st :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-12-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._rotate_cluster_certificates_initial( + raw_result = self._rotate_cluster_certificates_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) @@ -1874,8 +2020,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1894,13 +2046,16 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-12-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_stop_request_initial( @@ -1909,11 +2064,13 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_name, api_version=api_version, template_url=self._stop_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1957,20 +2114,25 @@ def begin_stop( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-12-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._stop_initial( + raw_result = self._stop_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) @@ -1980,8 +2142,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2000,13 +2168,16 @@ def _start_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-12-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_start_request_initial( @@ -2015,11 +2186,13 @@ def _start_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_name, api_version=api_version, template_url=self._start_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2063,20 +2236,25 @@ def begin_start( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-12-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._start_initial( + raw_result = self._start_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) @@ -2086,8 +2264,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/operations/_operations.py index 77ead0a3f49f..586ba5759e64 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/operations/_operations.py @@ -16,6 +16,7 @@ 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 @@ -29,55 +30,54 @@ def build_list_request( **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-12-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.ContainerService/operations") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class Operations(object): - """Operations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2020_12_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2020_12_01.ContainerServiceClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> Iterable["_models.OperationListResult"]: + ) -> Iterable[_models.OperationListResult]: """Gets a list of compute operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -86,31 +86,38 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2020_12_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-12-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/operations/_private_endpoint_connections_operations.py index ab68f8b93846..529f804ca58a 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/operations/_private_endpoint_connections_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast from msrest import Serializer @@ -16,13 +16,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -34,9 +34,12 @@ def build_list_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-12-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections") # pylint: disable=line-too-long path_format_arguments = { @@ -48,18 +51,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -71,9 +72,12 @@ def build_get_request( private_endpoint_connection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-12-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -86,18 +90,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -108,14 +110,17 @@ def build_update_request( resource_name: str, private_endpoint_connection_name: str, *, - json: JSONType = None, + json: Optional[_models.PrivateEndpointConnection] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-12-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -128,20 +133,18 @@ def build_update_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -155,9 +158,12 @@ def build_delete_request_initial( private_endpoint_connection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-12-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -170,42 +176,38 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class PrivateEndpointConnectionsOperations(object): - """PrivateEndpointConnectionsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class PrivateEndpointConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2020_12_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2020_12_01.ContainerServiceClient`'s + :attr:`private_endpoint_connections` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -213,7 +215,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnectionListResult": + ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. Gets a list of private endpoint connections in the specified managed cluster. The operation @@ -228,13 +230,16 @@ def list( :rtype: ~azure.mgmt.containerservice.v2020_12_01.models.PrivateEndpointConnectionListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-12-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] request = build_list_request( @@ -243,11 +248,13 @@ def list( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -275,7 +282,7 @@ def get( resource_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Gets the private endpoint connection. Gets the details of the private endpoint connection by managed cluster and resource group. @@ -291,13 +298,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2020_12_01.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-12-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] request = build_get_request( @@ -307,11 +317,13 @@ def get( private_endpoint_connection_name=private_endpoint_connection_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -338,9 +350,9 @@ def update( resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - parameters: "_models.PrivateEndpointConnection", + parameters: _models.PrivateEndpointConnection, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. Updates a private endpoint connection in the specified managed cluster. @@ -358,14 +370,17 @@ def update( :rtype: ~azure.mgmt.containerservice.v2020_12_01.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-12-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] _json = self._serialize.body(parameters, 'PrivateEndpointConnection') @@ -378,11 +393,13 @@ def update( content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -410,13 +427,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-12-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -426,11 +446,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name=private_endpoint_connection_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -477,21 +499,26 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-12-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -501,8 +528,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/operations/_private_link_resources_operations.py index 22fa441a21cc..fd1fb9720e43 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/operations/_private_link_resources_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/operations/_private_link_resources_operations.py @@ -15,6 +15,7 @@ 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 @@ -31,9 +32,12 @@ def build_list_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-12-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources") # pylint: disable=line-too-long path_format_arguments = { @@ -45,42 +49,38 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class PrivateLinkResourcesOperations(object): - """PrivateLinkResourcesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class PrivateLinkResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2020_12_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2020_12_01.ContainerServiceClient`'s + :attr:`private_link_resources` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -88,7 +88,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.PrivateLinkResourcesListResult": + ) -> _models.PrivateLinkResourcesListResult: """Gets a list of private link resources in the specified managed cluster. Gets a list of private link resources in the specified managed cluster. The operation returns @@ -103,13 +103,16 @@ def list( :rtype: ~azure.mgmt.containerservice.v2020_12_01.models.PrivateLinkResourcesListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourcesListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-12-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] request = build_list_request( @@ -118,11 +121,13 @@ def list( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/operations/_resolve_private_link_service_id_operations.py index 2315282a2348..462ec3e1c801 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/operations/_resolve_private_link_service_id_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_12_01/operations/_resolve_private_link_service_id_operations.py @@ -15,12 +15,12 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -31,14 +31,17 @@ def build_post_request( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.PrivateLinkResource] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-12-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId") # pylint: disable=line-too-long path_format_arguments = { @@ -50,55 +53,51 @@ def build_post_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs ) -class ResolvePrivateLinkServiceIdOperations(object): - """ResolvePrivateLinkServiceIdOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ResolvePrivateLinkServiceIdOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2020_12_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2020_12_01.ContainerServiceClient`'s + :attr:`resolve_private_link_service_id` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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 post( self, resource_group_name: str, resource_name: str, - parameters: "_models.PrivateLinkResource", + parameters: _models.PrivateLinkResource, **kwargs: Any - ) -> "_models.PrivateLinkResource": + ) -> _models.PrivateLinkResource: """Gets the private link service ID for the specified managed cluster. Gets the private link service ID the specified managed cluster. @@ -115,14 +114,17 @@ def post( :rtype: ~azure.mgmt.containerservice.v2020_12_01.models.PrivateLinkResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2020-12-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-12-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] _json = self._serialize.body(parameters, 'PrivateLinkResource') @@ -134,11 +136,13 @@ def post( content_type=content_type, json=_json, template_url=self.post.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/__init__.py index 53c675bd95e2..37a5f9e02e6f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._container_service_client import ContainerServiceClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['ContainerServiceClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/_container_service_client.py index 953e092d6c95..6573744c0f54 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/_container_service_client.py @@ -72,13 +72,27 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.managed_clusters = ManagedClustersOperations(self._client, self._config, self._serialize, self._deserialize) - self.maintenance_configurations = MaintenanceConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) - self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) - self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_clusters = ManagedClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.maintenance_configurations = MaintenanceConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.agent_pools = AgentPoolsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/__init__.py index 53c675bd95e2..37a5f9e02e6f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._container_service_client import ContainerServiceClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['ContainerServiceClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/_container_service_client.py index f5d854616c52..d82390031685 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/_container_service_client.py @@ -73,13 +73,27 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.managed_clusters = ManagedClustersOperations(self._client, self._config, self._serialize, self._deserialize) - self.maintenance_configurations = MaintenanceConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) - self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) - self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_clusters = ManagedClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.maintenance_configurations = MaintenanceConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.agent_pools = AgentPoolsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/operations/__init__.py index 3942e0ca6a01..f0e265d9f2f4 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/operations/__init__.py @@ -14,6 +14,9 @@ from ._private_link_resources_operations import PrivateLinkResourcesOperations from ._resolve_private_link_service_id_operations import ResolvePrivateLinkServiceIdOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'Operations', 'ManagedClustersOperations', @@ -23,3 +26,5 @@ 'PrivateLinkResourcesOperations', 'ResolvePrivateLinkServiceIdOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/operations/_agent_pools_operations.py index ed84ace2cc05..261e85dc56b7 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/operations/_agent_pools_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. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ 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 @@ -26,26 +27,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class AgentPoolsOperations: - """AgentPoolsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_02_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_02_01.aio.ContainerServiceClient`'s + :attr:`agent_pools` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -53,7 +52,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> AsyncIterable["_models.AgentPoolListResult"]: + ) -> AsyncIterable[_models.AgentPoolListResult]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. The operation returns properties @@ -69,13 +68,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_02_01.models.AgentPoolListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -85,9 +87,11 @@ def prepare_request(next_link=None): resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -97,9 +101,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -139,7 +145,7 @@ async def get( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPool": + ) -> _models.AgentPool: """Gets the agent pool. Gets the details of the agent pool by managed cluster and resource group. @@ -155,13 +161,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2021_02_01.models.AgentPool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] request = build_get_request( @@ -171,11 +180,13 @@ async def get( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -201,17 +212,20 @@ async def _create_or_update_initial( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> "_models.AgentPool": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] + ) -> _models.AgentPool: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] _json = self._serialize.body(parameters, 'AgentPool') @@ -224,11 +238,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -259,9 +275,9 @@ async def begin_create_or_update( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> AsyncLROPoller["_models.AgentPool"]: + ) -> AsyncLROPoller[_models.AgentPool]: """Creates or updates an agent pool. Creates or updates an agent pool in the specified managed cluster. @@ -288,17 +304,20 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_02_01.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, @@ -306,20 +325,27 @@ async def begin_create_or_update( 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): - response = pipeline_response.http_response deserialized = self._deserialize('AgentPool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -339,13 +365,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements agent_pool_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-02-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -355,11 +384,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -406,21 +437,26 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-02-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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) @@ -430,8 +466,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -451,7 +493,7 @@ async def get_upgrade_profile( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPoolUpgradeProfile": + ) -> _models.AgentPoolUpgradeProfile: """Gets upgrade profile for an agent pool. Gets the details of the upgrade profile for an agent pool with a specified resource group and @@ -468,13 +510,16 @@ async def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2021_02_01.models.AgentPoolUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-02-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] request = build_get_upgrade_profile_request( @@ -484,11 +529,13 @@ async def get_upgrade_profile( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -515,7 +562,7 @@ async def get_available_agent_pool_versions( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.AgentPoolAvailableVersions": + ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported versions for the specified agent pool. Gets a list of supported versions for the specified agent pool. @@ -529,13 +576,16 @@ async def get_available_agent_pool_versions( :rtype: ~azure.mgmt.containerservice.v2021_02_01.models.AgentPoolAvailableVersions :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolAvailableVersions"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] request = build_get_available_agent_pool_versions_request( @@ -544,11 +594,13 @@ async def get_available_agent_pool_versions( resource_name=resource_name, api_version=api_version, template_url=self.get_available_agent_pool_versions.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -575,14 +627,17 @@ async def _upgrade_node_image_version_initial( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> Optional["_models.AgentPool"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.AgentPool"]] + ) -> Optional[_models.AgentPool]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-02-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] request = build_upgrade_node_image_version_request_initial( @@ -592,11 +647,13 @@ async def _upgrade_node_image_version_initial( agent_pool_name=agent_pool_name, api_version=api_version, template_url=self._upgrade_node_image_version_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -626,7 +683,7 @@ async def begin_upgrade_node_image_version( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> AsyncLROPoller["_models.AgentPool"]: + ) -> AsyncLROPoller[_models.AgentPool]: """Upgrade node image version of an agent pool to the latest. Upgrade node image version of an agent pool to the latest. @@ -651,35 +708,45 @@ async def begin_upgrade_node_image_version( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_02_01.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._upgrade_node_image_version_initial( + raw_result = await self._upgrade_node_image_version_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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): - response = pipeline_response.http_response deserialized = self._deserialize('AgentPool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/operations/_maintenance_configurations_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/operations/_maintenance_configurations_operations.py index 0bc90e203c40..206cda0e4f2a 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/operations/_maintenance_configurations_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/operations/_maintenance_configurations_operations.py @@ -15,6 +15,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -24,26 +25,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class MaintenanceConfigurationsOperations: - """MaintenanceConfigurationsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_02_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_02_01.aio.ContainerServiceClient`'s + :attr:`maintenance_configurations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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_by_managed_cluster( @@ -51,7 +50,7 @@ def list_by_managed_cluster( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> AsyncIterable["_models.MaintenanceConfigurationListResult"]: + ) -> AsyncIterable[_models.MaintenanceConfigurationListResult]: """Gets a list of maintenance configurations in the specified managed cluster. Gets a list of maintenance configurations in the specified managed cluster. The operation @@ -68,13 +67,16 @@ def list_by_managed_cluster( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_02_01.models.MaintenanceConfigurationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfigurationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfigurationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -84,9 +86,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=self.list_by_managed_cluster.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -96,9 +100,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -138,7 +144,7 @@ async def get( resource_name: str, config_name: str, **kwargs: Any - ) -> "_models.MaintenanceConfiguration": + ) -> _models.MaintenanceConfiguration: """Gets the maintenance configuration. Gets the details of maintenance configurations by managed cluster and resource group. @@ -154,13 +160,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2021_02_01.models.MaintenanceConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfiguration"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-02-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] request = build_get_request( @@ -170,11 +179,13 @@ async def get( config_name=config_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -201,9 +212,9 @@ async def create_or_update( resource_group_name: str, resource_name: str, config_name: str, - parameters: "_models.MaintenanceConfiguration", + parameters: _models.MaintenanceConfiguration, **kwargs: Any - ) -> "_models.MaintenanceConfiguration": + ) -> _models.MaintenanceConfiguration: """Creates or updates a maintenance configurations. Creates or updates a maintenance configuration in the specified managed cluster. @@ -222,14 +233,17 @@ async def create_or_update( :rtype: ~azure.mgmt.containerservice.v2021_02_01.models.MaintenanceConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfiguration"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] _json = self._serialize.body(parameters, 'MaintenanceConfiguration') @@ -242,11 +256,13 @@ async def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -290,13 +306,16 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -306,11 +325,13 @@ async def delete( # pylint: disable=inconsistent-return-statements config_name=config_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/operations/_managed_clusters_operations.py index 03fa9f16c62e..d504d2cb2f66 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/operations/_managed_clusters_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. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ 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 @@ -26,32 +27,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ManagedClustersOperations: # pylint: disable=too-many-public-methods - """ManagedClustersOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_02_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_02_01.aio.ContainerServiceClient`'s + :attr:`managed_clusters` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.ManagedClusterListResult"]: + ) -> AsyncIterable[_models.ManagedClusterListResult]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. The operation returns properties @@ -64,13 +63,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_02_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -78,9 +80,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -88,9 +92,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -128,7 +134,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ManagedClusterListResult"]: + ) -> AsyncIterable[_models.ManagedClusterListResult]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. The operation returns @@ -143,13 +149,16 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_02_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -158,9 +167,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -169,9 +180,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -210,7 +223,7 @@ async def get_upgrade_profile( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedClusterUpgradeProfile": + ) -> _models.ManagedClusterUpgradeProfile: """Gets upgrade profile for a managed cluster. Gets the details of the upgrade profile for a managed cluster with a specified resource group @@ -225,13 +238,16 @@ async def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2021_02_01.models.ManagedClusterUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] request = build_get_upgrade_profile_request( @@ -240,11 +256,13 @@ async def get_upgrade_profile( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -272,7 +290,7 @@ async def get_access_profile( resource_name: str, role_name: str, **kwargs: Any - ) -> "_models.ManagedClusterAccessProfile": + ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. Gets the accessProfile for the specified role name of the managed cluster with a specified @@ -293,13 +311,16 @@ async def get_access_profile( :rtype: ~azure.mgmt.containerservice.v2021_02_01.models.ManagedClusterAccessProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterAccessProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-02-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] request = build_get_access_profile_request( @@ -309,11 +330,13 @@ async def get_access_profile( role_name=role_name, api_version=api_version, template_url=self.get_access_profile.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -340,7 +363,7 @@ async def list_cluster_admin_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster admin credential of a managed cluster. Gets cluster admin credential of the managed cluster with a specified resource group and name. @@ -354,13 +377,16 @@ async def list_cluster_admin_credentials( :rtype: ~azure.mgmt.containerservice.v2021_02_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-02-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_admin_credentials_request( @@ -369,11 +395,13 @@ async def list_cluster_admin_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_admin_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -400,7 +428,7 @@ async def list_cluster_user_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster user credential of a managed cluster. Gets cluster user credential of the managed cluster with a specified resource group and name. @@ -414,13 +442,16 @@ async def list_cluster_user_credentials( :rtype: ~azure.mgmt.containerservice.v2021_02_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_user_credentials_request( @@ -429,11 +460,13 @@ async def list_cluster_user_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -460,7 +493,7 @@ async def list_cluster_monitoring_user_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster monitoring user credential of a managed cluster. Gets cluster monitoring user credential of the managed cluster with a specified resource group @@ -475,13 +508,16 @@ async def list_cluster_monitoring_user_credentials( :rtype: ~azure.mgmt.containerservice.v2021_02_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-02-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_monitoring_user_credentials_request( @@ -490,11 +526,13 @@ async def list_cluster_monitoring_user_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -521,7 +559,7 @@ async def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedCluster": + ) -> _models.ManagedCluster: """Gets a managed cluster. Gets the details of the managed cluster with a specified resource group and name. @@ -535,13 +573,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2021_02_01.models.ManagedCluster :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] request = build_get_request( @@ -550,11 +591,13 @@ async def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -579,17 +622,20 @@ async def _create_or_update_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'ManagedCluster') @@ -601,11 +647,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -635,9 +683,9 @@ async def begin_create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> AsyncLROPoller["_models.ManagedCluster"]: + ) -> AsyncLROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. Creates or updates a managed cluster with the specified configuration for agents and Kubernetes @@ -663,37 +711,47 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_02_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -710,17 +768,20 @@ async def _update_tags_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'TagsObject') @@ -732,11 +793,13 @@ async def _update_tags_initial( content_type=content_type, json=_json, template_url=self._update_tags_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -762,9 +825,9 @@ async def begin_update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> AsyncLROPoller["_models.ManagedCluster"]: + ) -> AsyncLROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates a managed cluster with the specified tags. @@ -789,37 +852,47 @@ async def begin_update_tags( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_02_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._update_tags_initial( + raw_result = await self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -838,13 +911,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-02-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -853,11 +929,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -901,20 +979,25 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-02-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_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) @@ -924,8 +1007,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -942,17 +1031,20 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') @@ -964,11 +1056,13 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist content_type=content_type, json=_json, template_url=self._reset_service_principal_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -990,7 +1084,7 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> AsyncLROPoller[None]: """Reset Service Principal Profile of a managed cluster. @@ -1017,23 +1111,28 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._reset_service_principal_profile_initial( + raw_result = await self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1043,8 +1142,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1061,17 +1166,20 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') @@ -1083,11 +1191,13 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta content_type=content_type, json=_json, template_url=self._reset_aad_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1109,7 +1219,7 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> AsyncLROPoller[None]: """Reset AAD Profile of a managed cluster. @@ -1135,23 +1245,28 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._reset_aad_profile_initial( + raw_result = await self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1161,8 +1276,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1181,13 +1302,16 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_rotate_cluster_certificates_request_initial( @@ -1196,11 +1320,13 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- resource_name=resource_name, api_version=api_version, template_url=self._rotate_cluster_certificates_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1244,20 +1370,25 @@ async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-ret :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-02-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._rotate_cluster_certificates_initial( + raw_result = await self._rotate_cluster_certificates_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) @@ -1267,8 +1398,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1287,13 +1424,16 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_stop_request_initial( @@ -1302,11 +1442,13 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_name, api_version=api_version, template_url=self._stop_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1350,20 +1492,25 @@ async def begin_stop( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-02-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._stop_initial( + raw_result = await self._stop_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) @@ -1373,8 +1520,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1393,13 +1546,16 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-02-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_start_request_initial( @@ -1408,11 +1564,13 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_name, api_version=api_version, template_url=self._start_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1456,20 +1614,25 @@ async def begin_start( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-02-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._start_initial( + raw_result = await self._start_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) @@ -1479,8 +1642,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/operations/_operations.py index f85bf1f2a0ec..9e0d13c8fa5e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/operations/_operations.py @@ -14,6 +14,7 @@ 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 @@ -23,32 +24,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class Operations: - """Operations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_02_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_02_01.aio.ContainerServiceClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.OperationListResult"]: + ) -> AsyncIterable[_models.OperationListResult]: """Gets a list of compute operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -57,31 +56,38 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_02_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/operations/_private_endpoint_connections_operations.py index 23840363fbde..d012423ce30f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/operations/_private_endpoint_connections_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -14,6 +14,7 @@ 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 @@ -24,26 +25,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class PrivateEndpointConnectionsOperations: - """PrivateEndpointConnectionsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_02_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_02_01.aio.ContainerServiceClient`'s + :attr:`private_endpoint_connections` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -51,7 +50,7 @@ async def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnectionListResult": + ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. Gets a list of private endpoint connections in the specified managed cluster. The operation @@ -66,13 +65,16 @@ async def list( :rtype: ~azure.mgmt.containerservice.v2021_02_01.models.PrivateEndpointConnectionListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-02-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] request = build_list_request( @@ -81,11 +83,13 @@ async def list( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -113,7 +117,7 @@ async def get( resource_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Gets the private endpoint connection. Gets the details of the private endpoint connection by managed cluster and resource group. @@ -129,13 +133,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2021_02_01.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] request = build_get_request( @@ -145,11 +152,13 @@ async def get( private_endpoint_connection_name=private_endpoint_connection_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -176,9 +185,9 @@ async def update( resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - parameters: "_models.PrivateEndpointConnection", + parameters: _models.PrivateEndpointConnection, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. Updates a private endpoint connection in the specified managed cluster. @@ -196,14 +205,17 @@ async def update( :rtype: ~azure.mgmt.containerservice.v2021_02_01.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] _json = self._serialize.body(parameters, 'PrivateEndpointConnection') @@ -216,11 +228,13 @@ async def update( content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -248,13 +262,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -264,11 +281,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name=private_endpoint_connection_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -315,21 +334,26 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-02-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -339,8 +363,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/operations/_private_link_resources_operations.py index d6ecacc65545..56aa8f5c5a1d 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/operations/_private_link_resources_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/operations/_private_link_resources_operations.py @@ -13,6 +13,7 @@ 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 @@ -22,26 +23,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class PrivateLinkResourcesOperations: - """PrivateLinkResourcesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_02_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_02_01.aio.ContainerServiceClient`'s + :attr:`private_link_resources` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -49,7 +48,7 @@ async def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.PrivateLinkResourcesListResult": + ) -> _models.PrivateLinkResourcesListResult: """Gets a list of private link resources in the specified managed cluster. Gets a list of private link resources in the specified managed cluster. The operation returns @@ -64,13 +63,16 @@ async def list( :rtype: ~azure.mgmt.containerservice.v2021_02_01.models.PrivateLinkResourcesListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourcesListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-02-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] request = build_list_request( @@ -79,11 +81,13 @@ async def list( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/operations/_resolve_private_link_service_id_operations.py index 271d5c764d8a..8b2309b2d73e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/operations/_resolve_private_link_service_id_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/aio/operations/_resolve_private_link_service_id_operations.py @@ -13,6 +13,7 @@ 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 @@ -22,35 +23,33 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ResolvePrivateLinkServiceIdOperations: - """ResolvePrivateLinkServiceIdOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_02_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_02_01.aio.ContainerServiceClient`'s + :attr:`resolve_private_link_service_id` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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 post( self, resource_group_name: str, resource_name: str, - parameters: "_models.PrivateLinkResource", + parameters: _models.PrivateLinkResource, **kwargs: Any - ) -> "_models.PrivateLinkResource": + ) -> _models.PrivateLinkResource: """Gets the private link service ID for the specified managed cluster. Gets the private link service ID the specified managed cluster. @@ -67,14 +66,17 @@ async def post( :rtype: ~azure.mgmt.containerservice.v2021_02_01.models.PrivateLinkResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] _json = self._serialize.body(parameters, 'PrivateLinkResource') @@ -86,11 +88,13 @@ async def post( content_type=content_type, json=_json, template_url=self.post.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/models/__init__.py index 9e976fe25bb3..2b519b694a35 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/models/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/models/__init__.py @@ -106,7 +106,9 @@ UpgradeChannel, WeekDay, ) - +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'AgentPool', 'AgentPoolAvailableVersions', @@ -205,3 +207,5 @@ 'UpgradeChannel', 'WeekDay', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/models/_container_service_client_enums.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/models/_container_service_client_enums.py index 8c8738579bf0..0f1e6fd4800b 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/models/_container_service_client_enums.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/models/_container_service_client_enums.py @@ -7,32 +7,31 @@ # -------------------------------------------------------------------------- from enum import Enum -from six import with_metaclass from azure.core import CaseInsensitiveEnumMeta -class AgentPoolMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class AgentPoolMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """AgentPoolMode represents mode of an agent pool. """ SYSTEM = "System" USER = "User" -class AgentPoolType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class AgentPoolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """AgentPoolType represents types of an agent pool. """ VIRTUAL_MACHINE_SCALE_SETS = "VirtualMachineScaleSets" AVAILABILITY_SET = "AvailabilitySet" -class Code(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class Code(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Tells whether the cluster is Running or Stopped """ RUNNING = "Running" STOPPED = "Stopped" -class ConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The private link service connection status. """ @@ -41,7 +40,7 @@ class ConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): REJECTED = "Rejected" DISCONNECTED = "Disconnected" -class ContainerServiceStorageProfileTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the orchestrator choice. """ @@ -49,7 +48,7 @@ class ContainerServiceStorageProfileTypes(with_metaclass(CaseInsensitiveEnumMeta STORAGE_ACCOUNT = "StorageAccount" MANAGED_DISKS = "ManagedDisks" -class ContainerServiceVMSizeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Size of agent VMs. """ @@ -228,7 +227,7 @@ class ContainerServiceVMSizeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, E STANDARD_NV24 = "Standard_NV24" STANDARD_NV6 = "Standard_NV6" -class Count(with_metaclass(CaseInsensitiveEnumMeta, int, Enum)): +class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): """Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, and 5. The default value is 1. """ @@ -237,7 +236,7 @@ class Count(with_metaclass(CaseInsensitiveEnumMeta, int, Enum)): THREE = 3 FIVE = 5 -class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of identity that created the resource. """ @@ -246,14 +245,14 @@ class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class Expander(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class Expander(str, Enum, metaclass=CaseInsensitiveEnumMeta): LEAST_WASTE = "least-waste" MOST_PODS = "most-pods" PRIORITY = "priority" RANDOM = "random" -class KubeletDiskType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class KubeletDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """KubeletDiskType determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. Allowed values: 'OS', 'Temporary' (preview). """ @@ -261,7 +260,7 @@ class KubeletDiskType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): OS = "OS" TEMPORARY = "Temporary" -class LicenseType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class LicenseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The licenseType to use for Windows VMs. Windows_Server is used to enable Azure Hybrid User Benefits for Windows VMs. """ @@ -269,14 +268,14 @@ class LicenseType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): NONE = "None" WINDOWS_SERVER = "Windows_Server" -class LoadBalancerSku(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class LoadBalancerSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The load balancer sku for the managed cluster. """ STANDARD = "standard" BASIC = "basic" -class ManagedClusterPodIdentityProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ManagedClusterPodIdentityProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The current provisioning state of the pod identity. """ @@ -285,62 +284,62 @@ class ManagedClusterPodIdentityProvisioningState(with_metaclass(CaseInsensitiveE DELETING = "Deleting" FAILED = "Failed" -class ManagedClusterSKUName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ManagedClusterSKUName(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Name of a managed cluster SKU. """ BASIC = "Basic" -class ManagedClusterSKUTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ManagedClusterSKUTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Tier of a managed cluster SKU. """ PAID = "Paid" FREE = "Free" -class NetworkMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Network mode used for building Kubernetes network. """ TRANSPARENT = "transparent" BRIDGE = "bridge" -class NetworkPlugin(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkPlugin(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Network plugin used for building Kubernetes network. """ AZURE = "azure" KUBENET = "kubenet" -class NetworkPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Network policy used for building Kubernetes network. """ CALICO = "calico" AZURE = "azure" -class OSDiskType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OSDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """OSDiskType represents the type of an OS disk on an agent pool. """ MANAGED = "Managed" EPHEMERAL = "Ephemeral" -class OSType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux. """ LINUX = "Linux" WINDOWS = "Windows" -class OutboundType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OutboundType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The outbound (egress) routing method. """ LOAD_BALANCER = "loadBalancer" USER_DEFINED_ROUTING = "userDefinedRouting" -class PrivateEndpointConnectionProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class PrivateEndpointConnectionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The current provisioning state. """ @@ -349,7 +348,7 @@ class PrivateEndpointConnectionProvisioningState(with_metaclass(CaseInsensitiveE DELETING = "Deleting" FAILED = "Failed" -class ResourceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ resource group in agent nodes. Type 'None' will not use MSI for the managed cluster, service @@ -360,7 +359,7 @@ class ResourceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): USER_ASSIGNED = "UserAssigned" NONE = "None" -class ScaleSetEvictionPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ScaleSetEvictionPolicy to be used to specify eviction policy for Spot virtual machine scale set. Default to Delete. """ @@ -368,14 +367,14 @@ class ScaleSetEvictionPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)) DELETE = "Delete" DEALLOCATE = "Deallocate" -class ScaleSetPriority(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ScaleSetPriority(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ScaleSetPriority to be used to specify virtual machine scale set priority. Default to regular. """ SPOT = "Spot" REGULAR = "Regular" -class UpgradeChannel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class UpgradeChannel(str, Enum, metaclass=CaseInsensitiveEnumMeta): """upgrade channel for auto upgrade. """ @@ -384,7 +383,7 @@ class UpgradeChannel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): PATCH = "patch" NONE = "none" -class WeekDay(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class WeekDay(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The weekday enum. """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/models/_models_py3.py index 4089e6e9c483..d2af4c7f68e0 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/models/_models_py3.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/models/_models_py3.py @@ -7,11 +7,13 @@ # -------------------------------------------------------------------------- import datetime -from typing import Dict, List, Optional, Union +from typing import Dict, List, Optional, TYPE_CHECKING, Union import msrest.serialization -from ._container_service_client_enums import * +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + import __init__ as _models class SubResource(msrest.serialization.Model): @@ -68,7 +70,7 @@ class AgentPool(SubResource): range of 0 to 100 (inclusive) for user pools and in the range of 1 to 100 (inclusive) for system pools. The default value is 1. :vartype count: int - :ivar vm_size: Size of agent VMs. Possible values include: "Standard_A1", "Standard_A10", + :ivar vm_size: Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -115,12 +117,11 @@ class AgentPool(SubResource): :ivar os_disk_type: OS disk type to be used for machines in a given agent pool. Allowed values are 'Ephemeral' and 'Managed'. If unspecified, defaults to 'Ephemeral' when the VM supports ephemeral OS and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults - to 'Managed'. May not be changed after creation. Possible values include: "Managed", - "Ephemeral". + to 'Managed'. May not be changed after creation. Known values are: "Managed", "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2021_02_01.models.OSDiskType :ivar kubelet_disk_type: KubeletDiskType determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. Currently allows one value, OS, - resulting in Kubelet using the OS disk for data. Possible values include: "OS", "Temporary". + resulting in Kubelet using the OS disk for data. Known values are: "OS", "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_02_01.models.KubeletDiskType :ivar vnet_subnet_id: VNet SubnetID specifies the VNet's subnet identifier for nodes and maybe @@ -131,7 +132,7 @@ class AgentPool(SubResource): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2021_02_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -139,12 +140,11 @@ class AgentPool(SubResource): :vartype min_count: int :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool - :ivar type_properties_type: AgentPoolType represents types of an agent pool. Possible values - include: "VirtualMachineScaleSets", "AvailabilitySet". + :ivar type_properties_type: AgentPoolType represents types of an agent pool. Known values are: + "VirtualMachineScaleSets", "AvailabilitySet". :vartype type_properties_type: str or ~azure.mgmt.containerservice.v2021_02_01.models.AgentPoolType - :ivar mode: AgentPoolMode represents mode of an agent pool. Possible values include: "System", - "User". + :ivar mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", "User". :vartype mode: str or ~azure.mgmt.containerservice.v2021_02_01.models.AgentPoolMode :ivar orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -168,12 +168,11 @@ class AgentPool(SubResource): IP Prefix. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Possible values include: "Spot", "Regular". Default value: - "Regular". + priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_02_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy - for Spot virtual machine scale set. Default to Delete. Possible values include: "Delete", + for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", "Deallocate". Default value: "Delete". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_02_01.models.ScaleSetEvictionPolicy @@ -251,33 +250,33 @@ def __init__( self, *, count: Optional[int] = None, - vm_size: Optional[Union[str, "ContainerServiceVMSizeTypes"]] = None, + vm_size: Optional[Union[str, "_models.ContainerServiceVMSizeTypes"]] = None, os_disk_size_gb: Optional[int] = None, - os_disk_type: Optional[Union[str, "OSDiskType"]] = None, - kubelet_disk_type: Optional[Union[str, "KubeletDiskType"]] = None, + os_disk_type: Optional[Union[str, "_models.OSDiskType"]] = None, + kubelet_disk_type: Optional[Union[str, "_models.KubeletDiskType"]] = None, vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - type_properties_type: Optional[Union[str, "AgentPoolType"]] = None, - mode: Optional[Union[str, "AgentPoolMode"]] = None, + type_properties_type: Optional[Union[str, "_models.AgentPoolType"]] = None, + mode: Optional[Union[str, "_models.AgentPoolMode"]] = None, orchestrator_version: Optional[str] = None, - upgrade_settings: Optional["AgentPoolUpgradeSettings"] = None, + upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", spot_max_price: Optional[float] = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, proximity_placement_group_id: Optional[str] = None, - kubelet_config: Optional["KubeletConfig"] = None, - linux_os_config: Optional["LinuxOSConfig"] = None, + kubelet_config: Optional["_models.KubeletConfig"] = None, + linux_os_config: Optional["_models.LinuxOSConfig"] = None, enable_encryption_at_host: Optional[bool] = None, **kwargs ): @@ -286,7 +285,7 @@ def __init__( range of 0 to 100 (inclusive) for user pools and in the range of 1 to 100 (inclusive) for system pools. The default value is 1. :paramtype count: int - :keyword vm_size: Size of agent VMs. Possible values include: "Standard_A1", "Standard_A10", + :keyword vm_size: Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -333,12 +332,12 @@ def __init__( :keyword os_disk_type: OS disk type to be used for machines in a given agent pool. Allowed values are 'Ephemeral' and 'Managed'. If unspecified, defaults to 'Ephemeral' when the VM supports ephemeral OS and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, - defaults to 'Managed'. May not be changed after creation. Possible values include: "Managed", + defaults to 'Managed'. May not be changed after creation. Known values are: "Managed", "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2021_02_01.models.OSDiskType :keyword kubelet_disk_type: KubeletDiskType determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. Currently allows one value, OS, - resulting in Kubelet using the OS disk for data. Possible values include: "OS", "Temporary". + resulting in Kubelet using the OS disk for data. Known values are: "OS", "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_02_01.models.KubeletDiskType :keyword vnet_subnet_id: VNet SubnetID specifies the VNet's subnet identifier for nodes and @@ -349,7 +348,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2021_02_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -357,12 +356,12 @@ def __init__( :paramtype min_count: int :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool - :keyword type_properties_type: AgentPoolType represents types of an agent pool. Possible values - include: "VirtualMachineScaleSets", "AvailabilitySet". + :keyword type_properties_type: AgentPoolType represents types of an agent pool. Known values + are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type_properties_type: str or ~azure.mgmt.containerservice.v2021_02_01.models.AgentPoolType - :keyword mode: AgentPoolMode represents mode of an agent pool. Possible values include: - "System", "User". + :keyword mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", + "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2021_02_01.models.AgentPoolMode :keyword orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -379,13 +378,12 @@ def __init__( Public IP Prefix. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Possible values include: "Spot", "Regular". Default value: - "Regular". + priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_02_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction - policy for Spot virtual machine scale set. Default to Delete. Possible values include: - "Delete", "Deallocate". Default value: "Delete". + policy for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", + "Deallocate". Default value: "Delete". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_02_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: SpotMaxPrice to be used to specify the maximum price you are willing @@ -476,7 +474,7 @@ class AgentPoolAvailableVersions(msrest.serialization.Model): def __init__( self, *, - agent_pool_versions: Optional[List["AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem"]] = None, + agent_pool_versions: Optional[List["_models.AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem"]] = None, **kwargs ): """ @@ -553,7 +551,7 @@ class AgentPoolListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["AgentPool"]] = None, + value: Optional[List["_models.AgentPool"]] = None, **kwargs ): """ @@ -581,7 +579,7 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): :ivar kubernetes_version: Required. Kubernetes version (major, minor, patch). :vartype kubernetes_version: str :ivar os_type: Required. OsType to be used to specify os type. Choose from Linux and Windows. - Default to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2021_02_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -613,8 +611,8 @@ def __init__( self, *, kubernetes_version: str, - os_type: Union[str, "OSType"] = "Linux", - upgrades: Optional[List["AgentPoolUpgradeProfilePropertiesUpgradesItem"]] = None, + os_type: Union[str, "_models.OSType"] = "Linux", + upgrades: Optional[List["_models.AgentPoolUpgradeProfilePropertiesUpgradesItem"]] = None, latest_node_image_version: Optional[str] = None, **kwargs ): @@ -622,7 +620,7 @@ def __init__( :keyword kubernetes_version: Required. Kubernetes version (major, minor, patch). :paramtype kubernetes_version: str :keyword os_type: Required. OsType to be used to specify os type. Choose from Linux and - Windows. Default to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Windows. Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2021_02_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: @@ -714,7 +712,7 @@ class CloudError(msrest.serialization.Model): def __init__( self, *, - error: Optional["CloudErrorBody"] = None, + error: Optional["_models.CloudErrorBody"] = None, **kwargs ): """ @@ -754,7 +752,7 @@ def __init__( code: Optional[str] = None, message: Optional[str] = None, target: Optional[str] = None, - details: Optional[List["CloudErrorBody"]] = None, + details: Optional[List["_models.CloudErrorBody"]] = None, **kwargs ): """ @@ -894,26 +892,26 @@ class Components1Q1Og48SchemasManagedclusterAllof1(msrest.serialization.Model): def __init__( self, *, - identity: Optional["ManagedClusterIdentity"] = None, + identity: Optional["_models.ManagedClusterIdentity"] = None, kubernetes_version: Optional[str] = None, dns_prefix: Optional[str] = None, fqdn_subdomain: Optional[str] = None, - agent_pool_profiles: Optional[List["ManagedClusterAgentPoolProfile"]] = None, - linux_profile: Optional["ContainerServiceLinuxProfile"] = None, - windows_profile: Optional["ManagedClusterWindowsProfile"] = None, - service_principal_profile: Optional["ManagedClusterServicePrincipalProfile"] = None, - addon_profiles: Optional[Dict[str, "ManagedClusterAddonProfile"]] = None, - pod_identity_profile: Optional["ManagedClusterPodIdentityProfile"] = None, + agent_pool_profiles: Optional[List["_models.ManagedClusterAgentPoolProfile"]] = None, + linux_profile: Optional["_models.ContainerServiceLinuxProfile"] = None, + windows_profile: Optional["_models.ManagedClusterWindowsProfile"] = None, + service_principal_profile: Optional["_models.ManagedClusterServicePrincipalProfile"] = None, + addon_profiles: Optional[Dict[str, "_models.ManagedClusterAddonProfile"]] = None, + pod_identity_profile: Optional["_models.ManagedClusterPodIdentityProfile"] = None, node_resource_group: Optional[str] = None, enable_rbac: Optional[bool] = None, enable_pod_security_policy: Optional[bool] = None, - network_profile: Optional["ContainerServiceNetworkProfile"] = None, - aad_profile: Optional["ManagedClusterAADProfile"] = None, - auto_upgrade_profile: Optional["ManagedClusterAutoUpgradeProfile"] = None, - auto_scaler_profile: Optional["ManagedClusterPropertiesAutoScalerProfile"] = None, - api_server_access_profile: Optional["ManagedClusterAPIServerAccessProfile"] = None, + network_profile: Optional["_models.ContainerServiceNetworkProfile"] = None, + aad_profile: Optional["_models.ManagedClusterAADProfile"] = None, + auto_upgrade_profile: Optional["_models.ManagedClusterAutoUpgradeProfile"] = None, + auto_scaler_profile: Optional["_models.ManagedClusterPropertiesAutoScalerProfile"] = None, + api_server_access_profile: Optional["_models.ManagedClusterAPIServerAccessProfile"] = None, disk_encryption_set_id: Optional[str] = None, - identity_profile: Optional[Dict[str, "ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties"]] = None, + identity_profile: Optional[Dict[str, "_models.ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties"]] = None, **kwargs ): """ @@ -1132,7 +1130,7 @@ class ContainerServiceDiagnosticsProfile(msrest.serialization.Model): def __init__( self, *, - vm_diagnostics: "ContainerServiceVMDiagnostics", + vm_diagnostics: "_models.ContainerServiceVMDiagnostics", **kwargs ): """ @@ -1169,7 +1167,7 @@ def __init__( self, *, admin_username: str, - ssh: "ContainerServiceSshConfiguration", + ssh: "_models.ContainerServiceSshConfiguration", **kwargs ): """ @@ -1192,17 +1190,17 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar count: Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, - and 5. The default value is 1. Possible values include: 1, 3, 5. Default value: "1". + and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". :vartype count: int or ~azure.mgmt.containerservice.v2021_02_01.models.Count :ivar dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. :vartype dns_prefix: str - :ivar vm_size: Required. Size of agent VMs. Possible values include: "Standard_A1", - "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", - "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", - "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", - "Standard_A8m_v2", "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", - "Standard_B8ms", "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", - "Standard_D12", "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", + :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", + "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", + "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", + "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", "Standard_B8ms", + "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", "Standard_D12", + "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", "Standard_D13_v2_Promo", "Standard_D14", "Standard_D14_v2", "Standard_D14_v2_Promo", "Standard_D15_v2", "Standard_D16_v3", "Standard_D16s_v3", "Standard_D1_v2", "Standard_D2", "Standard_D2_v2", "Standard_D2_v2_Promo", "Standard_D2_v3", "Standard_D2s_v3", "Standard_D3", @@ -1247,7 +1245,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): :vartype first_consecutive_static_ip: str :ivar storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Possible values include: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". :vartype storage_profile: str or ~azure.mgmt.containerservice.v2021_02_01.models.ContainerServiceStorageProfileTypes :ivar fqdn: FQDN for the master pool. @@ -1276,27 +1274,27 @@ def __init__( self, *, dns_prefix: str, - vm_size: Union[str, "ContainerServiceVMSizeTypes"], - count: Optional[Union[int, "Count"]] = 1, + vm_size: Union[str, "_models.ContainerServiceVMSizeTypes"], + count: Optional[Union[int, "_models.Count"]] = 1, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, first_consecutive_static_ip: Optional[str] = "10.240.255.5", - storage_profile: Optional[Union[str, "ContainerServiceStorageProfileTypes"]] = None, + storage_profile: Optional[Union[str, "_models.ContainerServiceStorageProfileTypes"]] = None, **kwargs ): """ :keyword count: Number of masters (VMs) in the container service cluster. Allowed values are 1, - 3, and 5. The default value is 1. Possible values include: 1, 3, 5. Default value: "1". + 3, and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". :paramtype count: int or ~azure.mgmt.containerservice.v2021_02_01.models.Count :keyword dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. :paramtype dns_prefix: str - :keyword vm_size: Required. Size of agent VMs. Possible values include: "Standard_A1", - "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", - "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", - "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", - "Standard_A8m_v2", "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", - "Standard_B8ms", "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", - "Standard_D12", "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", + :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", + "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", + "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", + "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", "Standard_B8ms", + "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", "Standard_D12", + "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", "Standard_D13_v2_Promo", "Standard_D14", "Standard_D14_v2", "Standard_D14_v2_Promo", "Standard_D15_v2", "Standard_D16_v3", "Standard_D16s_v3", "Standard_D1_v2", "Standard_D2", "Standard_D2_v2", "Standard_D2_v2_Promo", "Standard_D2_v3", "Standard_D2s_v3", "Standard_D3", @@ -1341,7 +1339,7 @@ def __init__( :paramtype first_consecutive_static_ip: str :keyword storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Possible values include: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". :paramtype storage_profile: str or ~azure.mgmt.containerservice.v2021_02_01.models.ContainerServiceStorageProfileTypes """ @@ -1359,13 +1357,13 @@ def __init__( class ContainerServiceNetworkProfile(msrest.serialization.Model): """Profile of network configuration. - :ivar network_plugin: Network plugin used for building Kubernetes network. Possible values - include: "azure", "kubenet". Default value: "kubenet". + :ivar network_plugin: Network plugin used for building Kubernetes network. Known values are: + "azure", "kubenet". Default value: "kubenet". :vartype network_plugin: str or ~azure.mgmt.containerservice.v2021_02_01.models.NetworkPlugin - :ivar network_policy: Network policy used for building Kubernetes network. Possible values - include: "calico", "azure". + :ivar network_policy: Network policy used for building Kubernetes network. Known values are: + "calico", "azure". :vartype network_policy: str or ~azure.mgmt.containerservice.v2021_02_01.models.NetworkPolicy - :ivar network_mode: Network mode used for building Kubernetes network. Possible values include: + :ivar network_mode: Network mode used for building Kubernetes network. Known values are: "transparent", "bridge". :vartype network_mode: str or ~azure.mgmt.containerservice.v2021_02_01.models.NetworkMode :ivar pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. @@ -1379,11 +1377,11 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): :ivar docker_bridge_cidr: A CIDR notation IP range assigned to the Docker bridge network. It must not overlap with any Subnet IP ranges or the Kubernetes service address range. :vartype docker_bridge_cidr: str - :ivar outbound_type: The outbound (egress) routing method. Possible values include: - "loadBalancer", "userDefinedRouting". Default value: "loadBalancer". + :ivar outbound_type: The outbound (egress) routing method. Known values are: "loadBalancer", + "userDefinedRouting". Default value: "loadBalancer". :vartype outbound_type: str or ~azure.mgmt.containerservice.v2021_02_01.models.OutboundType - :ivar load_balancer_sku: The load balancer sku for the managed cluster. Possible values - include: "standard", "basic". + :ivar load_balancer_sku: The load balancer sku for the managed cluster. Known values are: + "standard", "basic". :vartype load_balancer_sku: str or ~azure.mgmt.containerservice.v2021_02_01.models.LoadBalancerSku :ivar load_balancer_profile: Profile of the cluster load balancer. @@ -1414,27 +1412,27 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): def __init__( self, *, - network_plugin: Optional[Union[str, "NetworkPlugin"]] = "kubenet", - network_policy: Optional[Union[str, "NetworkPolicy"]] = None, - network_mode: Optional[Union[str, "NetworkMode"]] = None, + network_plugin: Optional[Union[str, "_models.NetworkPlugin"]] = "kubenet", + network_policy: Optional[Union[str, "_models.NetworkPolicy"]] = None, + network_mode: Optional[Union[str, "_models.NetworkMode"]] = None, pod_cidr: Optional[str] = "10.244.0.0/16", service_cidr: Optional[str] = "10.0.0.0/16", dns_service_ip: Optional[str] = "10.0.0.10", docker_bridge_cidr: Optional[str] = "172.17.0.1/16", - outbound_type: Optional[Union[str, "OutboundType"]] = "loadBalancer", - load_balancer_sku: Optional[Union[str, "LoadBalancerSku"]] = None, - load_balancer_profile: Optional["ManagedClusterLoadBalancerProfile"] = None, + outbound_type: Optional[Union[str, "_models.OutboundType"]] = "loadBalancer", + load_balancer_sku: Optional[Union[str, "_models.LoadBalancerSku"]] = None, + load_balancer_profile: Optional["_models.ManagedClusterLoadBalancerProfile"] = None, **kwargs ): """ - :keyword network_plugin: Network plugin used for building Kubernetes network. Possible values - include: "azure", "kubenet". Default value: "kubenet". + :keyword network_plugin: Network plugin used for building Kubernetes network. Known values are: + "azure", "kubenet". Default value: "kubenet". :paramtype network_plugin: str or ~azure.mgmt.containerservice.v2021_02_01.models.NetworkPlugin - :keyword network_policy: Network policy used for building Kubernetes network. Possible values - include: "calico", "azure". + :keyword network_policy: Network policy used for building Kubernetes network. Known values are: + "calico", "azure". :paramtype network_policy: str or ~azure.mgmt.containerservice.v2021_02_01.models.NetworkPolicy - :keyword network_mode: Network mode used for building Kubernetes network. Possible values - include: "transparent", "bridge". + :keyword network_mode: Network mode used for building Kubernetes network. Known values are: + "transparent", "bridge". :paramtype network_mode: str or ~azure.mgmt.containerservice.v2021_02_01.models.NetworkMode :keyword pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :paramtype pod_cidr: str @@ -1447,11 +1445,11 @@ def __init__( :keyword docker_bridge_cidr: A CIDR notation IP range assigned to the Docker bridge network. It must not overlap with any Subnet IP ranges or the Kubernetes service address range. :paramtype docker_bridge_cidr: str - :keyword outbound_type: The outbound (egress) routing method. Possible values include: - "loadBalancer", "userDefinedRouting". Default value: "loadBalancer". + :keyword outbound_type: The outbound (egress) routing method. Known values are: "loadBalancer", + "userDefinedRouting". Default value: "loadBalancer". :paramtype outbound_type: str or ~azure.mgmt.containerservice.v2021_02_01.models.OutboundType - :keyword load_balancer_sku: The load balancer sku for the managed cluster. Possible values - include: "standard", "basic". + :keyword load_balancer_sku: The load balancer sku for the managed cluster. Known values are: + "standard", "basic". :paramtype load_balancer_sku: str or ~azure.mgmt.containerservice.v2021_02_01.models.LoadBalancerSku :keyword load_balancer_profile: Profile of the cluster load balancer. @@ -1493,7 +1491,7 @@ class ContainerServiceSshConfiguration(msrest.serialization.Model): def __init__( self, *, - public_keys: List["ContainerServiceSshPublicKey"], + public_keys: List["_models.ContainerServiceSshPublicKey"], **kwargs ): """ @@ -1772,7 +1770,7 @@ class LinuxOSConfig(msrest.serialization.Model): def __init__( self, *, - sysctls: Optional["SysctlConfig"] = None, + sysctls: Optional["_models.SysctlConfig"] = None, transparent_huge_page_enabled: Optional[str] = None, transparent_huge_page_defrag: Optional[str] = None, swap_file_size_mb: Optional[int] = None, @@ -1835,8 +1833,8 @@ class MaintenanceConfiguration(SubResource): def __init__( self, *, - time_in_week: Optional[List["TimeInWeek"]] = None, - not_allowed_time: Optional[List["TimeSpan"]] = None, + time_in_week: Optional[List["_models.TimeInWeek"]] = None, + not_allowed_time: Optional[List["_models.TimeSpan"]] = None, **kwargs ): """ @@ -1874,7 +1872,7 @@ class MaintenanceConfigurationListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["MaintenanceConfiguration"]] = None, + value: Optional[List["_models.MaintenanceConfiguration"]] = None, **kwargs ): """ @@ -2084,28 +2082,28 @@ def __init__( self, *, location: str, - identity: Optional["ManagedClusterIdentity"] = None, + identity: Optional["_models.ManagedClusterIdentity"] = None, kubernetes_version: Optional[str] = None, dns_prefix: Optional[str] = None, fqdn_subdomain: Optional[str] = None, - agent_pool_profiles: Optional[List["ManagedClusterAgentPoolProfile"]] = None, - linux_profile: Optional["ContainerServiceLinuxProfile"] = None, - windows_profile: Optional["ManagedClusterWindowsProfile"] = None, - service_principal_profile: Optional["ManagedClusterServicePrincipalProfile"] = None, - addon_profiles: Optional[Dict[str, "ManagedClusterAddonProfile"]] = None, - pod_identity_profile: Optional["ManagedClusterPodIdentityProfile"] = None, + agent_pool_profiles: Optional[List["_models.ManagedClusterAgentPoolProfile"]] = None, + linux_profile: Optional["_models.ContainerServiceLinuxProfile"] = None, + windows_profile: Optional["_models.ManagedClusterWindowsProfile"] = None, + service_principal_profile: Optional["_models.ManagedClusterServicePrincipalProfile"] = None, + addon_profiles: Optional[Dict[str, "_models.ManagedClusterAddonProfile"]] = None, + pod_identity_profile: Optional["_models.ManagedClusterPodIdentityProfile"] = None, node_resource_group: Optional[str] = None, enable_rbac: Optional[bool] = None, enable_pod_security_policy: Optional[bool] = None, - network_profile: Optional["ContainerServiceNetworkProfile"] = None, - aad_profile: Optional["ManagedClusterAADProfile"] = None, - auto_upgrade_profile: Optional["ManagedClusterAutoUpgradeProfile"] = None, - auto_scaler_profile: Optional["ManagedClusterPropertiesAutoScalerProfile"] = None, - api_server_access_profile: Optional["ManagedClusterAPIServerAccessProfile"] = None, + network_profile: Optional["_models.ContainerServiceNetworkProfile"] = None, + aad_profile: Optional["_models.ManagedClusterAADProfile"] = None, + auto_upgrade_profile: Optional["_models.ManagedClusterAutoUpgradeProfile"] = None, + auto_scaler_profile: Optional["_models.ManagedClusterPropertiesAutoScalerProfile"] = None, + api_server_access_profile: Optional["_models.ManagedClusterAPIServerAccessProfile"] = None, disk_encryption_set_id: Optional[str] = None, - identity_profile: Optional[Dict[str, "ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties"]] = None, + identity_profile: Optional[Dict[str, "_models.ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties"]] = None, tags: Optional[Dict[str, str]] = None, - sku: Optional["ManagedClusterSKU"] = None, + sku: Optional["_models.ManagedClusterSKU"] = None, **kwargs ): """ @@ -2426,7 +2424,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): range of 0 to 100 (inclusive) for user pools and in the range of 1 to 100 (inclusive) for system pools. The default value is 1. :vartype count: int - :ivar vm_size: Size of agent VMs. Possible values include: "Standard_A1", "Standard_A10", + :ivar vm_size: Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -2473,12 +2471,11 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar os_disk_type: OS disk type to be used for machines in a given agent pool. Allowed values are 'Ephemeral' and 'Managed'. If unspecified, defaults to 'Ephemeral' when the VM supports ephemeral OS and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults - to 'Managed'. May not be changed after creation. Possible values include: "Managed", - "Ephemeral". + to 'Managed'. May not be changed after creation. Known values are: "Managed", "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2021_02_01.models.OSDiskType :ivar kubelet_disk_type: KubeletDiskType determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. Currently allows one value, OS, - resulting in Kubelet using the OS disk for data. Possible values include: "OS", "Temporary". + resulting in Kubelet using the OS disk for data. Known values are: "OS", "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_02_01.models.KubeletDiskType :ivar vnet_subnet_id: VNet SubnetID specifies the VNet's subnet identifier for nodes and maybe @@ -2489,7 +2486,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2021_02_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -2497,11 +2494,10 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :vartype min_count: int :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool - :ivar type: AgentPoolType represents types of an agent pool. Possible values include: + :ivar type: AgentPoolType represents types of an agent pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2021_02_01.models.AgentPoolType - :ivar mode: AgentPoolMode represents mode of an agent pool. Possible values include: "System", - "User". + :ivar mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", "User". :vartype mode: str or ~azure.mgmt.containerservice.v2021_02_01.models.AgentPoolMode :ivar orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -2525,12 +2521,11 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): IP Prefix. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Possible values include: "Spot", "Regular". Default value: - "Regular". + priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_02_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy - for Spot virtual machine scale set. Default to Delete. Possible values include: "Delete", + for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", "Deallocate". Default value: "Delete". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_02_01.models.ScaleSetEvictionPolicy @@ -2602,33 +2597,33 @@ def __init__( self, *, count: Optional[int] = None, - vm_size: Optional[Union[str, "ContainerServiceVMSizeTypes"]] = None, + vm_size: Optional[Union[str, "_models.ContainerServiceVMSizeTypes"]] = None, os_disk_size_gb: Optional[int] = None, - os_disk_type: Optional[Union[str, "OSDiskType"]] = None, - kubelet_disk_type: Optional[Union[str, "KubeletDiskType"]] = None, + os_disk_type: Optional[Union[str, "_models.OSDiskType"]] = None, + kubelet_disk_type: Optional[Union[str, "_models.KubeletDiskType"]] = None, vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - type: Optional[Union[str, "AgentPoolType"]] = None, - mode: Optional[Union[str, "AgentPoolMode"]] = None, + type: Optional[Union[str, "_models.AgentPoolType"]] = None, + mode: Optional[Union[str, "_models.AgentPoolMode"]] = None, orchestrator_version: Optional[str] = None, - upgrade_settings: Optional["AgentPoolUpgradeSettings"] = None, + upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", spot_max_price: Optional[float] = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, proximity_placement_group_id: Optional[str] = None, - kubelet_config: Optional["KubeletConfig"] = None, - linux_os_config: Optional["LinuxOSConfig"] = None, + kubelet_config: Optional["_models.KubeletConfig"] = None, + linux_os_config: Optional["_models.LinuxOSConfig"] = None, enable_encryption_at_host: Optional[bool] = None, **kwargs ): @@ -2637,7 +2632,7 @@ def __init__( range of 0 to 100 (inclusive) for user pools and in the range of 1 to 100 (inclusive) for system pools. The default value is 1. :paramtype count: int - :keyword vm_size: Size of agent VMs. Possible values include: "Standard_A1", "Standard_A10", + :keyword vm_size: Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -2684,12 +2679,12 @@ def __init__( :keyword os_disk_type: OS disk type to be used for machines in a given agent pool. Allowed values are 'Ephemeral' and 'Managed'. If unspecified, defaults to 'Ephemeral' when the VM supports ephemeral OS and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, - defaults to 'Managed'. May not be changed after creation. Possible values include: "Managed", + defaults to 'Managed'. May not be changed after creation. Known values are: "Managed", "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2021_02_01.models.OSDiskType :keyword kubelet_disk_type: KubeletDiskType determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. Currently allows one value, OS, - resulting in Kubelet using the OS disk for data. Possible values include: "OS", "Temporary". + resulting in Kubelet using the OS disk for data. Known values are: "OS", "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_02_01.models.KubeletDiskType :keyword vnet_subnet_id: VNet SubnetID specifies the VNet's subnet identifier for nodes and @@ -2700,7 +2695,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2021_02_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -2708,11 +2703,11 @@ def __init__( :paramtype min_count: int :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool - :keyword type: AgentPoolType represents types of an agent pool. Possible values include: + :keyword type: AgentPoolType represents types of an agent pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2021_02_01.models.AgentPoolType - :keyword mode: AgentPoolMode represents mode of an agent pool. Possible values include: - "System", "User". + :keyword mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", + "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2021_02_01.models.AgentPoolMode :keyword orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -2729,13 +2724,12 @@ def __init__( Public IP Prefix. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Possible values include: "Spot", "Regular". Default value: - "Regular". + priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_02_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction - policy for Spot virtual machine scale set. Default to Delete. Possible values include: - "Delete", "Deallocate". Default value: "Delete". + policy for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", + "Deallocate". Default value: "Delete". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_02_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: SpotMaxPrice to be used to specify the maximum price you are willing @@ -2805,7 +2799,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): range of 0 to 100 (inclusive) for user pools and in the range of 1 to 100 (inclusive) for system pools. The default value is 1. :vartype count: int - :ivar vm_size: Size of agent VMs. Possible values include: "Standard_A1", "Standard_A10", + :ivar vm_size: Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -2852,12 +2846,11 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar os_disk_type: OS disk type to be used for machines in a given agent pool. Allowed values are 'Ephemeral' and 'Managed'. If unspecified, defaults to 'Ephemeral' when the VM supports ephemeral OS and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults - to 'Managed'. May not be changed after creation. Possible values include: "Managed", - "Ephemeral". + to 'Managed'. May not be changed after creation. Known values are: "Managed", "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2021_02_01.models.OSDiskType :ivar kubelet_disk_type: KubeletDiskType determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. Currently allows one value, OS, - resulting in Kubelet using the OS disk for data. Possible values include: "OS", "Temporary". + resulting in Kubelet using the OS disk for data. Known values are: "OS", "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_02_01.models.KubeletDiskType :ivar vnet_subnet_id: VNet SubnetID specifies the VNet's subnet identifier for nodes and maybe @@ -2868,7 +2861,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2021_02_01.models.OSType :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -2876,11 +2869,10 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :vartype min_count: int :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool - :ivar type: AgentPoolType represents types of an agent pool. Possible values include: + :ivar type: AgentPoolType represents types of an agent pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2021_02_01.models.AgentPoolType - :ivar mode: AgentPoolMode represents mode of an agent pool. Possible values include: "System", - "User". + :ivar mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", "User". :vartype mode: str or ~azure.mgmt.containerservice.v2021_02_01.models.AgentPoolMode :ivar orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -2904,12 +2896,11 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): IP Prefix. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Possible values include: "Spot", "Regular". Default value: - "Regular". + priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_02_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy - for Spot virtual machine scale set. Default to Delete. Possible values include: "Delete", + for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", "Deallocate". Default value: "Delete". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_02_01.models.ScaleSetEvictionPolicy @@ -2987,33 +2978,33 @@ def __init__( *, name: str, count: Optional[int] = None, - vm_size: Optional[Union[str, "ContainerServiceVMSizeTypes"]] = None, + vm_size: Optional[Union[str, "_models.ContainerServiceVMSizeTypes"]] = None, os_disk_size_gb: Optional[int] = None, - os_disk_type: Optional[Union[str, "OSDiskType"]] = None, - kubelet_disk_type: Optional[Union[str, "KubeletDiskType"]] = None, + os_disk_type: Optional[Union[str, "_models.OSDiskType"]] = None, + kubelet_disk_type: Optional[Union[str, "_models.KubeletDiskType"]] = None, vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - type: Optional[Union[str, "AgentPoolType"]] = None, - mode: Optional[Union[str, "AgentPoolMode"]] = None, + type: Optional[Union[str, "_models.AgentPoolType"]] = None, + mode: Optional[Union[str, "_models.AgentPoolMode"]] = None, orchestrator_version: Optional[str] = None, - upgrade_settings: Optional["AgentPoolUpgradeSettings"] = None, + upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", spot_max_price: Optional[float] = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, proximity_placement_group_id: Optional[str] = None, - kubelet_config: Optional["KubeletConfig"] = None, - linux_os_config: Optional["LinuxOSConfig"] = None, + kubelet_config: Optional["_models.KubeletConfig"] = None, + linux_os_config: Optional["_models.LinuxOSConfig"] = None, enable_encryption_at_host: Optional[bool] = None, **kwargs ): @@ -3022,7 +3013,7 @@ def __init__( range of 0 to 100 (inclusive) for user pools and in the range of 1 to 100 (inclusive) for system pools. The default value is 1. :paramtype count: int - :keyword vm_size: Size of agent VMs. Possible values include: "Standard_A1", "Standard_A10", + :keyword vm_size: Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", @@ -3069,12 +3060,12 @@ def __init__( :keyword os_disk_type: OS disk type to be used for machines in a given agent pool. Allowed values are 'Ephemeral' and 'Managed'. If unspecified, defaults to 'Ephemeral' when the VM supports ephemeral OS and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, - defaults to 'Managed'. May not be changed after creation. Possible values include: "Managed", + defaults to 'Managed'. May not be changed after creation. Known values are: "Managed", "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2021_02_01.models.OSDiskType :keyword kubelet_disk_type: KubeletDiskType determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. Currently allows one value, OS, - resulting in Kubelet using the OS disk for data. Possible values include: "OS", "Temporary". + resulting in Kubelet using the OS disk for data. Known values are: "OS", "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_02_01.models.KubeletDiskType :keyword vnet_subnet_id: VNet SubnetID specifies the VNet's subnet identifier for nodes and @@ -3085,7 +3076,7 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2021_02_01.models.OSType :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -3093,11 +3084,11 @@ def __init__( :paramtype min_count: int :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool - :keyword type: AgentPoolType represents types of an agent pool. Possible values include: + :keyword type: AgentPoolType represents types of an agent pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2021_02_01.models.AgentPoolType - :keyword mode: AgentPoolMode represents mode of an agent pool. Possible values include: - "System", "User". + :keyword mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", + "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2021_02_01.models.AgentPoolMode :keyword orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -3114,13 +3105,12 @@ def __init__( Public IP Prefix. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Possible values include: "Spot", "Regular". Default value: - "Regular". + priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_02_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction - policy for Spot virtual machine scale set. Default to Delete. Possible values include: - "Delete", "Deallocate". Default value: "Delete". + policy for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", + "Deallocate". Default value: "Delete". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_02_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: SpotMaxPrice to be used to specify the maximum price you are willing @@ -3193,8 +3183,8 @@ def __init__( class ManagedClusterAutoUpgradeProfile(msrest.serialization.Model): """Auto upgrade profile for a managed cluster. - :ivar upgrade_channel: upgrade channel for auto upgrade. Possible values include: "rapid", - "stable", "patch", "none". + :ivar upgrade_channel: upgrade channel for auto upgrade. Known values are: "rapid", "stable", + "patch", "none". :vartype upgrade_channel: str or ~azure.mgmt.containerservice.v2021_02_01.models.UpgradeChannel """ @@ -3205,11 +3195,11 @@ class ManagedClusterAutoUpgradeProfile(msrest.serialization.Model): def __init__( self, *, - upgrade_channel: Optional[Union[str, "UpgradeChannel"]] = None, + upgrade_channel: Optional[Union[str, "_models.UpgradeChannel"]] = None, **kwargs ): """ - :keyword upgrade_channel: upgrade channel for auto upgrade. Possible values include: "rapid", + :keyword upgrade_channel: upgrade channel for auto upgrade. Known values are: "rapid", "stable", "patch", "none". :paramtype upgrade_channel: str or ~azure.mgmt.containerservice.v2021_02_01.models.UpgradeChannel @@ -3232,8 +3222,8 @@ class ManagedClusterIdentity(msrest.serialization.Model): :ivar type: The type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ resource group in agent nodes. Type 'None' will not use MSI for the managed cluster, - service principal will be used instead. Possible values include: "SystemAssigned", - "UserAssigned", "None". + service principal will be used instead. Known values are: "SystemAssigned", "UserAssigned", + "None". :vartype type: str or ~azure.mgmt.containerservice.v2021_02_01.models.ResourceIdentityType :ivar user_assigned_identities: The user identity associated with the managed cluster. This identity will be used in control plane and only one user assigned identity is allowed. The user @@ -3258,15 +3248,15 @@ class ManagedClusterIdentity(msrest.serialization.Model): def __init__( self, *, - type: Optional[Union[str, "ResourceIdentityType"]] = None, - user_assigned_identities: Optional[Dict[str, "Components1Umhcm8SchemasManagedclusteridentityPropertiesUserassignedidentitiesAdditionalproperties"]] = None, + type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, + user_assigned_identities: Optional[Dict[str, "_models.Components1Umhcm8SchemasManagedclusteridentityPropertiesUserassignedidentitiesAdditionalproperties"]] = None, **kwargs ): """ :keyword type: The type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ resource group in agent nodes. Type 'None' will not use MSI for the managed - cluster, service principal will be used instead. Possible values include: "SystemAssigned", + cluster, service principal will be used instead. Known values are: "SystemAssigned", "UserAssigned", "None". :paramtype type: str or ~azure.mgmt.containerservice.v2021_02_01.models.ResourceIdentityType :keyword user_assigned_identities: The user identity associated with the managed cluster. This @@ -3306,7 +3296,7 @@ class ManagedClusterListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["ManagedCluster"]] = None, + value: Optional[List["_models.ManagedCluster"]] = None, **kwargs ): """ @@ -3360,10 +3350,10 @@ class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): def __init__( self, *, - managed_outbound_i_ps: Optional["ManagedClusterLoadBalancerProfileManagedOutboundIPs"] = None, - outbound_ip_prefixes: Optional["ManagedClusterLoadBalancerProfileOutboundIPPrefixes"] = None, - outbound_i_ps: Optional["ManagedClusterLoadBalancerProfileOutboundIPs"] = None, - effective_outbound_i_ps: Optional[List["ResourceReference"]] = None, + managed_outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileManagedOutboundIPs"] = None, + outbound_ip_prefixes: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPPrefixes"] = None, + outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPs"] = None, + effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, allocated_outbound_ports: Optional[int] = 0, idle_timeout_in_minutes: Optional[int] = 30, **kwargs @@ -3446,7 +3436,7 @@ class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.M def __init__( self, *, - public_ip_prefixes: Optional[List["ResourceReference"]] = None, + public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, **kwargs ): """ @@ -3472,7 +3462,7 @@ class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): def __init__( self, *, - public_i_ps: Optional[List["ResourceReference"]] = None, + public_i_ps: Optional[List["_models.ResourceReference"]] = None, **kwargs ): """ @@ -3496,8 +3486,8 @@ class ManagedClusterPodIdentity(msrest.serialization.Model): :vartype namespace: str :ivar identity: Required. Information of the user assigned identity. :vartype identity: ~azure.mgmt.containerservice.v2021_02_01.models.UserAssignedIdentity - :ivar provisioning_state: The current provisioning state of the pod identity. Possible values - include: "Assigned", "Updating", "Deleting", "Failed". + :ivar provisioning_state: The current provisioning state of the pod identity. Known values are: + "Assigned", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2021_02_01.models.ManagedClusterPodIdentityProvisioningState :ivar provisioning_info: @@ -3526,7 +3516,7 @@ def __init__( *, name: str, namespace: str, - identity: "UserAssignedIdentity", + identity: "_models.UserAssignedIdentity", **kwargs ): """ @@ -3620,8 +3610,8 @@ def __init__( *, enabled: Optional[bool] = None, allow_network_plugin_kubenet: Optional[bool] = None, - user_assigned_identities: Optional[List["ManagedClusterPodIdentity"]] = None, - user_assigned_identity_exceptions: Optional[List["ManagedClusterPodIdentityException"]] = None, + user_assigned_identities: Optional[List["_models.ManagedClusterPodIdentity"]] = None, + user_assigned_identity_exceptions: Optional[List["_models.ManagedClusterPodIdentityException"]] = None, **kwargs ): """ @@ -3658,7 +3648,7 @@ class ManagedClusterPodIdentityProvisioningInfo(msrest.serialization.Model): def __init__( self, *, - error: Optional["CloudError"] = None, + error: Optional["_models.CloudError"] = None, **kwargs ): """ @@ -3679,7 +3669,7 @@ class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): :ivar name: Pool name. :vartype name: str :ivar os_type: Required. OsType to be used to specify os type. Choose from Linux and Windows. - Default to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2021_02_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -3702,9 +3692,9 @@ def __init__( self, *, kubernetes_version: str, - os_type: Union[str, "OSType"] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", name: Optional[str] = None, - upgrades: Optional[List["ManagedClusterPoolUpgradeProfileUpgradesItem"]] = None, + upgrades: Optional[List["_models.ManagedClusterPoolUpgradeProfileUpgradesItem"]] = None, **kwargs ): """ @@ -3713,7 +3703,7 @@ def __init__( :keyword name: Pool name. :paramtype name: str :keyword os_type: Required. OsType to be used to specify os type. Choose from Linux and - Windows. Default to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Windows. Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2021_02_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: @@ -3763,7 +3753,7 @@ class ManagedClusterPropertiesAutoScalerProfile(msrest.serialization.Model): :ivar balance_similar_node_groups: :vartype balance_similar_node_groups: str - :ivar expander: Possible values include: "least-waste", "most-pods", "priority", "random". + :ivar expander: Known values are: "least-waste", "most-pods", "priority", "random". :vartype expander: str or ~azure.mgmt.containerservice.v2021_02_01.models.Expander :ivar max_empty_bulk_delete: :vartype max_empty_bulk_delete: str @@ -3821,7 +3811,7 @@ def __init__( self, *, balance_similar_node_groups: Optional[str] = None, - expander: Optional[Union[str, "Expander"]] = None, + expander: Optional[Union[str, "_models.Expander"]] = None, max_empty_bulk_delete: Optional[str] = None, max_graceful_termination_sec: Optional[str] = None, max_node_provision_time: Optional[str] = None, @@ -3842,7 +3832,7 @@ def __init__( """ :keyword balance_similar_node_groups: :paramtype balance_similar_node_groups: str - :keyword expander: Possible values include: "least-waste", "most-pods", "priority", "random". + :keyword expander: Known values are: "least-waste", "most-pods", "priority", "random". :paramtype expander: str or ~azure.mgmt.containerservice.v2021_02_01.models.Expander :keyword max_empty_bulk_delete: :paramtype max_empty_bulk_delete: str @@ -3936,9 +3926,9 @@ def __init__( class ManagedClusterSKU(msrest.serialization.Model): """ManagedClusterSKU. - :ivar name: Name of a managed cluster SKU. Possible values include: "Basic". + :ivar name: Name of a managed cluster SKU. Known values are: "Basic". :vartype name: str or ~azure.mgmt.containerservice.v2021_02_01.models.ManagedClusterSKUName - :ivar tier: Tier of a managed cluster SKU. Possible values include: "Paid", "Free". + :ivar tier: Tier of a managed cluster SKU. Known values are: "Paid", "Free". :vartype tier: str or ~azure.mgmt.containerservice.v2021_02_01.models.ManagedClusterSKUTier """ @@ -3950,14 +3940,14 @@ class ManagedClusterSKU(msrest.serialization.Model): def __init__( self, *, - name: Optional[Union[str, "ManagedClusterSKUName"]] = None, - tier: Optional[Union[str, "ManagedClusterSKUTier"]] = None, + name: Optional[Union[str, "_models.ManagedClusterSKUName"]] = None, + tier: Optional[Union[str, "_models.ManagedClusterSKUTier"]] = None, **kwargs ): """ - :keyword name: Name of a managed cluster SKU. Possible values include: "Basic". + :keyword name: Name of a managed cluster SKU. Known values are: "Basic". :paramtype name: str or ~azure.mgmt.containerservice.v2021_02_01.models.ManagedClusterSKUName - :keyword tier: Tier of a managed cluster SKU. Possible values include: "Paid", "Free". + :keyword tier: Tier of a managed cluster SKU. Known values are: "Paid", "Free". :paramtype tier: str or ~azure.mgmt.containerservice.v2021_02_01.models.ManagedClusterSKUTier """ super(ManagedClusterSKU, self).__init__(**kwargs) @@ -4006,8 +3996,8 @@ class ManagedClusterUpgradeProfile(msrest.serialization.Model): def __init__( self, *, - control_plane_profile: "ManagedClusterPoolUpgradeProfile", - agent_pool_profiles: List["ManagedClusterPoolUpgradeProfile"], + control_plane_profile: "_models.ManagedClusterPoolUpgradeProfile", + agent_pool_profiles: List["_models.ManagedClusterPoolUpgradeProfile"], **kwargs ): """ @@ -4049,7 +4039,7 @@ class ManagedClusterWindowsProfile(msrest.serialization.Model): "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!". :vartype admin_password: str :ivar license_type: 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". + Azure Hybrid User Benefits for Windows VMs. Known values are: "None", "Windows_Server". :vartype license_type: str or ~azure.mgmt.containerservice.v2021_02_01.models.LicenseType """ @@ -4068,7 +4058,7 @@ def __init__( *, admin_username: str, admin_password: Optional[str] = None, - license_type: Optional[Union[str, "LicenseType"]] = None, + license_type: Optional[Union[str, "_models.LicenseType"]] = None, **kwargs ): """ @@ -4089,7 +4079,7 @@ def __init__( "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!". :paramtype admin_password: str :keyword license_type: 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". + Azure Hybrid User Benefits for Windows VMs. Known values are: "None", "Windows_Server". :paramtype license_type: str or ~azure.mgmt.containerservice.v2021_02_01.models.LicenseType """ super(ManagedClusterWindowsProfile, self).__init__(**kwargs) @@ -4180,8 +4170,8 @@ def __init__( class PowerState(msrest.serialization.Model): """Describes the Power State of the cluster. - :ivar code: Tells whether the cluster is Running or Stopped. Possible values include: - "Running", "Stopped". + :ivar code: Tells whether the cluster is Running or Stopped. Known values are: "Running", + "Stopped". :vartype code: str or ~azure.mgmt.containerservice.v2021_02_01.models.Code """ @@ -4192,12 +4182,12 @@ class PowerState(msrest.serialization.Model): def __init__( self, *, - code: Optional[Union[str, "Code"]] = None, + code: Optional[Union[str, "_models.Code"]] = None, **kwargs ): """ - :keyword code: Tells whether the cluster is Running or Stopped. Possible values include: - "Running", "Stopped". + :keyword code: Tells whether the cluster is Running or Stopped. Known values are: "Running", + "Stopped". :paramtype code: str or ~azure.mgmt.containerservice.v2021_02_01.models.Code """ super(PowerState, self).__init__(**kwargs) @@ -4240,7 +4230,7 @@ class PrivateEndpointConnection(msrest.serialization.Model): :vartype name: str :ivar type: The resource type. :vartype type: str - :ivar provisioning_state: The current provisioning state. Possible values include: "Succeeded", + :ivar provisioning_state: The current provisioning state. Known values are: "Succeeded", "Creating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2021_02_01.models.PrivateEndpointConnectionProvisioningState @@ -4271,8 +4261,8 @@ class PrivateEndpointConnection(msrest.serialization.Model): def __init__( self, *, - private_endpoint: Optional["PrivateEndpoint"] = None, - private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, + private_endpoint: Optional["_models.PrivateEndpoint"] = None, + private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionState"] = None, **kwargs ): """ @@ -4306,7 +4296,7 @@ class PrivateEndpointConnectionListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["PrivateEndpointConnection"]] = None, + value: Optional[List["_models.PrivateEndpointConnection"]] = None, **kwargs ): """ @@ -4396,7 +4386,7 @@ class PrivateLinkResourcesListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["PrivateLinkResource"]] = None, + value: Optional[List["_models.PrivateLinkResource"]] = None, **kwargs ): """ @@ -4410,7 +4400,7 @@ def __init__( class PrivateLinkServiceConnectionState(msrest.serialization.Model): """The state of a private link service connection. - :ivar status: The private link service connection status. Possible values include: "Pending", + :ivar status: The private link service connection status. Known values are: "Pending", "Approved", "Rejected", "Disconnected". :vartype status: str or ~azure.mgmt.containerservice.v2021_02_01.models.ConnectionStatus :ivar description: The private link service connection description. @@ -4425,13 +4415,13 @@ class PrivateLinkServiceConnectionState(msrest.serialization.Model): def __init__( self, *, - status: Optional[Union[str, "ConnectionStatus"]] = None, + status: Optional[Union[str, "_models.ConnectionStatus"]] = None, description: Optional[str] = None, **kwargs ): """ - :keyword status: The private link service connection status. Possible values include: - "Pending", "Approved", "Rejected", "Disconnected". + :keyword status: The private link service connection status. Known values are: "Pending", + "Approved", "Rejected", "Disconnected". :paramtype status: str or ~azure.mgmt.containerservice.v2021_02_01.models.ConnectionStatus :keyword description: The private link service connection description. :paramtype description: str @@ -4685,15 +4675,15 @@ class SystemData(msrest.serialization.Model): :ivar created_by: The identity that created the resource. :vartype created_by: str - :ivar created_by_type: The type of identity that created the resource. Possible values include: + :ivar created_by_type: The type of identity that created the resource. Known values are: "User", "Application", "ManagedIdentity", "Key". :vartype created_by_type: str or ~azure.mgmt.containerservice.v2021_02_01.models.CreatedByType :ivar created_at: The timestamp of resource creation (UTC). :vartype created_at: ~datetime.datetime :ivar last_modified_by: The identity that last modified the resource. :vartype last_modified_by: str - :ivar last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". + :ivar last_modified_by_type: The type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", "Key". :vartype last_modified_by_type: str or ~azure.mgmt.containerservice.v2021_02_01.models.CreatedByType :ivar last_modified_at: The type of identity that last modified the resource. @@ -4713,26 +4703,26 @@ def __init__( self, *, created_by: Optional[str] = None, - created_by_type: Optional[Union[str, "CreatedByType"]] = None, + created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, created_at: Optional[datetime.datetime] = None, last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[Union[str, "CreatedByType"]] = None, + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, last_modified_at: Optional[datetime.datetime] = None, **kwargs ): """ :keyword created_by: The identity that created the resource. :paramtype created_by: str - :keyword created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". + :keyword created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", "Key". :paramtype created_by_type: str or ~azure.mgmt.containerservice.v2021_02_01.models.CreatedByType :keyword created_at: The timestamp of resource creation (UTC). :paramtype created_at: ~datetime.datetime :keyword last_modified_by: The identity that last modified the resource. :paramtype last_modified_by: str - :keyword last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". + :keyword last_modified_by_type: The type of identity that last modified the resource. Known + values are: "User", "Application", "ManagedIdentity", "Key". :paramtype last_modified_by_type: str or ~azure.mgmt.containerservice.v2021_02_01.models.CreatedByType :keyword last_modified_at: The type of identity that last modified the resource. @@ -4775,8 +4765,8 @@ def __init__( class TimeInWeek(msrest.serialization.Model): """Time in a week. - :ivar day: A day in a week. Possible values include: "Sunday", "Monday", "Tuesday", - "Wednesday", "Thursday", "Friday", "Saturday". + :ivar day: A day in a week. Known values are: "Sunday", "Monday", "Tuesday", "Wednesday", + "Thursday", "Friday", "Saturday". :vartype day: str or ~azure.mgmt.containerservice.v2021_02_01.models.WeekDay :ivar hour_slots: hour slots in a day. :vartype hour_slots: list[int] @@ -4790,13 +4780,13 @@ class TimeInWeek(msrest.serialization.Model): def __init__( self, *, - day: Optional[Union[str, "WeekDay"]] = None, + day: Optional[Union[str, "_models.WeekDay"]] = None, hour_slots: Optional[List[int]] = None, **kwargs ): """ - :keyword day: A day in a week. Possible values include: "Sunday", "Monday", "Tuesday", - "Wednesday", "Thursday", "Friday", "Saturday". + :keyword day: A day in a week. Known values are: "Sunday", "Monday", "Tuesday", "Wednesday", + "Thursday", "Friday", "Saturday". :paramtype day: str or ~azure.mgmt.containerservice.v2021_02_01.models.WeekDay :keyword hour_slots: hour slots in a day. :paramtype hour_slots: list[int] diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/models/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/models/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/operations/__init__.py index 3942e0ca6a01..f0e265d9f2f4 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/operations/__init__.py @@ -14,6 +14,9 @@ from ._private_link_resources_operations import PrivateLinkResourcesOperations from ._resolve_private_link_service_id_operations import ResolvePrivateLinkServiceIdOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'Operations', 'ManagedClustersOperations', @@ -23,3 +26,5 @@ 'PrivateLinkResourcesOperations', 'ResolvePrivateLinkServiceIdOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/operations/_agent_pools_operations.py index e6e588f01aaa..e04d0e8a8af4 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/operations/_agent_pools_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -35,9 +35,12 @@ def build_list_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools") # pylint: disable=line-too-long path_format_arguments = { @@ -49,18 +52,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -72,9 +73,12 @@ def build_get_request( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -87,18 +91,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -109,14 +111,17 @@ def build_create_or_update_request_initial( resource_name: str, agent_pool_name: str, *, - json: JSONType = None, + json: Optional[_models.AgentPool] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-02-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -129,20 +134,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -156,9 +159,12 @@ def build_delete_request_initial( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -171,18 +177,16 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -194,9 +198,12 @@ def build_get_upgrade_profile_request( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default") # pylint: disable=line-too-long path_format_arguments = { @@ -209,18 +216,16 @@ def build_get_upgrade_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -231,9 +236,12 @@ def build_get_available_agent_pool_versions_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions") # pylint: disable=line-too-long path_format_arguments = { @@ -245,18 +253,16 @@ def build_get_available_agent_pool_versions_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -268,9 +274,12 @@ def build_upgrade_node_image_version_request_initial( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion") # pylint: disable=line-too-long path_format_arguments = { @@ -283,42 +292,38 @@ def build_upgrade_node_image_version_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class AgentPoolsOperations(object): - """AgentPoolsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class AgentPoolsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_02_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_02_01.ContainerServiceClient`'s + :attr:`agent_pools` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -326,7 +331,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Iterable["_models.AgentPoolListResult"]: + ) -> Iterable[_models.AgentPoolListResult]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. The operation returns properties @@ -342,13 +347,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_02_01.models.AgentPoolListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -358,9 +366,11 @@ def prepare_request(next_link=None): resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -370,9 +380,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -412,7 +424,7 @@ def get( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPool": + ) -> _models.AgentPool: """Gets the agent pool. Gets the details of the agent pool by managed cluster and resource group. @@ -428,13 +440,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2021_02_01.models.AgentPool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-02-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] request = build_get_request( @@ -444,11 +459,13 @@ def get( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -474,17 +491,20 @@ def _create_or_update_initial( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> "_models.AgentPool": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] + ) -> _models.AgentPool: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] _json = self._serialize.body(parameters, 'AgentPool') @@ -497,11 +517,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -532,9 +554,9 @@ def begin_create_or_update( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> LROPoller["_models.AgentPool"]: + ) -> LROPoller[_models.AgentPool]: """Creates or updates an agent pool. Creates or updates an agent pool in the specified managed cluster. @@ -560,17 +582,20 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_02_01.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, @@ -578,20 +603,27 @@ def begin_create_or_update( 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): - response = pipeline_response.http_response deserialized = self._deserialize('AgentPool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -611,13 +643,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements agent_pool_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-02-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -627,11 +662,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -678,21 +715,26 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-02-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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) @@ -702,8 +744,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -723,7 +771,7 @@ def get_upgrade_profile( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPoolUpgradeProfile": + ) -> _models.AgentPoolUpgradeProfile: """Gets upgrade profile for an agent pool. Gets the details of the upgrade profile for an agent pool with a specified resource group and @@ -740,13 +788,16 @@ def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2021_02_01.models.AgentPoolUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] request = build_get_upgrade_profile_request( @@ -756,11 +807,13 @@ def get_upgrade_profile( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -787,7 +840,7 @@ def get_available_agent_pool_versions( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.AgentPoolAvailableVersions": + ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported versions for the specified agent pool. Gets a list of supported versions for the specified agent pool. @@ -801,13 +854,16 @@ def get_available_agent_pool_versions( :rtype: ~azure.mgmt.containerservice.v2021_02_01.models.AgentPoolAvailableVersions :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolAvailableVersions"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-02-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] request = build_get_available_agent_pool_versions_request( @@ -816,11 +872,13 @@ def get_available_agent_pool_versions( resource_name=resource_name, api_version=api_version, template_url=self.get_available_agent_pool_versions.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -847,14 +905,17 @@ def _upgrade_node_image_version_initial( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> Optional["_models.AgentPool"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.AgentPool"]] + ) -> Optional[_models.AgentPool]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] request = build_upgrade_node_image_version_request_initial( @@ -864,11 +925,13 @@ def _upgrade_node_image_version_initial( agent_pool_name=agent_pool_name, api_version=api_version, template_url=self._upgrade_node_image_version_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -898,7 +961,7 @@ def begin_upgrade_node_image_version( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> LROPoller["_models.AgentPool"]: + ) -> LROPoller[_models.AgentPool]: """Upgrade node image version of an agent pool to the latest. Upgrade node image version of an agent pool to the latest. @@ -922,35 +985,45 @@ def begin_upgrade_node_image_version( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_02_01.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._upgrade_node_image_version_initial( + raw_result = self._upgrade_node_image_version_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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): - response = pipeline_response.http_response deserialized = self._deserialize('AgentPool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/operations/_maintenance_configurations_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/operations/_maintenance_configurations_operations.py index cf0bdb6fb05c..88558b929767 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/operations/_maintenance_configurations_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/operations/_maintenance_configurations_operations.py @@ -16,12 +16,12 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -33,9 +33,12 @@ def build_list_by_managed_cluster_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations") # pylint: disable=line-too-long path_format_arguments = { @@ -47,18 +50,16 @@ def build_list_by_managed_cluster_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -70,9 +71,12 @@ def build_get_request( config_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long path_format_arguments = { @@ -85,18 +89,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -107,14 +109,17 @@ def build_create_or_update_request( resource_name: str, config_name: str, *, - json: JSONType = None, + json: Optional[_models.MaintenanceConfiguration] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-02-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long path_format_arguments = { @@ -127,20 +132,18 @@ def build_create_or_update_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -154,9 +157,12 @@ def build_delete_request( config_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long path_format_arguments = { @@ -169,42 +175,38 @@ def build_delete_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class MaintenanceConfigurationsOperations(object): - """MaintenanceConfigurationsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class MaintenanceConfigurationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_02_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_02_01.ContainerServiceClient`'s + :attr:`maintenance_configurations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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_by_managed_cluster( @@ -212,7 +214,7 @@ def list_by_managed_cluster( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Iterable["_models.MaintenanceConfigurationListResult"]: + ) -> Iterable[_models.MaintenanceConfigurationListResult]: """Gets a list of maintenance configurations in the specified managed cluster. Gets a list of maintenance configurations in the specified managed cluster. The operation @@ -229,13 +231,16 @@ def list_by_managed_cluster( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_02_01.models.MaintenanceConfigurationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfigurationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfigurationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -245,9 +250,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=self.list_by_managed_cluster.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -257,9 +264,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -299,7 +308,7 @@ def get( resource_name: str, config_name: str, **kwargs: Any - ) -> "_models.MaintenanceConfiguration": + ) -> _models.MaintenanceConfiguration: """Gets the maintenance configuration. Gets the details of maintenance configurations by managed cluster and resource group. @@ -315,13 +324,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2021_02_01.models.MaintenanceConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfiguration"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-02-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] request = build_get_request( @@ -331,11 +343,13 @@ def get( config_name=config_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -362,9 +376,9 @@ def create_or_update( resource_group_name: str, resource_name: str, config_name: str, - parameters: "_models.MaintenanceConfiguration", + parameters: _models.MaintenanceConfiguration, **kwargs: Any - ) -> "_models.MaintenanceConfiguration": + ) -> _models.MaintenanceConfiguration: """Creates or updates a maintenance configurations. Creates or updates a maintenance configuration in the specified managed cluster. @@ -383,14 +397,17 @@ def create_or_update( :rtype: ~azure.mgmt.containerservice.v2021_02_01.models.MaintenanceConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfiguration"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] _json = self._serialize.body(parameters, 'MaintenanceConfiguration') @@ -403,11 +420,13 @@ def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -451,13 +470,16 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-02-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -467,11 +489,13 @@ def delete( # pylint: disable=inconsistent-return-statements config_name=config_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/operations/_managed_clusters_operations.py index 481514b3b28b..7d7efc8074af 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/operations/_managed_clusters_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -33,9 +33,12 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters") path_format_arguments = { @@ -45,18 +48,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -66,9 +67,12 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters") # pylint: disable=line-too-long path_format_arguments = { @@ -79,18 +83,16 @@ def build_list_by_resource_group_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -101,9 +103,12 @@ def build_get_upgrade_profile_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default") # pylint: disable=line-too-long path_format_arguments = { @@ -115,18 +120,16 @@ def build_get_upgrade_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -138,9 +141,12 @@ def build_get_access_profile_request( role_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -153,18 +159,16 @@ def build_get_access_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -175,9 +179,12 @@ def build_list_cluster_admin_credentials_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -189,18 +196,16 @@ def build_list_cluster_admin_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -211,9 +216,12 @@ def build_list_cluster_user_credentials_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -225,18 +233,16 @@ def build_list_cluster_user_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -247,9 +253,12 @@ def build_list_cluster_monitoring_user_credentials_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -261,18 +270,16 @@ def build_list_cluster_monitoring_user_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -283,9 +290,12 @@ def build_get_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -297,18 +307,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -318,14 +326,17 @@ def build_create_or_update_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedCluster] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-02-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -337,20 +348,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -362,14 +371,17 @@ def build_update_tags_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.TagsObject] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-02-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -381,20 +393,18 @@ def build_update_tags_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -407,9 +417,12 @@ def build_delete_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -421,18 +434,16 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -442,14 +453,17 @@ def build_reset_service_principal_profile_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedClusterServicePrincipalProfile] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-02-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile") # pylint: disable=line-too-long path_format_arguments = { @@ -461,20 +475,18 @@ def build_reset_service_principal_profile_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -486,14 +498,17 @@ def build_reset_aad_profile_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedClusterAADProfile] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-02-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile") # pylint: disable=line-too-long path_format_arguments = { @@ -505,20 +520,18 @@ def build_reset_aad_profile_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -531,9 +544,12 @@ def build_rotate_cluster_certificates_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates") # pylint: disable=line-too-long path_format_arguments = { @@ -545,18 +561,16 @@ def build_rotate_cluster_certificates_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -567,9 +581,12 @@ def build_stop_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop") # pylint: disable=line-too-long path_format_arguments = { @@ -581,18 +598,16 @@ def build_stop_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -603,9 +618,12 @@ def build_start_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start") # pylint: disable=line-too-long path_format_arguments = { @@ -617,48 +635,44 @@ def build_start_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class ManagedClustersOperations(object): # pylint: disable=too-many-public-methods - """ManagedClustersOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ManagedClustersOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_02_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_02_01.ContainerServiceClient`'s + :attr:`managed_clusters` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> Iterable["_models.ManagedClusterListResult"]: + ) -> Iterable[_models.ManagedClusterListResult]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. The operation returns properties @@ -671,13 +685,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_02_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -685,9 +702,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -695,9 +714,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -735,7 +756,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.ManagedClusterListResult"]: + ) -> Iterable[_models.ManagedClusterListResult]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. The operation returns @@ -750,13 +771,16 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_02_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -765,9 +789,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -776,9 +802,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -817,7 +845,7 @@ def get_upgrade_profile( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedClusterUpgradeProfile": + ) -> _models.ManagedClusterUpgradeProfile: """Gets upgrade profile for a managed cluster. Gets the details of the upgrade profile for a managed cluster with a specified resource group @@ -832,13 +860,16 @@ def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2021_02_01.models.ManagedClusterUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] request = build_get_upgrade_profile_request( @@ -847,11 +878,13 @@ def get_upgrade_profile( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -879,7 +912,7 @@ def get_access_profile( resource_name: str, role_name: str, **kwargs: Any - ) -> "_models.ManagedClusterAccessProfile": + ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. Gets the accessProfile for the specified role name of the managed cluster with a specified @@ -900,13 +933,16 @@ def get_access_profile( :rtype: ~azure.mgmt.containerservice.v2021_02_01.models.ManagedClusterAccessProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterAccessProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-02-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] request = build_get_access_profile_request( @@ -916,11 +952,13 @@ def get_access_profile( role_name=role_name, api_version=api_version, template_url=self.get_access_profile.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -947,7 +985,7 @@ def list_cluster_admin_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster admin credential of a managed cluster. Gets cluster admin credential of the managed cluster with a specified resource group and name. @@ -961,13 +999,16 @@ def list_cluster_admin_credentials( :rtype: ~azure.mgmt.containerservice.v2021_02_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-02-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_admin_credentials_request( @@ -976,11 +1017,13 @@ def list_cluster_admin_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_admin_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1007,7 +1050,7 @@ def list_cluster_user_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster user credential of a managed cluster. Gets cluster user credential of the managed cluster with a specified resource group and name. @@ -1021,13 +1064,16 @@ def list_cluster_user_credentials( :rtype: ~azure.mgmt.containerservice.v2021_02_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_user_credentials_request( @@ -1036,11 +1082,13 @@ def list_cluster_user_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1067,7 +1115,7 @@ def list_cluster_monitoring_user_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster monitoring user credential of a managed cluster. Gets cluster monitoring user credential of the managed cluster with a specified resource group @@ -1082,13 +1130,16 @@ def list_cluster_monitoring_user_credentials( :rtype: ~azure.mgmt.containerservice.v2021_02_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-02-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_monitoring_user_credentials_request( @@ -1097,11 +1148,13 @@ def list_cluster_monitoring_user_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1128,7 +1181,7 @@ def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedCluster": + ) -> _models.ManagedCluster: """Gets a managed cluster. Gets the details of the managed cluster with a specified resource group and name. @@ -1142,13 +1195,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2021_02_01.models.ManagedCluster :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-02-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] request = build_get_request( @@ -1157,11 +1213,13 @@ def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1186,17 +1244,20 @@ def _create_or_update_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'ManagedCluster') @@ -1208,11 +1269,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1242,9 +1305,9 @@ def begin_create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> LROPoller["_models.ManagedCluster"]: + ) -> LROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. Creates or updates a managed cluster with the specified configuration for agents and Kubernetes @@ -1270,37 +1333,47 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_02_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1317,17 +1390,20 @@ def _update_tags_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'TagsObject') @@ -1339,11 +1415,13 @@ def _update_tags_initial( content_type=content_type, json=_json, template_url=self._update_tags_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1369,9 +1447,9 @@ def begin_update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> LROPoller["_models.ManagedCluster"]: + ) -> LROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates a managed cluster with the specified tags. @@ -1396,37 +1474,47 @@ def begin_update_tags( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_02_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._update_tags_initial( + raw_result = self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1445,13 +1533,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-02-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -1460,11 +1551,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1508,20 +1601,25 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-02-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_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) @@ -1531,8 +1629,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1549,17 +1653,20 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') @@ -1571,11 +1678,13 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re content_type=content_type, json=_json, template_url=self._reset_service_principal_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1597,7 +1706,7 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> LROPoller[None]: """Reset Service Principal Profile of a managed cluster. @@ -1624,23 +1733,28 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._reset_service_principal_profile_initial( + raw_result = self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1650,8 +1764,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1668,17 +1788,20 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') @@ -1690,11 +1813,13 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement content_type=content_type, json=_json, template_url=self._reset_aad_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1716,7 +1841,7 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> LROPoller[None]: """Reset AAD Profile of a managed cluster. @@ -1742,23 +1867,28 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._reset_aad_profile_initial( + raw_result = self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1768,8 +1898,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1788,13 +1924,16 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_rotate_cluster_certificates_request_initial( @@ -1803,11 +1942,13 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return resource_name=resource_name, api_version=api_version, template_url=self._rotate_cluster_certificates_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1851,20 +1992,25 @@ def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-st :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-02-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._rotate_cluster_certificates_initial( + raw_result = self._rotate_cluster_certificates_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) @@ -1874,8 +2020,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1894,13 +2046,16 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_stop_request_initial( @@ -1909,11 +2064,13 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_name, api_version=api_version, template_url=self._stop_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1957,20 +2114,25 @@ def begin_stop( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-02-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._stop_initial( + raw_result = self._stop_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) @@ -1980,8 +2142,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2000,13 +2168,16 @@ def _start_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_start_request_initial( @@ -2015,11 +2186,13 @@ def _start_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_name, api_version=api_version, template_url=self._start_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2063,20 +2236,25 @@ def begin_start( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-02-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._start_initial( + raw_result = self._start_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) @@ -2086,8 +2264,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/operations/_operations.py index 3970dbc37575..0efd52cb8701 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/operations/_operations.py @@ -16,6 +16,7 @@ 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 @@ -29,55 +30,54 @@ def build_list_request( **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.ContainerService/operations") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class Operations(object): - """Operations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_02_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_02_01.ContainerServiceClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> Iterable["_models.OperationListResult"]: + ) -> Iterable[_models.OperationListResult]: """Gets a list of compute operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -86,31 +86,38 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_02_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/operations/_private_endpoint_connections_operations.py index b2ed90399106..a3da829e02c7 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/operations/_private_endpoint_connections_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast from msrest import Serializer @@ -16,13 +16,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -34,9 +34,12 @@ def build_list_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections") # pylint: disable=line-too-long path_format_arguments = { @@ -48,18 +51,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -71,9 +72,12 @@ def build_get_request( private_endpoint_connection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -86,18 +90,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -108,14 +110,17 @@ def build_update_request( resource_name: str, private_endpoint_connection_name: str, *, - json: JSONType = None, + json: Optional[_models.PrivateEndpointConnection] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-02-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -128,20 +133,18 @@ def build_update_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -155,9 +158,12 @@ def build_delete_request_initial( private_endpoint_connection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -170,42 +176,38 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class PrivateEndpointConnectionsOperations(object): - """PrivateEndpointConnectionsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class PrivateEndpointConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_02_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_02_01.ContainerServiceClient`'s + :attr:`private_endpoint_connections` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -213,7 +215,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnectionListResult": + ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. Gets a list of private endpoint connections in the specified managed cluster. The operation @@ -228,13 +230,16 @@ def list( :rtype: ~azure.mgmt.containerservice.v2021_02_01.models.PrivateEndpointConnectionListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] request = build_list_request( @@ -243,11 +248,13 @@ def list( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -275,7 +282,7 @@ def get( resource_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Gets the private endpoint connection. Gets the details of the private endpoint connection by managed cluster and resource group. @@ -291,13 +298,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2021_02_01.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-02-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] request = build_get_request( @@ -307,11 +317,13 @@ def get( private_endpoint_connection_name=private_endpoint_connection_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -338,9 +350,9 @@ def update( resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - parameters: "_models.PrivateEndpointConnection", + parameters: _models.PrivateEndpointConnection, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. Updates a private endpoint connection in the specified managed cluster. @@ -358,14 +370,17 @@ def update( :rtype: ~azure.mgmt.containerservice.v2021_02_01.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] _json = self._serialize.body(parameters, 'PrivateEndpointConnection') @@ -378,11 +393,13 @@ def update( content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -410,13 +427,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -426,11 +446,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name=private_endpoint_connection_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -477,21 +499,26 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-02-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -501,8 +528,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/operations/_private_link_resources_operations.py index 3558299a1fec..5ed0f7be72c8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/operations/_private_link_resources_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/operations/_private_link_resources_operations.py @@ -15,6 +15,7 @@ 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 @@ -31,9 +32,12 @@ def build_list_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources") # pylint: disable=line-too-long path_format_arguments = { @@ -45,42 +49,38 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class PrivateLinkResourcesOperations(object): - """PrivateLinkResourcesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class PrivateLinkResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_02_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_02_01.ContainerServiceClient`'s + :attr:`private_link_resources` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -88,7 +88,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.PrivateLinkResourcesListResult": + ) -> _models.PrivateLinkResourcesListResult: """Gets a list of private link resources in the specified managed cluster. Gets a list of private link resources in the specified managed cluster. The operation returns @@ -103,13 +103,16 @@ def list( :rtype: ~azure.mgmt.containerservice.v2021_02_01.models.PrivateLinkResourcesListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourcesListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-02-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] request = build_list_request( @@ -118,11 +121,13 @@ def list( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/operations/_resolve_private_link_service_id_operations.py index d97fc85473ee..e7afe109326e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/operations/_resolve_private_link_service_id_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_02_01/operations/_resolve_private_link_service_id_operations.py @@ -15,12 +15,12 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -31,14 +31,17 @@ def build_post_request( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.PrivateLinkResource] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-02-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId") # pylint: disable=line-too-long path_format_arguments = { @@ -50,55 +53,51 @@ def build_post_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs ) -class ResolvePrivateLinkServiceIdOperations(object): - """ResolvePrivateLinkServiceIdOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ResolvePrivateLinkServiceIdOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_02_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_02_01.ContainerServiceClient`'s + :attr:`resolve_private_link_service_id` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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 post( self, resource_group_name: str, resource_name: str, - parameters: "_models.PrivateLinkResource", + parameters: _models.PrivateLinkResource, **kwargs: Any - ) -> "_models.PrivateLinkResource": + ) -> _models.PrivateLinkResource: """Gets the private link service ID for the specified managed cluster. Gets the private link service ID the specified managed cluster. @@ -115,14 +114,17 @@ def post( :rtype: ~azure.mgmt.containerservice.v2021_02_01.models.PrivateLinkResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] _json = self._serialize.body(parameters, 'PrivateLinkResource') @@ -134,11 +136,13 @@ def post( content_type=content_type, json=_json, template_url=self.post.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/__init__.py index 53c675bd95e2..37a5f9e02e6f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._container_service_client import ContainerServiceClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['ContainerServiceClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/_container_service_client.py index 94d812b2bb98..8de79f417824 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/_container_service_client.py @@ -72,13 +72,27 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.managed_clusters = ManagedClustersOperations(self._client, self._config, self._serialize, self._deserialize) - self.maintenance_configurations = MaintenanceConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) - self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) - self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_clusters = ManagedClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.maintenance_configurations = MaintenanceConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.agent_pools = AgentPoolsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/__init__.py index 53c675bd95e2..37a5f9e02e6f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._container_service_client import ContainerServiceClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['ContainerServiceClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/_container_service_client.py index 9cc4766dba8d..165e0e5b603f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/_container_service_client.py @@ -73,13 +73,27 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.managed_clusters = ManagedClustersOperations(self._client, self._config, self._serialize, self._deserialize) - self.maintenance_configurations = MaintenanceConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) - self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) - self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_clusters = ManagedClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.maintenance_configurations = MaintenanceConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.agent_pools = AgentPoolsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/operations/__init__.py index 3942e0ca6a01..f0e265d9f2f4 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/operations/__init__.py @@ -14,6 +14,9 @@ from ._private_link_resources_operations import PrivateLinkResourcesOperations from ._resolve_private_link_service_id_operations import ResolvePrivateLinkServiceIdOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'Operations', 'ManagedClustersOperations', @@ -23,3 +26,5 @@ 'PrivateLinkResourcesOperations', 'ResolvePrivateLinkServiceIdOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/operations/_agent_pools_operations.py index 90977aae05a2..7ed3c2082315 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/operations/_agent_pools_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. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ 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 @@ -26,26 +27,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class AgentPoolsOperations: - """AgentPoolsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_03_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_03_01.aio.ContainerServiceClient`'s + :attr:`agent_pools` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -53,7 +52,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> AsyncIterable["_models.AgentPoolListResult"]: + ) -> AsyncIterable[_models.AgentPoolListResult]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. The operation returns properties @@ -69,13 +68,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_03_01.models.AgentPoolListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -85,9 +87,11 @@ def prepare_request(next_link=None): resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -97,9 +101,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -139,7 +145,7 @@ async def get( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPool": + ) -> _models.AgentPool: """Gets the agent pool. Gets the details of the agent pool by managed cluster and resource group. @@ -155,13 +161,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2021_03_01.models.AgentPool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] request = build_get_request( @@ -171,11 +180,13 @@ async def get( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -201,17 +212,20 @@ async def _create_or_update_initial( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> "_models.AgentPool": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] + ) -> _models.AgentPool: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] _json = self._serialize.body(parameters, 'AgentPool') @@ -224,11 +238,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -259,9 +275,9 @@ async def begin_create_or_update( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> AsyncLROPoller["_models.AgentPool"]: + ) -> AsyncLROPoller[_models.AgentPool]: """Creates or updates an agent pool. Creates or updates an agent pool in the specified managed cluster. @@ -288,17 +304,20 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_03_01.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, @@ -306,20 +325,27 @@ async def begin_create_or_update( 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): - response = pipeline_response.http_response deserialized = self._deserialize('AgentPool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -339,13 +365,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements agent_pool_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -355,11 +384,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -406,21 +437,26 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-03-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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) @@ -430,8 +466,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -451,7 +493,7 @@ async def get_upgrade_profile( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPoolUpgradeProfile": + ) -> _models.AgentPoolUpgradeProfile: """Gets upgrade profile for an agent pool. Gets the details of the upgrade profile for an agent pool with a specified resource group and @@ -468,13 +510,16 @@ async def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2021_03_01.models.AgentPoolUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] request = build_get_upgrade_profile_request( @@ -484,11 +529,13 @@ async def get_upgrade_profile( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -515,7 +562,7 @@ async def get_available_agent_pool_versions( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.AgentPoolAvailableVersions": + ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported versions for the specified agent pool. Gets a list of supported versions for the specified agent pool. @@ -529,13 +576,16 @@ async def get_available_agent_pool_versions( :rtype: ~azure.mgmt.containerservice.v2021_03_01.models.AgentPoolAvailableVersions :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolAvailableVersions"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] request = build_get_available_agent_pool_versions_request( @@ -544,11 +594,13 @@ async def get_available_agent_pool_versions( resource_name=resource_name, api_version=api_version, template_url=self.get_available_agent_pool_versions.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -575,14 +627,17 @@ async def _upgrade_node_image_version_initial( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> Optional["_models.AgentPool"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.AgentPool"]] + ) -> Optional[_models.AgentPool]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] request = build_upgrade_node_image_version_request_initial( @@ -592,11 +647,13 @@ async def _upgrade_node_image_version_initial( agent_pool_name=agent_pool_name, api_version=api_version, template_url=self._upgrade_node_image_version_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -626,7 +683,7 @@ async def begin_upgrade_node_image_version( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> AsyncLROPoller["_models.AgentPool"]: + ) -> AsyncLROPoller[_models.AgentPool]: """Upgrade node image version of an agent pool to the latest. Upgrade node image version of an agent pool to the latest. @@ -651,35 +708,45 @@ async def begin_upgrade_node_image_version( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_03_01.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._upgrade_node_image_version_initial( + raw_result = await self._upgrade_node_image_version_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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): - response = pipeline_response.http_response deserialized = self._deserialize('AgentPool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/operations/_maintenance_configurations_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/operations/_maintenance_configurations_operations.py index 107d86650eec..4cbfba2d1ac0 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/operations/_maintenance_configurations_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/operations/_maintenance_configurations_operations.py @@ -15,6 +15,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -24,26 +25,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class MaintenanceConfigurationsOperations: - """MaintenanceConfigurationsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_03_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_03_01.aio.ContainerServiceClient`'s + :attr:`maintenance_configurations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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_by_managed_cluster( @@ -51,7 +50,7 @@ def list_by_managed_cluster( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> AsyncIterable["_models.MaintenanceConfigurationListResult"]: + ) -> AsyncIterable[_models.MaintenanceConfigurationListResult]: """Gets a list of maintenance configurations in the specified managed cluster. Gets a list of maintenance configurations in the specified managed cluster. The operation @@ -68,13 +67,16 @@ def list_by_managed_cluster( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_03_01.models.MaintenanceConfigurationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfigurationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfigurationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -84,9 +86,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=self.list_by_managed_cluster.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -96,9 +100,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -138,7 +144,7 @@ async def get( resource_name: str, config_name: str, **kwargs: Any - ) -> "_models.MaintenanceConfiguration": + ) -> _models.MaintenanceConfiguration: """Gets the maintenance configuration. Gets the details of maintenance configurations by managed cluster and resource group. @@ -154,13 +160,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2021_03_01.models.MaintenanceConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfiguration"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] request = build_get_request( @@ -170,11 +179,13 @@ async def get( config_name=config_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -201,9 +212,9 @@ async def create_or_update( resource_group_name: str, resource_name: str, config_name: str, - parameters: "_models.MaintenanceConfiguration", + parameters: _models.MaintenanceConfiguration, **kwargs: Any - ) -> "_models.MaintenanceConfiguration": + ) -> _models.MaintenanceConfiguration: """Creates or updates a maintenance configurations. Creates or updates a maintenance configuration in the specified managed cluster. @@ -222,14 +233,17 @@ async def create_or_update( :rtype: ~azure.mgmt.containerservice.v2021_03_01.models.MaintenanceConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfiguration"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] _json = self._serialize.body(parameters, 'MaintenanceConfiguration') @@ -242,11 +256,13 @@ async def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -290,13 +306,16 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -306,11 +325,13 @@ async def delete( # pylint: disable=inconsistent-return-statements config_name=config_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/operations/_managed_clusters_operations.py index fcea5bce9edd..b118de1e5908 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/operations/_managed_clusters_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. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ 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 @@ -26,26 +27,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ManagedClustersOperations: # pylint: disable=too-many-public-methods - """ManagedClustersOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_03_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_03_01.aio.ContainerServiceClient`'s + :attr:`managed_clusters` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace_async async def get_os_options( @@ -53,7 +52,7 @@ async def get_os_options( location: str, resource_type: Optional[str] = None, **kwargs: Any - ) -> "_models.OSOptionProfile": + ) -> _models.OSOptionProfile: """Gets supported OS options in the specified subscription. Gets supported OS options in the specified subscription. @@ -68,13 +67,16 @@ async def get_os_options( :rtype: ~azure.mgmt.containerservice.v2021_03_01.models.OSOptionProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OSOptionProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OSOptionProfile] request = build_get_os_options_request( @@ -83,11 +85,13 @@ async def get_os_options( api_version=api_version, resource_type=resource_type, template_url=self.get_os_options.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -112,7 +116,7 @@ async def get_os_options( def list( self, **kwargs: Any - ) -> AsyncIterable["_models.ManagedClusterListResult"]: + ) -> AsyncIterable[_models.ManagedClusterListResult]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. The operation returns properties @@ -125,13 +129,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_03_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -139,9 +146,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -149,9 +158,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -189,7 +200,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ManagedClusterListResult"]: + ) -> AsyncIterable[_models.ManagedClusterListResult]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. The operation returns @@ -204,13 +215,16 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_03_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -219,9 +233,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -230,9 +246,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -271,7 +289,7 @@ async def get_upgrade_profile( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedClusterUpgradeProfile": + ) -> _models.ManagedClusterUpgradeProfile: """Gets upgrade profile for a managed cluster. Gets the details of the upgrade profile for a managed cluster with a specified resource group @@ -286,13 +304,16 @@ async def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2021_03_01.models.ManagedClusterUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] request = build_get_upgrade_profile_request( @@ -301,11 +322,13 @@ async def get_upgrade_profile( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -333,7 +356,7 @@ async def get_access_profile( resource_name: str, role_name: str, **kwargs: Any - ) -> "_models.ManagedClusterAccessProfile": + ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. Gets the accessProfile for the specified role name of the managed cluster with a specified @@ -354,13 +377,16 @@ async def get_access_profile( :rtype: ~azure.mgmt.containerservice.v2021_03_01.models.ManagedClusterAccessProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterAccessProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] request = build_get_access_profile_request( @@ -370,11 +396,13 @@ async def get_access_profile( role_name=role_name, api_version=api_version, template_url=self.get_access_profile.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -401,7 +429,7 @@ async def list_cluster_admin_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster admin credential of a managed cluster. Gets cluster admin credential of the managed cluster with a specified resource group and name. @@ -415,13 +443,16 @@ async def list_cluster_admin_credentials( :rtype: ~azure.mgmt.containerservice.v2021_03_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_admin_credentials_request( @@ -430,11 +461,13 @@ async def list_cluster_admin_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_admin_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -461,7 +494,7 @@ async def list_cluster_user_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster user credential of a managed cluster. Gets cluster user credential of the managed cluster with a specified resource group and name. @@ -475,13 +508,16 @@ async def list_cluster_user_credentials( :rtype: ~azure.mgmt.containerservice.v2021_03_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_user_credentials_request( @@ -490,11 +526,13 @@ async def list_cluster_user_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -521,7 +559,7 @@ async def list_cluster_monitoring_user_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster monitoring user credential of a managed cluster. Gets cluster monitoring user credential of the managed cluster with a specified resource group @@ -536,13 +574,16 @@ async def list_cluster_monitoring_user_credentials( :rtype: ~azure.mgmt.containerservice.v2021_03_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_monitoring_user_credentials_request( @@ -551,11 +592,13 @@ async def list_cluster_monitoring_user_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -582,7 +625,7 @@ async def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedCluster": + ) -> _models.ManagedCluster: """Gets a managed cluster. Gets the details of the managed cluster with a specified resource group and name. @@ -596,13 +639,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2021_03_01.models.ManagedCluster :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] request = build_get_request( @@ -611,11 +657,13 @@ async def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -640,17 +688,20 @@ async def _create_or_update_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'ManagedCluster') @@ -662,11 +713,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -696,9 +749,9 @@ async def begin_create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> AsyncLROPoller["_models.ManagedCluster"]: + ) -> AsyncLROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. Creates or updates a managed cluster with the specified configuration for agents and Kubernetes @@ -724,37 +777,47 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_03_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -771,17 +834,20 @@ async def _update_tags_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'TagsObject') @@ -793,11 +859,13 @@ async def _update_tags_initial( content_type=content_type, json=_json, template_url=self._update_tags_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -823,9 +891,9 @@ async def begin_update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> AsyncLROPoller["_models.ManagedCluster"]: + ) -> AsyncLROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates a managed cluster with the specified tags. @@ -850,37 +918,47 @@ async def begin_update_tags( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_03_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._update_tags_initial( + raw_result = await self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -899,13 +977,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -914,11 +995,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -962,20 +1045,25 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-03-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_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) @@ -985,8 +1073,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1003,17 +1097,20 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') @@ -1025,11 +1122,13 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist content_type=content_type, json=_json, template_url=self._reset_service_principal_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1051,7 +1150,7 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> AsyncLROPoller[None]: """Reset Service Principal Profile of a managed cluster. @@ -1078,23 +1177,28 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._reset_service_principal_profile_initial( + raw_result = await self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1104,8 +1208,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1122,17 +1232,20 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') @@ -1144,11 +1257,13 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta content_type=content_type, json=_json, template_url=self._reset_aad_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1170,7 +1285,7 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> AsyncLROPoller[None]: """Reset AAD Profile of a managed cluster. @@ -1196,23 +1311,28 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._reset_aad_profile_initial( + raw_result = await self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1222,8 +1342,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1242,13 +1368,16 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_rotate_cluster_certificates_request_initial( @@ -1257,11 +1386,13 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- resource_name=resource_name, api_version=api_version, template_url=self._rotate_cluster_certificates_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1305,20 +1436,25 @@ async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-ret :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-03-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._rotate_cluster_certificates_initial( + raw_result = await self._rotate_cluster_certificates_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) @@ -1328,8 +1464,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1348,13 +1490,16 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_stop_request_initial( @@ -1363,11 +1508,13 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_name, api_version=api_version, template_url=self._stop_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1411,20 +1558,25 @@ async def begin_stop( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-03-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._stop_initial( + raw_result = await self._stop_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) @@ -1434,8 +1586,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1454,13 +1612,16 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_start_request_initial( @@ -1469,11 +1630,13 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_name, api_version=api_version, template_url=self._start_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1517,20 +1680,25 @@ async def begin_start( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-03-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._start_initial( + raw_result = await self._start_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) @@ -1540,8 +1708,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1558,17 +1732,20 @@ async def _run_command_initial( self, resource_group_name: str, resource_name: str, - request_payload: "_models.RunCommandRequest", + request_payload: _models.RunCommandRequest, **kwargs: Any - ) -> Optional["_models.RunCommandResult"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RunCommandResult"]] + ) -> Optional[_models.RunCommandResult]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] _json = self._serialize.body(request_payload, 'RunCommandRequest') @@ -1580,11 +1757,13 @@ async def _run_command_initial( content_type=content_type, json=_json, template_url=self._run_command_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1612,9 +1791,9 @@ async def begin_run_command( self, resource_group_name: str, resource_name: str, - request_payload: "_models.RunCommandRequest", + request_payload: _models.RunCommandRequest, **kwargs: Any - ) -> AsyncLROPoller["_models.RunCommandResult"]: + ) -> AsyncLROPoller[_models.RunCommandResult]: """Run Command against Managed Kubernetes Service. Submit a command to run against managed kubernetes service, it will create a pod to run the @@ -1640,37 +1819,47 @@ async def begin_run_command( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_03_01.models.RunCommandResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.RunCommandResult] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._run_command_initial( + raw_result = await self._run_command_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, request_payload=request_payload, 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): - response = pipeline_response.http_response deserialized = self._deserialize('RunCommandResult', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1690,7 +1879,7 @@ async def get_command_result( resource_name: str, command_id: str, **kwargs: Any - ) -> Optional["_models.RunCommandResult"]: + ) -> Optional[_models.RunCommandResult]: """Get command result. Get command result from previous runCommand invoke. @@ -1706,13 +1895,16 @@ async def get_command_result( :rtype: ~azure.mgmt.containerservice.v2021_03_01.models.RunCommandResult or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RunCommandResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] request = build_get_command_result_request( @@ -1722,11 +1914,13 @@ async def get_command_result( command_id=command_id, api_version=api_version, template_url=self.get_command_result.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/operations/_operations.py index fdcf76d1bba0..edeba6417e11 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/operations/_operations.py @@ -14,6 +14,7 @@ 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 @@ -23,32 +24,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class Operations: - """Operations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_03_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_03_01.aio.ContainerServiceClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.OperationListResult"]: + ) -> AsyncIterable[_models.OperationListResult]: """Gets a list of compute operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -57,31 +56,38 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_03_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/operations/_private_endpoint_connections_operations.py index 0c8078046516..8085617aed3b 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/operations/_private_endpoint_connections_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -14,6 +14,7 @@ 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 @@ -24,26 +25,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class PrivateEndpointConnectionsOperations: - """PrivateEndpointConnectionsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_03_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_03_01.aio.ContainerServiceClient`'s + :attr:`private_endpoint_connections` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -51,7 +50,7 @@ async def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnectionListResult": + ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. Gets a list of private endpoint connections in the specified managed cluster. The operation @@ -66,13 +65,16 @@ async def list( :rtype: ~azure.mgmt.containerservice.v2021_03_01.models.PrivateEndpointConnectionListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] request = build_list_request( @@ -81,11 +83,13 @@ async def list( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -113,7 +117,7 @@ async def get( resource_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Gets the private endpoint connection. Gets the details of the private endpoint connection by managed cluster and resource group. @@ -129,13 +133,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2021_03_01.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] request = build_get_request( @@ -145,11 +152,13 @@ async def get( private_endpoint_connection_name=private_endpoint_connection_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -176,9 +185,9 @@ async def update( resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - parameters: "_models.PrivateEndpointConnection", + parameters: _models.PrivateEndpointConnection, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. Updates a private endpoint connection in the specified managed cluster. @@ -196,14 +205,17 @@ async def update( :rtype: ~azure.mgmt.containerservice.v2021_03_01.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] _json = self._serialize.body(parameters, 'PrivateEndpointConnection') @@ -216,11 +228,13 @@ async def update( content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -248,13 +262,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -264,11 +281,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name=private_endpoint_connection_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -315,21 +334,26 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-03-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -339,8 +363,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/operations/_private_link_resources_operations.py index 5db395d76b1b..f06ce0395869 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/operations/_private_link_resources_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/operations/_private_link_resources_operations.py @@ -13,6 +13,7 @@ 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 @@ -22,26 +23,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class PrivateLinkResourcesOperations: - """PrivateLinkResourcesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_03_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_03_01.aio.ContainerServiceClient`'s + :attr:`private_link_resources` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -49,7 +48,7 @@ async def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.PrivateLinkResourcesListResult": + ) -> _models.PrivateLinkResourcesListResult: """Gets a list of private link resources in the specified managed cluster. Gets a list of private link resources in the specified managed cluster. The operation returns @@ -64,13 +63,16 @@ async def list( :rtype: ~azure.mgmt.containerservice.v2021_03_01.models.PrivateLinkResourcesListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourcesListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] request = build_list_request( @@ -79,11 +81,13 @@ async def list( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/operations/_resolve_private_link_service_id_operations.py index bbef615e214d..2ced089f1e5b 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/operations/_resolve_private_link_service_id_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/aio/operations/_resolve_private_link_service_id_operations.py @@ -13,6 +13,7 @@ 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 @@ -22,35 +23,33 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ResolvePrivateLinkServiceIdOperations: - """ResolvePrivateLinkServiceIdOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_03_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_03_01.aio.ContainerServiceClient`'s + :attr:`resolve_private_link_service_id` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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 post( self, resource_group_name: str, resource_name: str, - parameters: "_models.PrivateLinkResource", + parameters: _models.PrivateLinkResource, **kwargs: Any - ) -> "_models.PrivateLinkResource": + ) -> _models.PrivateLinkResource: """Gets the private link service ID for the specified managed cluster. Gets the private link service ID the specified managed cluster. @@ -67,14 +66,17 @@ async def post( :rtype: ~azure.mgmt.containerservice.v2021_03_01.models.PrivateLinkResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] _json = self._serialize.body(parameters, 'PrivateLinkResource') @@ -86,11 +88,13 @@ async def post( content_type=content_type, json=_json, template_url=self.post.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/models/__init__.py index a7cefae87175..3d22d386cb28 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/models/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/models/__init__.py @@ -115,7 +115,9 @@ UpgradeChannel, WeekDay, ) - +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'AgentPool', 'AgentPoolAvailableVersions', @@ -223,3 +225,5 @@ 'UpgradeChannel', 'WeekDay', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/models/_container_service_client_enums.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/models/_container_service_client_enums.py index 30ac21518ac2..fa53aa10e316 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/models/_container_service_client_enums.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/models/_container_service_client_enums.py @@ -7,32 +7,31 @@ # -------------------------------------------------------------------------- from enum import Enum -from six import with_metaclass from azure.core import CaseInsensitiveEnumMeta -class AgentPoolMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class AgentPoolMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """AgentPoolMode represents mode of an agent pool. """ SYSTEM = "System" USER = "User" -class AgentPoolType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class AgentPoolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """AgentPoolType represents types of an agent pool. """ VIRTUAL_MACHINE_SCALE_SETS = "VirtualMachineScaleSets" AVAILABILITY_SET = "AvailabilitySet" -class Code(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class Code(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Tells whether the cluster is Running or Stopped """ RUNNING = "Running" STOPPED = "Stopped" -class ConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The private link service connection status. """ @@ -41,7 +40,7 @@ class ConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): REJECTED = "Rejected" DISCONNECTED = "Disconnected" -class ContainerServiceStorageProfileTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the orchestrator choice. """ @@ -49,7 +48,7 @@ class ContainerServiceStorageProfileTypes(with_metaclass(CaseInsensitiveEnumMeta STORAGE_ACCOUNT = "StorageAccount" MANAGED_DISKS = "ManagedDisks" -class ContainerServiceVMSizeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Size of agent VMs. """ @@ -228,7 +227,7 @@ class ContainerServiceVMSizeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, E STANDARD_NV24 = "Standard_NV24" STANDARD_NV6 = "Standard_NV6" -class Count(with_metaclass(CaseInsensitiveEnumMeta, int, Enum)): +class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): """Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, and 5. The default value is 1. """ @@ -237,7 +236,7 @@ class Count(with_metaclass(CaseInsensitiveEnumMeta, int, Enum)): THREE = 3 FIVE = 5 -class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of identity that created the resource. """ @@ -246,20 +245,20 @@ class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class Expander(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class Expander(str, Enum, metaclass=CaseInsensitiveEnumMeta): LEAST_WASTE = "least-waste" MOST_PODS = "most-pods" PRIORITY = "priority" RANDOM = "random" -class ExtendedLocationTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ExtendedLocationTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of extendedLocation. """ EDGE_ZONE = "EdgeZone" -class GPUInstanceProfile(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class GPUInstanceProfile(str, Enum, metaclass=CaseInsensitiveEnumMeta): """GPUInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU. Supported values are MIG1g, MIG2g, MIG3g, MIG4g and MIG7g. """ @@ -270,7 +269,7 @@ class GPUInstanceProfile(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MIG4_G = "MIG4g" MIG7_G = "MIG7g" -class KubeletDiskType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class KubeletDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """KubeletDiskType determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. Allowed values: 'OS', 'Temporary' (preview). """ @@ -278,7 +277,7 @@ class KubeletDiskType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): OS = "OS" TEMPORARY = "Temporary" -class LicenseType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class LicenseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The licenseType to use for Windows VMs. Windows_Server is used to enable Azure Hybrid User Benefits for Windows VMs. """ @@ -286,14 +285,14 @@ class LicenseType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): NONE = "None" WINDOWS_SERVER = "Windows_Server" -class LoadBalancerSku(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class LoadBalancerSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The load balancer sku for the managed cluster. """ STANDARD = "standard" BASIC = "basic" -class ManagedClusterPodIdentityProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ManagedClusterPodIdentityProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The current provisioning state of the pod identity. """ @@ -302,48 +301,48 @@ class ManagedClusterPodIdentityProvisioningState(with_metaclass(CaseInsensitiveE DELETING = "Deleting" FAILED = "Failed" -class ManagedClusterSKUName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ManagedClusterSKUName(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Name of a managed cluster SKU. """ BASIC = "Basic" -class ManagedClusterSKUTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ManagedClusterSKUTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Tier of a managed cluster SKU. """ PAID = "Paid" FREE = "Free" -class NetworkMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Network mode used for building Kubernetes network. """ TRANSPARENT = "transparent" BRIDGE = "bridge" -class NetworkPlugin(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkPlugin(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Network plugin used for building Kubernetes network. """ AZURE = "azure" KUBENET = "kubenet" -class NetworkPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Network policy used for building Kubernetes network. """ CALICO = "calico" AZURE = "azure" -class OSDiskType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OSDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """OSDiskType represents the type of an OS disk on an agent pool. """ MANAGED = "Managed" EPHEMERAL = "Ephemeral" -class OSSKU(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OSSKU(str, Enum, metaclass=CaseInsensitiveEnumMeta): """OsSKU to be used to specify os sku. Choose from Ubuntu(default) and CBLMariner for Linux OSType. Not applicable to Windows OSType. """ @@ -351,21 +350,21 @@ class OSSKU(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): UBUNTU = "Ubuntu" CBL_MARINER = "CBLMariner" -class OSType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux. """ LINUX = "Linux" WINDOWS = "Windows" -class OutboundType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OutboundType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The outbound (egress) routing method. """ LOAD_BALANCER = "loadBalancer" USER_DEFINED_ROUTING = "userDefinedRouting" -class PrivateEndpointConnectionProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class PrivateEndpointConnectionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The current provisioning state. """ @@ -374,7 +373,7 @@ class PrivateEndpointConnectionProvisioningState(with_metaclass(CaseInsensitiveE DELETING = "Deleting" FAILED = "Failed" -class ResourceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ resource group in agent nodes. Type 'None' will not use MSI for the managed cluster, service @@ -385,7 +384,7 @@ class ResourceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): USER_ASSIGNED = "UserAssigned" NONE = "None" -class ScaleSetEvictionPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ScaleSetEvictionPolicy to be used to specify eviction policy for Spot virtual machine scale set. Default to Delete. """ @@ -393,14 +392,14 @@ class ScaleSetEvictionPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)) DELETE = "Delete" DEALLOCATE = "Deallocate" -class ScaleSetPriority(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ScaleSetPriority(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ScaleSetPriority to be used to specify virtual machine scale set priority. Default to regular. """ SPOT = "Spot" REGULAR = "Regular" -class UpgradeChannel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class UpgradeChannel(str, Enum, metaclass=CaseInsensitiveEnumMeta): """upgrade channel for auto upgrade. """ @@ -410,7 +409,7 @@ class UpgradeChannel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): NODE_IMAGE = "node-image" NONE = "none" -class WeekDay(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class WeekDay(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The weekday enum. """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/models/_models_py3.py index 6bf54ff84d5f..4b2820cd2ad7 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/models/_models_py3.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/models/_models_py3.py @@ -7,11 +7,13 @@ # -------------------------------------------------------------------------- import datetime -from typing import Dict, List, Optional, Union +from typing import Dict, List, Optional, TYPE_CHECKING, Union import msrest.serialization -from ._container_service_client_enums import * +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + import __init__ as _models class SubResource(msrest.serialization.Model): @@ -77,12 +79,11 @@ class AgentPool(SubResource): :ivar os_disk_type: OS disk type to be used for machines in a given agent pool. Allowed values are 'Ephemeral' and 'Managed'. If unspecified, defaults to 'Ephemeral' when the VM supports ephemeral OS and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults - to 'Managed'. May not be changed after creation. Possible values include: "Managed", - "Ephemeral". + to 'Managed'. May not be changed after creation. Known values are: "Managed", "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2021_03_01.models.OSDiskType :ivar kubelet_disk_type: KubeletDiskType determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. Currently allows one value, OS, - resulting in Kubelet using the OS disk for data. Possible values include: "OS", "Temporary". + resulting in Kubelet using the OS disk for data. Known values are: "OS", "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_03_01.models.KubeletDiskType :ivar vnet_subnet_id: VNet SubnetID specifies the VNet's subnet identifier for nodes and maybe @@ -93,11 +94,10 @@ class AgentPool(SubResource): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2021_03_01.models.OSType :ivar os_sku: OsSKU to be used to specify os sku. Choose from Ubuntu(default) and CBLMariner - for Linux OSType. Not applicable to Windows OSType. Possible values include: "Ubuntu", - "CBLMariner". + for Linux OSType. Not applicable to Windows OSType. Known values are: "Ubuntu", "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2021_03_01.models.OSSKU :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -105,12 +105,11 @@ class AgentPool(SubResource): :vartype min_count: int :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool - :ivar type_properties_type: AgentPoolType represents types of an agent pool. Possible values - include: "VirtualMachineScaleSets", "AvailabilitySet". + :ivar type_properties_type: AgentPoolType represents types of an agent pool. Known values are: + "VirtualMachineScaleSets", "AvailabilitySet". :vartype type_properties_type: str or ~azure.mgmt.containerservice.v2021_03_01.models.AgentPoolType - :ivar mode: AgentPoolMode represents mode of an agent pool. Possible values include: "System", - "User". + :ivar mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", "User". :vartype mode: str or ~azure.mgmt.containerservice.v2021_03_01.models.AgentPoolMode :ivar orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -134,12 +133,11 @@ class AgentPool(SubResource): IP Prefix. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Possible values include: "Spot", "Regular". Default value: - "Regular". + priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_03_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy - for Spot virtual machine scale set. Default to Delete. Possible values include: "Delete", + for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", "Deallocate". Default value: "Delete". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_03_01.models.ScaleSetEvictionPolicy @@ -166,8 +164,8 @@ class AgentPool(SubResource): :ivar enable_fips: Whether to use FIPS enabled OS. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Supported values are MIG1g, MIG2g, MIG3g, MIG4g and MIG7g. Possible - values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Supported values are MIG1g, MIG2g, MIG3g, MIG4g and MIG7g. Known + values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2021_03_01.models.GPUInstanceProfile """ @@ -229,35 +227,35 @@ def __init__( count: Optional[int] = None, vm_size: Optional[str] = None, os_disk_size_gb: Optional[int] = None, - os_disk_type: Optional[Union[str, "OSDiskType"]] = None, - kubelet_disk_type: Optional[Union[str, "KubeletDiskType"]] = None, + os_disk_type: Optional[Union[str, "_models.OSDiskType"]] = None, + kubelet_disk_type: Optional[Union[str, "_models.KubeletDiskType"]] = None, vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", - os_sku: Optional[Union[str, "OSSKU"]] = None, + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - type_properties_type: Optional[Union[str, "AgentPoolType"]] = None, - mode: Optional[Union[str, "AgentPoolMode"]] = None, + type_properties_type: Optional[Union[str, "_models.AgentPoolType"]] = None, + mode: Optional[Union[str, "_models.AgentPoolMode"]] = None, orchestrator_version: Optional[str] = None, - upgrade_settings: Optional["AgentPoolUpgradeSettings"] = None, + upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", spot_max_price: Optional[float] = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, proximity_placement_group_id: Optional[str] = None, - kubelet_config: Optional["KubeletConfig"] = None, - linux_os_config: Optional["LinuxOSConfig"] = None, + kubelet_config: Optional["_models.KubeletConfig"] = None, + linux_os_config: Optional["_models.LinuxOSConfig"] = None, enable_encryption_at_host: Optional[bool] = None, enable_fips: Optional[bool] = None, - gpu_instance_profile: Optional[Union[str, "GPUInstanceProfile"]] = None, + gpu_instance_profile: Optional[Union[str, "_models.GPUInstanceProfile"]] = None, **kwargs ): """ @@ -274,12 +272,12 @@ def __init__( :keyword os_disk_type: OS disk type to be used for machines in a given agent pool. Allowed values are 'Ephemeral' and 'Managed'. If unspecified, defaults to 'Ephemeral' when the VM supports ephemeral OS and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, - defaults to 'Managed'. May not be changed after creation. Possible values include: "Managed", + defaults to 'Managed'. May not be changed after creation. Known values are: "Managed", "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2021_03_01.models.OSDiskType :keyword kubelet_disk_type: KubeletDiskType determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. Currently allows one value, OS, - resulting in Kubelet using the OS disk for data. Possible values include: "OS", "Temporary". + resulting in Kubelet using the OS disk for data. Known values are: "OS", "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_03_01.models.KubeletDiskType :keyword vnet_subnet_id: VNet SubnetID specifies the VNet's subnet identifier for nodes and @@ -290,11 +288,10 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2021_03_01.models.OSType :keyword os_sku: OsSKU to be used to specify os sku. Choose from Ubuntu(default) and CBLMariner - for Linux OSType. Not applicable to Windows OSType. Possible values include: "Ubuntu", - "CBLMariner". + for Linux OSType. Not applicable to Windows OSType. Known values are: "Ubuntu", "CBLMariner". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2021_03_01.models.OSSKU :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -302,12 +299,12 @@ def __init__( :paramtype min_count: int :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool - :keyword type_properties_type: AgentPoolType represents types of an agent pool. Possible values - include: "VirtualMachineScaleSets", "AvailabilitySet". + :keyword type_properties_type: AgentPoolType represents types of an agent pool. Known values + are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type_properties_type: str or ~azure.mgmt.containerservice.v2021_03_01.models.AgentPoolType - :keyword mode: AgentPoolMode represents mode of an agent pool. Possible values include: - "System", "User". + :keyword mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", + "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2021_03_01.models.AgentPoolMode :keyword orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -324,13 +321,12 @@ def __init__( Public IP Prefix. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Possible values include: "Spot", "Regular". Default value: - "Regular". + priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_03_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction - policy for Spot virtual machine scale set. Default to Delete. Possible values include: - "Delete", "Deallocate". Default value: "Delete". + policy for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", + "Deallocate". Default value: "Delete". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_03_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: SpotMaxPrice to be used to specify the maximum price you are willing @@ -357,7 +353,7 @@ def __init__( :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU. Supported values are MIG1g, MIG2g, MIG3g, MIG4g and MIG7g. - Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2021_03_01.models.GPUInstanceProfile """ @@ -431,7 +427,7 @@ class AgentPoolAvailableVersions(msrest.serialization.Model): def __init__( self, *, - agent_pool_versions: Optional[List["AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem"]] = None, + agent_pool_versions: Optional[List["_models.AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem"]] = None, **kwargs ): """ @@ -508,7 +504,7 @@ class AgentPoolListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["AgentPool"]] = None, + value: Optional[List["_models.AgentPool"]] = None, **kwargs ): """ @@ -536,7 +532,7 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): :ivar kubernetes_version: Required. Kubernetes version (major, minor, patch). :vartype kubernetes_version: str :ivar os_type: Required. OsType to be used to specify os type. Choose from Linux and Windows. - Default to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2021_03_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -568,8 +564,8 @@ def __init__( self, *, kubernetes_version: str, - os_type: Union[str, "OSType"] = "Linux", - upgrades: Optional[List["AgentPoolUpgradeProfilePropertiesUpgradesItem"]] = None, + os_type: Union[str, "_models.OSType"] = "Linux", + upgrades: Optional[List["_models.AgentPoolUpgradeProfilePropertiesUpgradesItem"]] = None, latest_node_image_version: Optional[str] = None, **kwargs ): @@ -577,7 +573,7 @@ def __init__( :keyword kubernetes_version: Required. Kubernetes version (major, minor, patch). :paramtype kubernetes_version: str :keyword os_type: Required. OsType to be used to specify os type. Choose from Linux and - Windows. Default to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Windows. Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2021_03_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: @@ -669,7 +665,7 @@ class CloudError(msrest.serialization.Model): def __init__( self, *, - error: Optional["CloudErrorBody"] = None, + error: Optional["_models.CloudErrorBody"] = None, **kwargs ): """ @@ -709,7 +705,7 @@ def __init__( code: Optional[str] = None, message: Optional[str] = None, target: Optional[str] = None, - details: Optional[List["CloudErrorBody"]] = None, + details: Optional[List["_models.CloudErrorBody"]] = None, **kwargs ): """ @@ -861,29 +857,29 @@ class Components1Q1Og48SchemasManagedclusterAllof1(msrest.serialization.Model): def __init__( self, *, - identity: Optional["ManagedClusterIdentity"] = None, + identity: Optional["_models.ManagedClusterIdentity"] = None, kubernetes_version: Optional[str] = None, dns_prefix: Optional[str] = None, fqdn_subdomain: Optional[str] = None, - agent_pool_profiles: Optional[List["ManagedClusterAgentPoolProfile"]] = None, - linux_profile: Optional["ContainerServiceLinuxProfile"] = None, - windows_profile: Optional["ManagedClusterWindowsProfile"] = None, - service_principal_profile: Optional["ManagedClusterServicePrincipalProfile"] = None, - addon_profiles: Optional[Dict[str, "ManagedClusterAddonProfile"]] = None, - pod_identity_profile: Optional["ManagedClusterPodIdentityProfile"] = None, + agent_pool_profiles: Optional[List["_models.ManagedClusterAgentPoolProfile"]] = None, + linux_profile: Optional["_models.ContainerServiceLinuxProfile"] = None, + windows_profile: Optional["_models.ManagedClusterWindowsProfile"] = None, + service_principal_profile: Optional["_models.ManagedClusterServicePrincipalProfile"] = None, + addon_profiles: Optional[Dict[str, "_models.ManagedClusterAddonProfile"]] = None, + pod_identity_profile: Optional["_models.ManagedClusterPodIdentityProfile"] = None, node_resource_group: Optional[str] = None, enable_rbac: Optional[bool] = None, enable_pod_security_policy: Optional[bool] = None, - network_profile: Optional["ContainerServiceNetworkProfile"] = None, - aad_profile: Optional["ManagedClusterAADProfile"] = None, - auto_upgrade_profile: Optional["ManagedClusterAutoUpgradeProfile"] = None, - auto_scaler_profile: Optional["ManagedClusterPropertiesAutoScalerProfile"] = None, - api_server_access_profile: Optional["ManagedClusterAPIServerAccessProfile"] = None, + network_profile: Optional["_models.ContainerServiceNetworkProfile"] = None, + aad_profile: Optional["_models.ManagedClusterAADProfile"] = None, + auto_upgrade_profile: Optional["_models.ManagedClusterAutoUpgradeProfile"] = None, + auto_scaler_profile: Optional["_models.ManagedClusterPropertiesAutoScalerProfile"] = None, + api_server_access_profile: Optional["_models.ManagedClusterAPIServerAccessProfile"] = None, disk_encryption_set_id: Optional[str] = None, - identity_profile: Optional[Dict[str, "ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties"]] = None, - private_link_resources: Optional[List["PrivateLinkResource"]] = None, + identity_profile: Optional[Dict[str, "_models.ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties"]] = None, + private_link_resources: Optional[List["_models.PrivateLinkResource"]] = None, disable_local_accounts: Optional[bool] = None, - http_proxy_config: Optional["ManagedClusterHTTPProxyConfig"] = None, + http_proxy_config: Optional["_models.ManagedClusterHTTPProxyConfig"] = None, **kwargs ): """ @@ -1115,7 +1111,7 @@ class ContainerServiceDiagnosticsProfile(msrest.serialization.Model): def __init__( self, *, - vm_diagnostics: "ContainerServiceVMDiagnostics", + vm_diagnostics: "_models.ContainerServiceVMDiagnostics", **kwargs ): """ @@ -1152,7 +1148,7 @@ def __init__( self, *, admin_username: str, - ssh: "ContainerServiceSshConfiguration", + ssh: "_models.ContainerServiceSshConfiguration", **kwargs ): """ @@ -1175,17 +1171,17 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar count: Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, - and 5. The default value is 1. Possible values include: 1, 3, 5. Default value: "1". + and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". :vartype count: int or ~azure.mgmt.containerservice.v2021_03_01.models.Count :ivar dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. :vartype dns_prefix: str - :ivar vm_size: Required. Size of agent VMs. Possible values include: "Standard_A1", - "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", - "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", - "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", - "Standard_A8m_v2", "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", - "Standard_B8ms", "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", - "Standard_D12", "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", + :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", + "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", + "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", + "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", "Standard_B8ms", + "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", "Standard_D12", + "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", "Standard_D13_v2_Promo", "Standard_D14", "Standard_D14_v2", "Standard_D14_v2_Promo", "Standard_D15_v2", "Standard_D16_v3", "Standard_D16s_v3", "Standard_D1_v2", "Standard_D2", "Standard_D2_v2", "Standard_D2_v2_Promo", "Standard_D2_v3", "Standard_D2s_v3", "Standard_D3", @@ -1230,7 +1226,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): :vartype first_consecutive_static_ip: str :ivar storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Possible values include: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". :vartype storage_profile: str or ~azure.mgmt.containerservice.v2021_03_01.models.ContainerServiceStorageProfileTypes :ivar fqdn: FQDN for the master pool. @@ -1259,27 +1255,27 @@ def __init__( self, *, dns_prefix: str, - vm_size: Union[str, "ContainerServiceVMSizeTypes"], - count: Optional[Union[int, "Count"]] = 1, + vm_size: Union[str, "_models.ContainerServiceVMSizeTypes"], + count: Optional[Union[int, "_models.Count"]] = 1, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, first_consecutive_static_ip: Optional[str] = "10.240.255.5", - storage_profile: Optional[Union[str, "ContainerServiceStorageProfileTypes"]] = None, + storage_profile: Optional[Union[str, "_models.ContainerServiceStorageProfileTypes"]] = None, **kwargs ): """ :keyword count: Number of masters (VMs) in the container service cluster. Allowed values are 1, - 3, and 5. The default value is 1. Possible values include: 1, 3, 5. Default value: "1". + 3, and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". :paramtype count: int or ~azure.mgmt.containerservice.v2021_03_01.models.Count :keyword dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. :paramtype dns_prefix: str - :keyword vm_size: Required. Size of agent VMs. Possible values include: "Standard_A1", - "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", - "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", - "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", - "Standard_A8m_v2", "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", - "Standard_B8ms", "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", - "Standard_D12", "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", + :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", + "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", + "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", + "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", "Standard_B8ms", + "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", "Standard_D12", + "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", "Standard_D13_v2_Promo", "Standard_D14", "Standard_D14_v2", "Standard_D14_v2_Promo", "Standard_D15_v2", "Standard_D16_v3", "Standard_D16s_v3", "Standard_D1_v2", "Standard_D2", "Standard_D2_v2", "Standard_D2_v2_Promo", "Standard_D2_v3", "Standard_D2s_v3", "Standard_D3", @@ -1324,7 +1320,7 @@ def __init__( :paramtype first_consecutive_static_ip: str :keyword storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Possible values include: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". :paramtype storage_profile: str or ~azure.mgmt.containerservice.v2021_03_01.models.ContainerServiceStorageProfileTypes """ @@ -1342,13 +1338,13 @@ def __init__( class ContainerServiceNetworkProfile(msrest.serialization.Model): """Profile of network configuration. - :ivar network_plugin: Network plugin used for building Kubernetes network. Possible values - include: "azure", "kubenet". Default value: "kubenet". + :ivar network_plugin: Network plugin used for building Kubernetes network. Known values are: + "azure", "kubenet". Default value: "kubenet". :vartype network_plugin: str or ~azure.mgmt.containerservice.v2021_03_01.models.NetworkPlugin - :ivar network_policy: Network policy used for building Kubernetes network. Possible values - include: "calico", "azure". + :ivar network_policy: Network policy used for building Kubernetes network. Known values are: + "calico", "azure". :vartype network_policy: str or ~azure.mgmt.containerservice.v2021_03_01.models.NetworkPolicy - :ivar network_mode: Network mode used for building Kubernetes network. Possible values include: + :ivar network_mode: Network mode used for building Kubernetes network. Known values are: "transparent", "bridge". :vartype network_mode: str or ~azure.mgmt.containerservice.v2021_03_01.models.NetworkMode :ivar pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. @@ -1362,11 +1358,11 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): :ivar docker_bridge_cidr: A CIDR notation IP range assigned to the Docker bridge network. It must not overlap with any Subnet IP ranges or the Kubernetes service address range. :vartype docker_bridge_cidr: str - :ivar outbound_type: The outbound (egress) routing method. Possible values include: - "loadBalancer", "userDefinedRouting". Default value: "loadBalancer". + :ivar outbound_type: The outbound (egress) routing method. Known values are: "loadBalancer", + "userDefinedRouting". Default value: "loadBalancer". :vartype outbound_type: str or ~azure.mgmt.containerservice.v2021_03_01.models.OutboundType - :ivar load_balancer_sku: The load balancer sku for the managed cluster. Possible values - include: "standard", "basic". + :ivar load_balancer_sku: The load balancer sku for the managed cluster. Known values are: + "standard", "basic". :vartype load_balancer_sku: str or ~azure.mgmt.containerservice.v2021_03_01.models.LoadBalancerSku :ivar load_balancer_profile: Profile of the cluster load balancer. @@ -1397,27 +1393,27 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): def __init__( self, *, - network_plugin: Optional[Union[str, "NetworkPlugin"]] = "kubenet", - network_policy: Optional[Union[str, "NetworkPolicy"]] = None, - network_mode: Optional[Union[str, "NetworkMode"]] = None, + network_plugin: Optional[Union[str, "_models.NetworkPlugin"]] = "kubenet", + network_policy: Optional[Union[str, "_models.NetworkPolicy"]] = None, + network_mode: Optional[Union[str, "_models.NetworkMode"]] = None, pod_cidr: Optional[str] = "10.244.0.0/16", service_cidr: Optional[str] = "10.0.0.0/16", dns_service_ip: Optional[str] = "10.0.0.10", docker_bridge_cidr: Optional[str] = "172.17.0.1/16", - outbound_type: Optional[Union[str, "OutboundType"]] = "loadBalancer", - load_balancer_sku: Optional[Union[str, "LoadBalancerSku"]] = None, - load_balancer_profile: Optional["ManagedClusterLoadBalancerProfile"] = None, + outbound_type: Optional[Union[str, "_models.OutboundType"]] = "loadBalancer", + load_balancer_sku: Optional[Union[str, "_models.LoadBalancerSku"]] = None, + load_balancer_profile: Optional["_models.ManagedClusterLoadBalancerProfile"] = None, **kwargs ): """ - :keyword network_plugin: Network plugin used for building Kubernetes network. Possible values - include: "azure", "kubenet". Default value: "kubenet". + :keyword network_plugin: Network plugin used for building Kubernetes network. Known values are: + "azure", "kubenet". Default value: "kubenet". :paramtype network_plugin: str or ~azure.mgmt.containerservice.v2021_03_01.models.NetworkPlugin - :keyword network_policy: Network policy used for building Kubernetes network. Possible values - include: "calico", "azure". + :keyword network_policy: Network policy used for building Kubernetes network. Known values are: + "calico", "azure". :paramtype network_policy: str or ~azure.mgmt.containerservice.v2021_03_01.models.NetworkPolicy - :keyword network_mode: Network mode used for building Kubernetes network. Possible values - include: "transparent", "bridge". + :keyword network_mode: Network mode used for building Kubernetes network. Known values are: + "transparent", "bridge". :paramtype network_mode: str or ~azure.mgmt.containerservice.v2021_03_01.models.NetworkMode :keyword pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :paramtype pod_cidr: str @@ -1430,11 +1426,11 @@ def __init__( :keyword docker_bridge_cidr: A CIDR notation IP range assigned to the Docker bridge network. It must not overlap with any Subnet IP ranges or the Kubernetes service address range. :paramtype docker_bridge_cidr: str - :keyword outbound_type: The outbound (egress) routing method. Possible values include: - "loadBalancer", "userDefinedRouting". Default value: "loadBalancer". + :keyword outbound_type: The outbound (egress) routing method. Known values are: "loadBalancer", + "userDefinedRouting". Default value: "loadBalancer". :paramtype outbound_type: str or ~azure.mgmt.containerservice.v2021_03_01.models.OutboundType - :keyword load_balancer_sku: The load balancer sku for the managed cluster. Possible values - include: "standard", "basic". + :keyword load_balancer_sku: The load balancer sku for the managed cluster. Known values are: + "standard", "basic". :paramtype load_balancer_sku: str or ~azure.mgmt.containerservice.v2021_03_01.models.LoadBalancerSku :keyword load_balancer_profile: Profile of the cluster load balancer. @@ -1476,7 +1472,7 @@ class ContainerServiceSshConfiguration(msrest.serialization.Model): def __init__( self, *, - public_keys: List["ContainerServiceSshPublicKey"], + public_keys: List["_models.ContainerServiceSshPublicKey"], **kwargs ): """ @@ -1624,7 +1620,7 @@ class ExtendedLocation(msrest.serialization.Model): :ivar name: The name of the extended location. :vartype name: str - :ivar type: The type of the extended location. Possible values include: "EdgeZone". + :ivar type: The type of the extended location. Known values are: "EdgeZone". :vartype type: str or ~azure.mgmt.containerservice.v2021_03_01.models.ExtendedLocationTypes """ @@ -1637,13 +1633,13 @@ def __init__( self, *, name: Optional[str] = None, - type: Optional[Union[str, "ExtendedLocationTypes"]] = None, + type: Optional[Union[str, "_models.ExtendedLocationTypes"]] = None, **kwargs ): """ :keyword name: The name of the extended location. :paramtype name: str - :keyword type: The type of the extended location. Possible values include: "EdgeZone". + :keyword type: The type of the extended location. Known values are: "EdgeZone". :paramtype type: str or ~azure.mgmt.containerservice.v2021_03_01.models.ExtendedLocationTypes """ super(ExtendedLocation, self).__init__(**kwargs) @@ -1787,7 +1783,7 @@ class LinuxOSConfig(msrest.serialization.Model): def __init__( self, *, - sysctls: Optional["SysctlConfig"] = None, + sysctls: Optional["_models.SysctlConfig"] = None, transparent_huge_page_enabled: Optional[str] = None, transparent_huge_page_defrag: Optional[str] = None, swap_file_size_mb: Optional[int] = None, @@ -1850,8 +1846,8 @@ class MaintenanceConfiguration(SubResource): def __init__( self, *, - time_in_week: Optional[List["TimeInWeek"]] = None, - not_allowed_time: Optional[List["TimeSpan"]] = None, + time_in_week: Optional[List["_models.TimeInWeek"]] = None, + not_allowed_time: Optional[List["_models.TimeSpan"]] = None, **kwargs ): """ @@ -1889,7 +1885,7 @@ class MaintenanceConfigurationListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["MaintenanceConfiguration"]] = None, + value: Optional[List["_models.MaintenanceConfiguration"]] = None, **kwargs ): """ @@ -2114,32 +2110,32 @@ def __init__( self, *, location: str, - identity: Optional["ManagedClusterIdentity"] = None, + identity: Optional["_models.ManagedClusterIdentity"] = None, kubernetes_version: Optional[str] = None, dns_prefix: Optional[str] = None, fqdn_subdomain: Optional[str] = None, - agent_pool_profiles: Optional[List["ManagedClusterAgentPoolProfile"]] = None, - linux_profile: Optional["ContainerServiceLinuxProfile"] = None, - windows_profile: Optional["ManagedClusterWindowsProfile"] = None, - service_principal_profile: Optional["ManagedClusterServicePrincipalProfile"] = None, - addon_profiles: Optional[Dict[str, "ManagedClusterAddonProfile"]] = None, - pod_identity_profile: Optional["ManagedClusterPodIdentityProfile"] = None, + agent_pool_profiles: Optional[List["_models.ManagedClusterAgentPoolProfile"]] = None, + linux_profile: Optional["_models.ContainerServiceLinuxProfile"] = None, + windows_profile: Optional["_models.ManagedClusterWindowsProfile"] = None, + service_principal_profile: Optional["_models.ManagedClusterServicePrincipalProfile"] = None, + addon_profiles: Optional[Dict[str, "_models.ManagedClusterAddonProfile"]] = None, + pod_identity_profile: Optional["_models.ManagedClusterPodIdentityProfile"] = None, node_resource_group: Optional[str] = None, enable_rbac: Optional[bool] = None, enable_pod_security_policy: Optional[bool] = None, - network_profile: Optional["ContainerServiceNetworkProfile"] = None, - aad_profile: Optional["ManagedClusterAADProfile"] = None, - auto_upgrade_profile: Optional["ManagedClusterAutoUpgradeProfile"] = None, - auto_scaler_profile: Optional["ManagedClusterPropertiesAutoScalerProfile"] = None, - api_server_access_profile: Optional["ManagedClusterAPIServerAccessProfile"] = None, + network_profile: Optional["_models.ContainerServiceNetworkProfile"] = None, + aad_profile: Optional["_models.ManagedClusterAADProfile"] = None, + auto_upgrade_profile: Optional["_models.ManagedClusterAutoUpgradeProfile"] = None, + auto_scaler_profile: Optional["_models.ManagedClusterPropertiesAutoScalerProfile"] = None, + api_server_access_profile: Optional["_models.ManagedClusterAPIServerAccessProfile"] = None, disk_encryption_set_id: Optional[str] = None, - identity_profile: Optional[Dict[str, "ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties"]] = None, - private_link_resources: Optional[List["PrivateLinkResource"]] = None, + identity_profile: Optional[Dict[str, "_models.ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties"]] = None, + private_link_resources: Optional[List["_models.PrivateLinkResource"]] = None, disable_local_accounts: Optional[bool] = None, - http_proxy_config: Optional["ManagedClusterHTTPProxyConfig"] = None, + http_proxy_config: Optional["_models.ManagedClusterHTTPProxyConfig"] = None, tags: Optional[Dict[str, str]] = None, - sku: Optional["ManagedClusterSKU"] = None, - extended_location: Optional["ExtendedLocation"] = None, + sku: Optional["_models.ManagedClusterSKU"] = None, + extended_location: Optional["_models.ExtendedLocation"] = None, **kwargs ): """ @@ -2485,12 +2481,11 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar os_disk_type: OS disk type to be used for machines in a given agent pool. Allowed values are 'Ephemeral' and 'Managed'. If unspecified, defaults to 'Ephemeral' when the VM supports ephemeral OS and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults - to 'Managed'. May not be changed after creation. Possible values include: "Managed", - "Ephemeral". + to 'Managed'. May not be changed after creation. Known values are: "Managed", "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2021_03_01.models.OSDiskType :ivar kubelet_disk_type: KubeletDiskType determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. Currently allows one value, OS, - resulting in Kubelet using the OS disk for data. Possible values include: "OS", "Temporary". + resulting in Kubelet using the OS disk for data. Known values are: "OS", "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_03_01.models.KubeletDiskType :ivar vnet_subnet_id: VNet SubnetID specifies the VNet's subnet identifier for nodes and maybe @@ -2501,11 +2496,10 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2021_03_01.models.OSType :ivar os_sku: OsSKU to be used to specify os sku. Choose from Ubuntu(default) and CBLMariner - for Linux OSType. Not applicable to Windows OSType. Possible values include: "Ubuntu", - "CBLMariner". + for Linux OSType. Not applicable to Windows OSType. Known values are: "Ubuntu", "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2021_03_01.models.OSSKU :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -2513,11 +2507,10 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :vartype min_count: int :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool - :ivar type: AgentPoolType represents types of an agent pool. Possible values include: + :ivar type: AgentPoolType represents types of an agent pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2021_03_01.models.AgentPoolType - :ivar mode: AgentPoolMode represents mode of an agent pool. Possible values include: "System", - "User". + :ivar mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", "User". :vartype mode: str or ~azure.mgmt.containerservice.v2021_03_01.models.AgentPoolMode :ivar orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -2541,12 +2534,11 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): IP Prefix. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Possible values include: "Spot", "Regular". Default value: - "Regular". + priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_03_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy - for Spot virtual machine scale set. Default to Delete. Possible values include: "Delete", + for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", "Deallocate". Default value: "Delete". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_03_01.models.ScaleSetEvictionPolicy @@ -2573,8 +2565,8 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar enable_fips: Whether to use FIPS enabled OS. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Supported values are MIG1g, MIG2g, MIG3g, MIG4g and MIG7g. Possible - values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Supported values are MIG1g, MIG2g, MIG3g, MIG4g and MIG7g. Known + values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2021_03_01.models.GPUInstanceProfile """ @@ -2630,35 +2622,35 @@ def __init__( count: Optional[int] = None, vm_size: Optional[str] = None, os_disk_size_gb: Optional[int] = None, - os_disk_type: Optional[Union[str, "OSDiskType"]] = None, - kubelet_disk_type: Optional[Union[str, "KubeletDiskType"]] = None, + os_disk_type: Optional[Union[str, "_models.OSDiskType"]] = None, + kubelet_disk_type: Optional[Union[str, "_models.KubeletDiskType"]] = None, vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", - os_sku: Optional[Union[str, "OSSKU"]] = None, + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - type: Optional[Union[str, "AgentPoolType"]] = None, - mode: Optional[Union[str, "AgentPoolMode"]] = None, + type: Optional[Union[str, "_models.AgentPoolType"]] = None, + mode: Optional[Union[str, "_models.AgentPoolMode"]] = None, orchestrator_version: Optional[str] = None, - upgrade_settings: Optional["AgentPoolUpgradeSettings"] = None, + upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", spot_max_price: Optional[float] = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, proximity_placement_group_id: Optional[str] = None, - kubelet_config: Optional["KubeletConfig"] = None, - linux_os_config: Optional["LinuxOSConfig"] = None, + kubelet_config: Optional["_models.KubeletConfig"] = None, + linux_os_config: Optional["_models.LinuxOSConfig"] = None, enable_encryption_at_host: Optional[bool] = None, enable_fips: Optional[bool] = None, - gpu_instance_profile: Optional[Union[str, "GPUInstanceProfile"]] = None, + gpu_instance_profile: Optional[Union[str, "_models.GPUInstanceProfile"]] = None, **kwargs ): """ @@ -2675,12 +2667,12 @@ def __init__( :keyword os_disk_type: OS disk type to be used for machines in a given agent pool. Allowed values are 'Ephemeral' and 'Managed'. If unspecified, defaults to 'Ephemeral' when the VM supports ephemeral OS and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, - defaults to 'Managed'. May not be changed after creation. Possible values include: "Managed", + defaults to 'Managed'. May not be changed after creation. Known values are: "Managed", "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2021_03_01.models.OSDiskType :keyword kubelet_disk_type: KubeletDiskType determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. Currently allows one value, OS, - resulting in Kubelet using the OS disk for data. Possible values include: "OS", "Temporary". + resulting in Kubelet using the OS disk for data. Known values are: "OS", "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_03_01.models.KubeletDiskType :keyword vnet_subnet_id: VNet SubnetID specifies the VNet's subnet identifier for nodes and @@ -2691,11 +2683,10 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2021_03_01.models.OSType :keyword os_sku: OsSKU to be used to specify os sku. Choose from Ubuntu(default) and CBLMariner - for Linux OSType. Not applicable to Windows OSType. Possible values include: "Ubuntu", - "CBLMariner". + for Linux OSType. Not applicable to Windows OSType. Known values are: "Ubuntu", "CBLMariner". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2021_03_01.models.OSSKU :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -2703,11 +2694,11 @@ def __init__( :paramtype min_count: int :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool - :keyword type: AgentPoolType represents types of an agent pool. Possible values include: + :keyword type: AgentPoolType represents types of an agent pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2021_03_01.models.AgentPoolType - :keyword mode: AgentPoolMode represents mode of an agent pool. Possible values include: - "System", "User". + :keyword mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", + "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2021_03_01.models.AgentPoolMode :keyword orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -2724,13 +2715,12 @@ def __init__( Public IP Prefix. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Possible values include: "Spot", "Regular". Default value: - "Regular". + priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_03_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction - policy for Spot virtual machine scale set. Default to Delete. Possible values include: - "Delete", "Deallocate". Default value: "Delete". + policy for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", + "Deallocate". Default value: "Delete". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_03_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: SpotMaxPrice to be used to specify the maximum price you are willing @@ -2757,7 +2747,7 @@ def __init__( :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU. Supported values are MIG1g, MIG2g, MIG3g, MIG4g and MIG7g. - Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2021_03_01.models.GPUInstanceProfile """ @@ -2819,12 +2809,11 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar os_disk_type: OS disk type to be used for machines in a given agent pool. Allowed values are 'Ephemeral' and 'Managed'. If unspecified, defaults to 'Ephemeral' when the VM supports ephemeral OS and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults - to 'Managed'. May not be changed after creation. Possible values include: "Managed", - "Ephemeral". + to 'Managed'. May not be changed after creation. Known values are: "Managed", "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2021_03_01.models.OSDiskType :ivar kubelet_disk_type: KubeletDiskType determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. Currently allows one value, OS, - resulting in Kubelet using the OS disk for data. Possible values include: "OS", "Temporary". + resulting in Kubelet using the OS disk for data. Known values are: "OS", "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_03_01.models.KubeletDiskType :ivar vnet_subnet_id: VNet SubnetID specifies the VNet's subnet identifier for nodes and maybe @@ -2835,11 +2824,10 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar max_pods: Maximum number of pods that can run on a node. :vartype max_pods: int :ivar os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default to - Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2021_03_01.models.OSType :ivar os_sku: OsSKU to be used to specify os sku. Choose from Ubuntu(default) and CBLMariner - for Linux OSType. Not applicable to Windows OSType. Possible values include: "Ubuntu", - "CBLMariner". + for Linux OSType. Not applicable to Windows OSType. Known values are: "Ubuntu", "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2021_03_01.models.OSSKU :ivar max_count: Maximum number of nodes for auto-scaling. :vartype max_count: int @@ -2847,11 +2835,10 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :vartype min_count: int :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool - :ivar type: AgentPoolType represents types of an agent pool. Possible values include: + :ivar type: AgentPoolType represents types of an agent pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2021_03_01.models.AgentPoolType - :ivar mode: AgentPoolMode represents mode of an agent pool. Possible values include: "System", - "User". + :ivar mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", "User". :vartype mode: str or ~azure.mgmt.containerservice.v2021_03_01.models.AgentPoolMode :ivar orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -2875,12 +2862,11 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): IP Prefix. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Possible values include: "Spot", "Regular". Default value: - "Regular". + priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_03_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction policy - for Spot virtual machine scale set. Default to Delete. Possible values include: "Delete", + for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", "Deallocate". Default value: "Delete". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_03_01.models.ScaleSetEvictionPolicy @@ -2907,8 +2893,8 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar enable_fips: Whether to use FIPS enabled OS. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Supported values are MIG1g, MIG2g, MIG3g, MIG4g and MIG7g. Possible - values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Supported values are MIG1g, MIG2g, MIG3g, MIG4g and MIG7g. Known + values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2021_03_01.models.GPUInstanceProfile :ivar name: Required. Unique name of the agent pool profile in the context of the subscription @@ -2970,35 +2956,35 @@ def __init__( count: Optional[int] = None, vm_size: Optional[str] = None, os_disk_size_gb: Optional[int] = None, - os_disk_type: Optional[Union[str, "OSDiskType"]] = None, - kubelet_disk_type: Optional[Union[str, "KubeletDiskType"]] = None, + os_disk_type: Optional[Union[str, "_models.OSDiskType"]] = None, + kubelet_disk_type: Optional[Union[str, "_models.KubeletDiskType"]] = None, vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", - os_sku: Optional[Union[str, "OSSKU"]] = None, + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - type: Optional[Union[str, "AgentPoolType"]] = None, - mode: Optional[Union[str, "AgentPoolMode"]] = None, + type: Optional[Union[str, "_models.AgentPoolType"]] = None, + mode: Optional[Union[str, "_models.AgentPoolMode"]] = None, orchestrator_version: Optional[str] = None, - upgrade_settings: Optional["AgentPoolUpgradeSettings"] = None, + upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", spot_max_price: Optional[float] = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, proximity_placement_group_id: Optional[str] = None, - kubelet_config: Optional["KubeletConfig"] = None, - linux_os_config: Optional["LinuxOSConfig"] = None, + kubelet_config: Optional["_models.KubeletConfig"] = None, + linux_os_config: Optional["_models.LinuxOSConfig"] = None, enable_encryption_at_host: Optional[bool] = None, enable_fips: Optional[bool] = None, - gpu_instance_profile: Optional[Union[str, "GPUInstanceProfile"]] = None, + gpu_instance_profile: Optional[Union[str, "_models.GPUInstanceProfile"]] = None, **kwargs ): """ @@ -3015,12 +3001,12 @@ def __init__( :keyword os_disk_type: OS disk type to be used for machines in a given agent pool. Allowed values are 'Ephemeral' and 'Managed'. If unspecified, defaults to 'Ephemeral' when the VM supports ephemeral OS and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, - defaults to 'Managed'. May not be changed after creation. Possible values include: "Managed", + defaults to 'Managed'. May not be changed after creation. Known values are: "Managed", "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2021_03_01.models.OSDiskType :keyword kubelet_disk_type: KubeletDiskType determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. Currently allows one value, OS, - resulting in Kubelet using the OS disk for data. Possible values include: "OS", "Temporary". + resulting in Kubelet using the OS disk for data. Known values are: "OS", "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_03_01.models.KubeletDiskType :keyword vnet_subnet_id: VNet SubnetID specifies the VNet's subnet identifier for nodes and @@ -3031,11 +3017,10 @@ def __init__( :keyword max_pods: Maximum number of pods that can run on a node. :paramtype max_pods: int :keyword os_type: OsType to be used to specify os type. Choose from Linux and Windows. Default - to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2021_03_01.models.OSType :keyword os_sku: OsSKU to be used to specify os sku. Choose from Ubuntu(default) and CBLMariner - for Linux OSType. Not applicable to Windows OSType. Possible values include: "Ubuntu", - "CBLMariner". + for Linux OSType. Not applicable to Windows OSType. Known values are: "Ubuntu", "CBLMariner". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2021_03_01.models.OSSKU :keyword max_count: Maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -3043,11 +3028,11 @@ def __init__( :paramtype min_count: int :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool - :keyword type: AgentPoolType represents types of an agent pool. Possible values include: + :keyword type: AgentPoolType represents types of an agent pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2021_03_01.models.AgentPoolType - :keyword mode: AgentPoolMode represents mode of an agent pool. Possible values include: - "System", "User". + :keyword mode: AgentPoolMode represents mode of an agent pool. Known values are: "System", + "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2021_03_01.models.AgentPoolMode :keyword orchestrator_version: Version of orchestrator specified when creating the managed cluster. @@ -3064,13 +3049,12 @@ def __init__( Public IP Prefix. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: ScaleSetPriority to be used to specify virtual machine scale set - priority. Default to regular. Possible values include: "Spot", "Regular". Default value: - "Regular". + priority. Default to regular. Known values are: "Spot", "Regular". Default value: "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_03_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: ScaleSetEvictionPolicy to be used to specify eviction - policy for Spot virtual machine scale set. Default to Delete. Possible values include: - "Delete", "Deallocate". Default value: "Delete". + policy for Spot virtual machine scale set. Default to Delete. Known values are: "Delete", + "Deallocate". Default value: "Delete". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_03_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: SpotMaxPrice to be used to specify the maximum price you are willing @@ -3097,7 +3081,7 @@ def __init__( :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU. Supported values are MIG1g, MIG2g, MIG3g, MIG4g and MIG7g. - Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2021_03_01.models.GPUInstanceProfile :keyword name: Required. Unique name of the agent pool profile in the context of the @@ -3150,8 +3134,8 @@ def __init__( class ManagedClusterAutoUpgradeProfile(msrest.serialization.Model): """Auto upgrade profile for a managed cluster. - :ivar upgrade_channel: upgrade channel for auto upgrade. Possible values include: "rapid", - "stable", "patch", "node-image", "none". + :ivar upgrade_channel: upgrade channel for auto upgrade. Known values are: "rapid", "stable", + "patch", "node-image", "none". :vartype upgrade_channel: str or ~azure.mgmt.containerservice.v2021_03_01.models.UpgradeChannel """ @@ -3162,11 +3146,11 @@ class ManagedClusterAutoUpgradeProfile(msrest.serialization.Model): def __init__( self, *, - upgrade_channel: Optional[Union[str, "UpgradeChannel"]] = None, + upgrade_channel: Optional[Union[str, "_models.UpgradeChannel"]] = None, **kwargs ): """ - :keyword upgrade_channel: upgrade channel for auto upgrade. Possible values include: "rapid", + :keyword upgrade_channel: upgrade channel for auto upgrade. Known values are: "rapid", "stable", "patch", "node-image", "none". :paramtype upgrade_channel: str or ~azure.mgmt.containerservice.v2021_03_01.models.UpgradeChannel @@ -3235,8 +3219,8 @@ class ManagedClusterIdentity(msrest.serialization.Model): :ivar type: The type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ resource group in agent nodes. Type 'None' will not use MSI for the managed cluster, - service principal will be used instead. Possible values include: "SystemAssigned", - "UserAssigned", "None". + service principal will be used instead. Known values are: "SystemAssigned", "UserAssigned", + "None". :vartype type: str or ~azure.mgmt.containerservice.v2021_03_01.models.ResourceIdentityType :ivar user_assigned_identities: The user identity associated with the managed cluster. This identity will be used in control plane and only one user assigned identity is allowed. The user @@ -3261,15 +3245,15 @@ class ManagedClusterIdentity(msrest.serialization.Model): def __init__( self, *, - type: Optional[Union[str, "ResourceIdentityType"]] = None, - user_assigned_identities: Optional[Dict[str, "Components1Umhcm8SchemasManagedclusteridentityPropertiesUserassignedidentitiesAdditionalproperties"]] = None, + type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, + user_assigned_identities: Optional[Dict[str, "_models.Components1Umhcm8SchemasManagedclusteridentityPropertiesUserassignedidentitiesAdditionalproperties"]] = None, **kwargs ): """ :keyword type: The type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ resource group in agent nodes. Type 'None' will not use MSI for the managed - cluster, service principal will be used instead. Possible values include: "SystemAssigned", + cluster, service principal will be used instead. Known values are: "SystemAssigned", "UserAssigned", "None". :paramtype type: str or ~azure.mgmt.containerservice.v2021_03_01.models.ResourceIdentityType :keyword user_assigned_identities: The user identity associated with the managed cluster. This @@ -3309,7 +3293,7 @@ class ManagedClusterListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["ManagedCluster"]] = None, + value: Optional[List["_models.ManagedCluster"]] = None, **kwargs ): """ @@ -3363,10 +3347,10 @@ class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): def __init__( self, *, - managed_outbound_i_ps: Optional["ManagedClusterLoadBalancerProfileManagedOutboundIPs"] = None, - outbound_ip_prefixes: Optional["ManagedClusterLoadBalancerProfileOutboundIPPrefixes"] = None, - outbound_i_ps: Optional["ManagedClusterLoadBalancerProfileOutboundIPs"] = None, - effective_outbound_i_ps: Optional[List["ResourceReference"]] = None, + managed_outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileManagedOutboundIPs"] = None, + outbound_ip_prefixes: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPPrefixes"] = None, + outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPs"] = None, + effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, allocated_outbound_ports: Optional[int] = 0, idle_timeout_in_minutes: Optional[int] = 30, **kwargs @@ -3449,7 +3433,7 @@ class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.M def __init__( self, *, - public_ip_prefixes: Optional[List["ResourceReference"]] = None, + public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, **kwargs ): """ @@ -3475,7 +3459,7 @@ class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): def __init__( self, *, - public_i_ps: Optional[List["ResourceReference"]] = None, + public_i_ps: Optional[List["_models.ResourceReference"]] = None, **kwargs ): """ @@ -3501,8 +3485,8 @@ class ManagedClusterPodIdentity(msrest.serialization.Model): :vartype binding_selector: str :ivar identity: Required. Information of the user assigned identity. :vartype identity: ~azure.mgmt.containerservice.v2021_03_01.models.UserAssignedIdentity - :ivar provisioning_state: The current provisioning state of the pod identity. Possible values - include: "Assigned", "Updating", "Deleting", "Failed". + :ivar provisioning_state: The current provisioning state of the pod identity. Known values are: + "Assigned", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2021_03_01.models.ManagedClusterPodIdentityProvisioningState :ivar provisioning_info: @@ -3532,7 +3516,7 @@ def __init__( *, name: str, namespace: str, - identity: "UserAssignedIdentity", + identity: "_models.UserAssignedIdentity", binding_selector: Optional[str] = None, **kwargs ): @@ -3630,8 +3614,8 @@ def __init__( *, enabled: Optional[bool] = None, allow_network_plugin_kubenet: Optional[bool] = None, - user_assigned_identities: Optional[List["ManagedClusterPodIdentity"]] = None, - user_assigned_identity_exceptions: Optional[List["ManagedClusterPodIdentityException"]] = None, + user_assigned_identities: Optional[List["_models.ManagedClusterPodIdentity"]] = None, + user_assigned_identity_exceptions: Optional[List["_models.ManagedClusterPodIdentityException"]] = None, **kwargs ): """ @@ -3668,7 +3652,7 @@ class ManagedClusterPodIdentityProvisioningInfo(msrest.serialization.Model): def __init__( self, *, - error: Optional["CloudError"] = None, + error: Optional["_models.CloudError"] = None, **kwargs ): """ @@ -3689,7 +3673,7 @@ class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): :ivar name: Pool name. :vartype name: str :ivar os_type: Required. OsType to be used to specify os type. Choose from Linux and Windows. - Default to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2021_03_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -3712,9 +3696,9 @@ def __init__( self, *, kubernetes_version: str, - os_type: Union[str, "OSType"] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", name: Optional[str] = None, - upgrades: Optional[List["ManagedClusterPoolUpgradeProfileUpgradesItem"]] = None, + upgrades: Optional[List["_models.ManagedClusterPoolUpgradeProfileUpgradesItem"]] = None, **kwargs ): """ @@ -3723,7 +3707,7 @@ def __init__( :keyword name: Pool name. :paramtype name: str :keyword os_type: Required. OsType to be used to specify os type. Choose from Linux and - Windows. Default to Linux. Possible values include: "Linux", "Windows". Default value: "Linux". + Windows. Default to Linux. Known values are: "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2021_03_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: @@ -3773,7 +3757,7 @@ class ManagedClusterPropertiesAutoScalerProfile(msrest.serialization.Model): :ivar balance_similar_node_groups: :vartype balance_similar_node_groups: str - :ivar expander: Possible values include: "least-waste", "most-pods", "priority", "random". + :ivar expander: Known values are: "least-waste", "most-pods", "priority", "random". :vartype expander: str or ~azure.mgmt.containerservice.v2021_03_01.models.Expander :ivar max_empty_bulk_delete: :vartype max_empty_bulk_delete: str @@ -3831,7 +3815,7 @@ def __init__( self, *, balance_similar_node_groups: Optional[str] = None, - expander: Optional[Union[str, "Expander"]] = None, + expander: Optional[Union[str, "_models.Expander"]] = None, max_empty_bulk_delete: Optional[str] = None, max_graceful_termination_sec: Optional[str] = None, max_node_provision_time: Optional[str] = None, @@ -3852,7 +3836,7 @@ def __init__( """ :keyword balance_similar_node_groups: :paramtype balance_similar_node_groups: str - :keyword expander: Possible values include: "least-waste", "most-pods", "priority", "random". + :keyword expander: Known values are: "least-waste", "most-pods", "priority", "random". :paramtype expander: str or ~azure.mgmt.containerservice.v2021_03_01.models.Expander :keyword max_empty_bulk_delete: :paramtype max_empty_bulk_delete: str @@ -3946,9 +3930,9 @@ def __init__( class ManagedClusterSKU(msrest.serialization.Model): """ManagedClusterSKU. - :ivar name: Name of a managed cluster SKU. Possible values include: "Basic". + :ivar name: Name of a managed cluster SKU. Known values are: "Basic". :vartype name: str or ~azure.mgmt.containerservice.v2021_03_01.models.ManagedClusterSKUName - :ivar tier: Tier of a managed cluster SKU. Possible values include: "Paid", "Free". + :ivar tier: Tier of a managed cluster SKU. Known values are: "Paid", "Free". :vartype tier: str or ~azure.mgmt.containerservice.v2021_03_01.models.ManagedClusterSKUTier """ @@ -3960,14 +3944,14 @@ class ManagedClusterSKU(msrest.serialization.Model): def __init__( self, *, - name: Optional[Union[str, "ManagedClusterSKUName"]] = None, - tier: Optional[Union[str, "ManagedClusterSKUTier"]] = None, + name: Optional[Union[str, "_models.ManagedClusterSKUName"]] = None, + tier: Optional[Union[str, "_models.ManagedClusterSKUTier"]] = None, **kwargs ): """ - :keyword name: Name of a managed cluster SKU. Possible values include: "Basic". + :keyword name: Name of a managed cluster SKU. Known values are: "Basic". :paramtype name: str or ~azure.mgmt.containerservice.v2021_03_01.models.ManagedClusterSKUName - :keyword tier: Tier of a managed cluster SKU. Possible values include: "Paid", "Free". + :keyword tier: Tier of a managed cluster SKU. Known values are: "Paid", "Free". :paramtype tier: str or ~azure.mgmt.containerservice.v2021_03_01.models.ManagedClusterSKUTier """ super(ManagedClusterSKU, self).__init__(**kwargs) @@ -4016,8 +4000,8 @@ class ManagedClusterUpgradeProfile(msrest.serialization.Model): def __init__( self, *, - control_plane_profile: "ManagedClusterPoolUpgradeProfile", - agent_pool_profiles: List["ManagedClusterPoolUpgradeProfile"], + control_plane_profile: "_models.ManagedClusterPoolUpgradeProfile", + agent_pool_profiles: List["_models.ManagedClusterPoolUpgradeProfile"], **kwargs ): """ @@ -4059,7 +4043,7 @@ class ManagedClusterWindowsProfile(msrest.serialization.Model): "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!". :vartype admin_password: str :ivar license_type: 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". + Azure Hybrid User Benefits for Windows VMs. Known values are: "None", "Windows_Server". :vartype license_type: str or ~azure.mgmt.containerservice.v2021_03_01.models.LicenseType :ivar enable_csi_proxy: Whether to enable CSI proxy. :vartype enable_csi_proxy: bool @@ -4081,7 +4065,7 @@ def __init__( *, admin_username: str, admin_password: Optional[str] = None, - license_type: Optional[Union[str, "LicenseType"]] = None, + license_type: Optional[Union[str, "_models.LicenseType"]] = None, enable_csi_proxy: Optional[bool] = None, **kwargs ): @@ -4103,7 +4087,7 @@ def __init__( "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!". :paramtype admin_password: str :keyword license_type: 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". + Azure Hybrid User Benefits for Windows VMs. Known values are: "None", "Windows_Server". :paramtype license_type: str or ~azure.mgmt.containerservice.v2021_03_01.models.LicenseType :keyword enable_csi_proxy: Whether to enable CSI proxy. :paramtype enable_csi_proxy: bool @@ -4229,7 +4213,7 @@ class OSOptionProfile(msrest.serialization.Model): def __init__( self, *, - os_option_property_list: List["OSOptionProperty"], + os_option_property_list: List["_models.OSOptionProperty"], **kwargs ): """ @@ -4286,8 +4270,8 @@ def __init__( class PowerState(msrest.serialization.Model): """Describes the Power State of the cluster. - :ivar code: Tells whether the cluster is Running or Stopped. Possible values include: - "Running", "Stopped". + :ivar code: Tells whether the cluster is Running or Stopped. Known values are: "Running", + "Stopped". :vartype code: str or ~azure.mgmt.containerservice.v2021_03_01.models.Code """ @@ -4298,12 +4282,12 @@ class PowerState(msrest.serialization.Model): def __init__( self, *, - code: Optional[Union[str, "Code"]] = None, + code: Optional[Union[str, "_models.Code"]] = None, **kwargs ): """ - :keyword code: Tells whether the cluster is Running or Stopped. Possible values include: - "Running", "Stopped". + :keyword code: Tells whether the cluster is Running or Stopped. Known values are: "Running", + "Stopped". :paramtype code: str or ~azure.mgmt.containerservice.v2021_03_01.models.Code """ super(PowerState, self).__init__(**kwargs) @@ -4346,7 +4330,7 @@ class PrivateEndpointConnection(msrest.serialization.Model): :vartype name: str :ivar type: The resource type. :vartype type: str - :ivar provisioning_state: The current provisioning state. Possible values include: "Succeeded", + :ivar provisioning_state: The current provisioning state. Known values are: "Succeeded", "Creating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2021_03_01.models.PrivateEndpointConnectionProvisioningState @@ -4377,8 +4361,8 @@ class PrivateEndpointConnection(msrest.serialization.Model): def __init__( self, *, - private_endpoint: Optional["PrivateEndpoint"] = None, - private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, + private_endpoint: Optional["_models.PrivateEndpoint"] = None, + private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionState"] = None, **kwargs ): """ @@ -4412,7 +4396,7 @@ class PrivateEndpointConnectionListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["PrivateEndpointConnection"]] = None, + value: Optional[List["_models.PrivateEndpointConnection"]] = None, **kwargs ): """ @@ -4502,7 +4486,7 @@ class PrivateLinkResourcesListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["PrivateLinkResource"]] = None, + value: Optional[List["_models.PrivateLinkResource"]] = None, **kwargs ): """ @@ -4516,7 +4500,7 @@ def __init__( class PrivateLinkServiceConnectionState(msrest.serialization.Model): """The state of a private link service connection. - :ivar status: The private link service connection status. Possible values include: "Pending", + :ivar status: The private link service connection status. Known values are: "Pending", "Approved", "Rejected", "Disconnected". :vartype status: str or ~azure.mgmt.containerservice.v2021_03_01.models.ConnectionStatus :ivar description: The private link service connection description. @@ -4531,13 +4515,13 @@ class PrivateLinkServiceConnectionState(msrest.serialization.Model): def __init__( self, *, - status: Optional[Union[str, "ConnectionStatus"]] = None, + status: Optional[Union[str, "_models.ConnectionStatus"]] = None, description: Optional[str] = None, **kwargs ): """ - :keyword status: The private link service connection status. Possible values include: - "Pending", "Approved", "Rejected", "Disconnected". + :keyword status: The private link service connection status. Known values are: "Pending", + "Approved", "Rejected", "Disconnected". :paramtype status: str or ~azure.mgmt.containerservice.v2021_03_01.models.ConnectionStatus :keyword description: The private link service connection description. :paramtype description: str @@ -4893,15 +4877,15 @@ class SystemData(msrest.serialization.Model): :ivar created_by: The identity that created the resource. :vartype created_by: str - :ivar created_by_type: The type of identity that created the resource. Possible values include: + :ivar created_by_type: The type of identity that created the resource. Known values are: "User", "Application", "ManagedIdentity", "Key". :vartype created_by_type: str or ~azure.mgmt.containerservice.v2021_03_01.models.CreatedByType :ivar created_at: The timestamp of resource creation (UTC). :vartype created_at: ~datetime.datetime :ivar last_modified_by: The identity that last modified the resource. :vartype last_modified_by: str - :ivar last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". + :ivar last_modified_by_type: The type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", "Key". :vartype last_modified_by_type: str or ~azure.mgmt.containerservice.v2021_03_01.models.CreatedByType :ivar last_modified_at: The type of identity that last modified the resource. @@ -4921,26 +4905,26 @@ def __init__( self, *, created_by: Optional[str] = None, - created_by_type: Optional[Union[str, "CreatedByType"]] = None, + created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, created_at: Optional[datetime.datetime] = None, last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[Union[str, "CreatedByType"]] = None, + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, last_modified_at: Optional[datetime.datetime] = None, **kwargs ): """ :keyword created_by: The identity that created the resource. :paramtype created_by: str - :keyword created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". + :keyword created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", "Key". :paramtype created_by_type: str or ~azure.mgmt.containerservice.v2021_03_01.models.CreatedByType :keyword created_at: The timestamp of resource creation (UTC). :paramtype created_at: ~datetime.datetime :keyword last_modified_by: The identity that last modified the resource. :paramtype last_modified_by: str - :keyword last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". + :keyword last_modified_by_type: The type of identity that last modified the resource. Known + values are: "User", "Application", "ManagedIdentity", "Key". :paramtype last_modified_by_type: str or ~azure.mgmt.containerservice.v2021_03_01.models.CreatedByType :keyword last_modified_at: The type of identity that last modified the resource. @@ -4983,8 +4967,8 @@ def __init__( class TimeInWeek(msrest.serialization.Model): """Time in a week. - :ivar day: A day in a week. Possible values include: "Sunday", "Monday", "Tuesday", - "Wednesday", "Thursday", "Friday", "Saturday". + :ivar day: A day in a week. Known values are: "Sunday", "Monday", "Tuesday", "Wednesday", + "Thursday", "Friday", "Saturday". :vartype day: str or ~azure.mgmt.containerservice.v2021_03_01.models.WeekDay :ivar hour_slots: hour slots in a day. :vartype hour_slots: list[int] @@ -4998,13 +4982,13 @@ class TimeInWeek(msrest.serialization.Model): def __init__( self, *, - day: Optional[Union[str, "WeekDay"]] = None, + day: Optional[Union[str, "_models.WeekDay"]] = None, hour_slots: Optional[List[int]] = None, **kwargs ): """ - :keyword day: A day in a week. Possible values include: "Sunday", "Monday", "Tuesday", - "Wednesday", "Thursday", "Friday", "Saturday". + :keyword day: A day in a week. Known values are: "Sunday", "Monday", "Tuesday", "Wednesday", + "Thursday", "Friday", "Saturday". :paramtype day: str or ~azure.mgmt.containerservice.v2021_03_01.models.WeekDay :keyword hour_slots: hour slots in a day. :paramtype hour_slots: list[int] diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/models/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/models/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/operations/__init__.py index 3942e0ca6a01..f0e265d9f2f4 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/operations/__init__.py @@ -14,6 +14,9 @@ from ._private_link_resources_operations import PrivateLinkResourcesOperations from ._resolve_private_link_service_id_operations import ResolvePrivateLinkServiceIdOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'Operations', 'ManagedClustersOperations', @@ -23,3 +26,5 @@ 'PrivateLinkResourcesOperations', 'ResolvePrivateLinkServiceIdOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/operations/_agent_pools_operations.py index 99fbc9f1fcfb..7ee26761a1ff 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/operations/_agent_pools_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -35,9 +35,12 @@ def build_list_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools") # pylint: disable=line-too-long path_format_arguments = { @@ -49,18 +52,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -72,9 +73,12 @@ def build_get_request( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -87,18 +91,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -109,14 +111,17 @@ def build_create_or_update_request_initial( resource_name: str, agent_pool_name: str, *, - json: JSONType = None, + json: Optional[_models.AgentPool] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-03-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -129,20 +134,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -156,9 +159,12 @@ def build_delete_request_initial( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -171,18 +177,16 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -194,9 +198,12 @@ def build_get_upgrade_profile_request( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default") # pylint: disable=line-too-long path_format_arguments = { @@ -209,18 +216,16 @@ def build_get_upgrade_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -231,9 +236,12 @@ def build_get_available_agent_pool_versions_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions") # pylint: disable=line-too-long path_format_arguments = { @@ -245,18 +253,16 @@ def build_get_available_agent_pool_versions_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -268,9 +274,12 @@ def build_upgrade_node_image_version_request_initial( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion") # pylint: disable=line-too-long path_format_arguments = { @@ -283,42 +292,38 @@ def build_upgrade_node_image_version_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class AgentPoolsOperations(object): - """AgentPoolsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class AgentPoolsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_03_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_03_01.ContainerServiceClient`'s + :attr:`agent_pools` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -326,7 +331,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Iterable["_models.AgentPoolListResult"]: + ) -> Iterable[_models.AgentPoolListResult]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. The operation returns properties @@ -342,13 +347,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_03_01.models.AgentPoolListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -358,9 +366,11 @@ def prepare_request(next_link=None): resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -370,9 +380,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -412,7 +424,7 @@ def get( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPool": + ) -> _models.AgentPool: """Gets the agent pool. Gets the details of the agent pool by managed cluster and resource group. @@ -428,13 +440,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2021_03_01.models.AgentPool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] request = build_get_request( @@ -444,11 +459,13 @@ def get( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -474,17 +491,20 @@ def _create_or_update_initial( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> "_models.AgentPool": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] + ) -> _models.AgentPool: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] _json = self._serialize.body(parameters, 'AgentPool') @@ -497,11 +517,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -532,9 +554,9 @@ def begin_create_or_update( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> LROPoller["_models.AgentPool"]: + ) -> LROPoller[_models.AgentPool]: """Creates or updates an agent pool. Creates or updates an agent pool in the specified managed cluster. @@ -560,17 +582,20 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_03_01.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, @@ -578,20 +603,27 @@ def begin_create_or_update( 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): - response = pipeline_response.http_response deserialized = self._deserialize('AgentPool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -611,13 +643,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements agent_pool_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -627,11 +662,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -678,21 +715,26 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-03-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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) @@ -702,8 +744,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -723,7 +771,7 @@ def get_upgrade_profile( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPoolUpgradeProfile": + ) -> _models.AgentPoolUpgradeProfile: """Gets upgrade profile for an agent pool. Gets the details of the upgrade profile for an agent pool with a specified resource group and @@ -740,13 +788,16 @@ def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2021_03_01.models.AgentPoolUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] request = build_get_upgrade_profile_request( @@ -756,11 +807,13 @@ def get_upgrade_profile( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -787,7 +840,7 @@ def get_available_agent_pool_versions( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.AgentPoolAvailableVersions": + ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported versions for the specified agent pool. Gets a list of supported versions for the specified agent pool. @@ -801,13 +854,16 @@ def get_available_agent_pool_versions( :rtype: ~azure.mgmt.containerservice.v2021_03_01.models.AgentPoolAvailableVersions :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolAvailableVersions"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] request = build_get_available_agent_pool_versions_request( @@ -816,11 +872,13 @@ def get_available_agent_pool_versions( resource_name=resource_name, api_version=api_version, template_url=self.get_available_agent_pool_versions.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -847,14 +905,17 @@ def _upgrade_node_image_version_initial( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> Optional["_models.AgentPool"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.AgentPool"]] + ) -> Optional[_models.AgentPool]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] request = build_upgrade_node_image_version_request_initial( @@ -864,11 +925,13 @@ def _upgrade_node_image_version_initial( agent_pool_name=agent_pool_name, api_version=api_version, template_url=self._upgrade_node_image_version_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -898,7 +961,7 @@ def begin_upgrade_node_image_version( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> LROPoller["_models.AgentPool"]: + ) -> LROPoller[_models.AgentPool]: """Upgrade node image version of an agent pool to the latest. Upgrade node image version of an agent pool to the latest. @@ -922,35 +985,45 @@ def begin_upgrade_node_image_version( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_03_01.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._upgrade_node_image_version_initial( + raw_result = self._upgrade_node_image_version_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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): - response = pipeline_response.http_response deserialized = self._deserialize('AgentPool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/operations/_maintenance_configurations_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/operations/_maintenance_configurations_operations.py index e723a8058b88..fc57769537e7 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/operations/_maintenance_configurations_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/operations/_maintenance_configurations_operations.py @@ -16,12 +16,12 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -33,9 +33,12 @@ def build_list_by_managed_cluster_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations") # pylint: disable=line-too-long path_format_arguments = { @@ -47,18 +50,16 @@ def build_list_by_managed_cluster_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -70,9 +71,12 @@ def build_get_request( config_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long path_format_arguments = { @@ -85,18 +89,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -107,14 +109,17 @@ def build_create_or_update_request( resource_name: str, config_name: str, *, - json: JSONType = None, + json: Optional[_models.MaintenanceConfiguration] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-03-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long path_format_arguments = { @@ -127,20 +132,18 @@ def build_create_or_update_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -154,9 +157,12 @@ def build_delete_request( config_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long path_format_arguments = { @@ -169,42 +175,38 @@ def build_delete_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class MaintenanceConfigurationsOperations(object): - """MaintenanceConfigurationsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class MaintenanceConfigurationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_03_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_03_01.ContainerServiceClient`'s + :attr:`maintenance_configurations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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_by_managed_cluster( @@ -212,7 +214,7 @@ def list_by_managed_cluster( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Iterable["_models.MaintenanceConfigurationListResult"]: + ) -> Iterable[_models.MaintenanceConfigurationListResult]: """Gets a list of maintenance configurations in the specified managed cluster. Gets a list of maintenance configurations in the specified managed cluster. The operation @@ -229,13 +231,16 @@ def list_by_managed_cluster( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_03_01.models.MaintenanceConfigurationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfigurationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfigurationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -245,9 +250,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=self.list_by_managed_cluster.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -257,9 +264,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -299,7 +308,7 @@ def get( resource_name: str, config_name: str, **kwargs: Any - ) -> "_models.MaintenanceConfiguration": + ) -> _models.MaintenanceConfiguration: """Gets the maintenance configuration. Gets the details of maintenance configurations by managed cluster and resource group. @@ -315,13 +324,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2021_03_01.models.MaintenanceConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfiguration"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] request = build_get_request( @@ -331,11 +343,13 @@ def get( config_name=config_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -362,9 +376,9 @@ def create_or_update( resource_group_name: str, resource_name: str, config_name: str, - parameters: "_models.MaintenanceConfiguration", + parameters: _models.MaintenanceConfiguration, **kwargs: Any - ) -> "_models.MaintenanceConfiguration": + ) -> _models.MaintenanceConfiguration: """Creates or updates a maintenance configurations. Creates or updates a maintenance configuration in the specified managed cluster. @@ -383,14 +397,17 @@ def create_or_update( :rtype: ~azure.mgmt.containerservice.v2021_03_01.models.MaintenanceConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfiguration"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] _json = self._serialize.body(parameters, 'MaintenanceConfiguration') @@ -403,11 +420,13 @@ def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -451,13 +470,16 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -467,11 +489,13 @@ def delete( # pylint: disable=inconsistent-return-statements config_name=config_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/operations/_managed_clusters_operations.py index 58657a474cbd..227893546796 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/operations/_managed_clusters_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -36,9 +36,12 @@ def build_get_os_options_request( resource_type: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default") # pylint: disable=line-too-long path_format_arguments = { @@ -49,20 +52,18 @@ def build_get_os_options_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if resource_type is not None: - _query_parameters['resource-type'] = _SERIALIZER.query("resource_type", resource_type, 'str') + _params['resource-type'] = _SERIALIZER.query("resource_type", resource_type, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -71,9 +72,12 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters") path_format_arguments = { @@ -83,18 +87,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -104,9 +106,12 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters") # pylint: disable=line-too-long path_format_arguments = { @@ -117,18 +122,16 @@ def build_list_by_resource_group_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -139,9 +142,12 @@ def build_get_upgrade_profile_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default") # pylint: disable=line-too-long path_format_arguments = { @@ -153,18 +159,16 @@ def build_get_upgrade_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -176,9 +180,12 @@ def build_get_access_profile_request( role_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -191,18 +198,16 @@ def build_get_access_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -213,9 +218,12 @@ def build_list_cluster_admin_credentials_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -227,18 +235,16 @@ def build_list_cluster_admin_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -249,9 +255,12 @@ def build_list_cluster_user_credentials_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -263,18 +272,16 @@ def build_list_cluster_user_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -285,9 +292,12 @@ def build_list_cluster_monitoring_user_credentials_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -299,18 +309,16 @@ def build_list_cluster_monitoring_user_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -321,9 +329,12 @@ def build_get_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -335,18 +346,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -356,14 +365,17 @@ def build_create_or_update_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedCluster] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-03-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -375,20 +387,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -400,14 +410,17 @@ def build_update_tags_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.TagsObject] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-03-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -419,20 +432,18 @@ def build_update_tags_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -445,9 +456,12 @@ def build_delete_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -459,18 +473,16 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -480,14 +492,17 @@ def build_reset_service_principal_profile_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedClusterServicePrincipalProfile] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-03-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile") # pylint: disable=line-too-long path_format_arguments = { @@ -499,20 +514,18 @@ def build_reset_service_principal_profile_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -524,14 +537,17 @@ def build_reset_aad_profile_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedClusterAADProfile] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-03-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile") # pylint: disable=line-too-long path_format_arguments = { @@ -543,20 +559,18 @@ def build_reset_aad_profile_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -569,9 +583,12 @@ def build_rotate_cluster_certificates_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates") # pylint: disable=line-too-long path_format_arguments = { @@ -583,18 +600,16 @@ def build_rotate_cluster_certificates_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -605,9 +620,12 @@ def build_stop_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop") # pylint: disable=line-too-long path_format_arguments = { @@ -619,18 +637,16 @@ def build_stop_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -641,9 +657,12 @@ def build_start_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start") # pylint: disable=line-too-long path_format_arguments = { @@ -655,18 +674,16 @@ def build_start_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -676,14 +693,17 @@ def build_run_command_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.RunCommandRequest] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-03-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand") # pylint: disable=line-too-long path_format_arguments = { @@ -695,20 +715,18 @@ def build_run_command_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -722,9 +740,12 @@ def build_get_command_result_request( command_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}") # pylint: disable=line-too-long path_format_arguments = { @@ -737,42 +758,38 @@ def build_get_command_result_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class ManagedClustersOperations(object): # pylint: disable=too-many-public-methods - """ManagedClustersOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ManagedClustersOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_03_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_03_01.ContainerServiceClient`'s + :attr:`managed_clusters` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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_os_options( @@ -780,7 +797,7 @@ def get_os_options( location: str, resource_type: Optional[str] = None, **kwargs: Any - ) -> "_models.OSOptionProfile": + ) -> _models.OSOptionProfile: """Gets supported OS options in the specified subscription. Gets supported OS options in the specified subscription. @@ -795,13 +812,16 @@ def get_os_options( :rtype: ~azure.mgmt.containerservice.v2021_03_01.models.OSOptionProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OSOptionProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OSOptionProfile] request = build_get_os_options_request( @@ -810,11 +830,13 @@ def get_os_options( api_version=api_version, resource_type=resource_type, template_url=self.get_os_options.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -839,7 +861,7 @@ def get_os_options( def list( self, **kwargs: Any - ) -> Iterable["_models.ManagedClusterListResult"]: + ) -> Iterable[_models.ManagedClusterListResult]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. The operation returns properties @@ -852,13 +874,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_03_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -866,9 +891,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -876,9 +903,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -916,7 +945,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.ManagedClusterListResult"]: + ) -> Iterable[_models.ManagedClusterListResult]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. The operation returns @@ -931,13 +960,16 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_03_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -946,9 +978,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -957,9 +991,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -998,7 +1034,7 @@ def get_upgrade_profile( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedClusterUpgradeProfile": + ) -> _models.ManagedClusterUpgradeProfile: """Gets upgrade profile for a managed cluster. Gets the details of the upgrade profile for a managed cluster with a specified resource group @@ -1013,13 +1049,16 @@ def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2021_03_01.models.ManagedClusterUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] request = build_get_upgrade_profile_request( @@ -1028,11 +1067,13 @@ def get_upgrade_profile( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1060,7 +1101,7 @@ def get_access_profile( resource_name: str, role_name: str, **kwargs: Any - ) -> "_models.ManagedClusterAccessProfile": + ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. Gets the accessProfile for the specified role name of the managed cluster with a specified @@ -1081,13 +1122,16 @@ def get_access_profile( :rtype: ~azure.mgmt.containerservice.v2021_03_01.models.ManagedClusterAccessProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterAccessProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] request = build_get_access_profile_request( @@ -1097,11 +1141,13 @@ def get_access_profile( role_name=role_name, api_version=api_version, template_url=self.get_access_profile.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1128,7 +1174,7 @@ def list_cluster_admin_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster admin credential of a managed cluster. Gets cluster admin credential of the managed cluster with a specified resource group and name. @@ -1142,13 +1188,16 @@ def list_cluster_admin_credentials( :rtype: ~azure.mgmt.containerservice.v2021_03_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_admin_credentials_request( @@ -1157,11 +1206,13 @@ def list_cluster_admin_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_admin_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1188,7 +1239,7 @@ def list_cluster_user_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster user credential of a managed cluster. Gets cluster user credential of the managed cluster with a specified resource group and name. @@ -1202,13 +1253,16 @@ def list_cluster_user_credentials( :rtype: ~azure.mgmt.containerservice.v2021_03_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_user_credentials_request( @@ -1217,11 +1271,13 @@ def list_cluster_user_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1248,7 +1304,7 @@ def list_cluster_monitoring_user_credentials( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Gets cluster monitoring user credential of a managed cluster. Gets cluster monitoring user credential of the managed cluster with a specified resource group @@ -1263,13 +1319,16 @@ def list_cluster_monitoring_user_credentials( :rtype: ~azure.mgmt.containerservice.v2021_03_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_monitoring_user_credentials_request( @@ -1278,11 +1337,13 @@ def list_cluster_monitoring_user_credentials( resource_name=resource_name, api_version=api_version, template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1309,7 +1370,7 @@ def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedCluster": + ) -> _models.ManagedCluster: """Gets a managed cluster. Gets the details of the managed cluster with a specified resource group and name. @@ -1323,13 +1384,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2021_03_01.models.ManagedCluster :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] request = build_get_request( @@ -1338,11 +1402,13 @@ def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1367,17 +1433,20 @@ def _create_or_update_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'ManagedCluster') @@ -1389,11 +1458,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1423,9 +1494,9 @@ def begin_create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> LROPoller["_models.ManagedCluster"]: + ) -> LROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. Creates or updates a managed cluster with the specified configuration for agents and Kubernetes @@ -1451,37 +1522,47 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_03_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1498,17 +1579,20 @@ def _update_tags_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'TagsObject') @@ -1520,11 +1604,13 @@ def _update_tags_initial( content_type=content_type, json=_json, template_url=self._update_tags_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1550,9 +1636,9 @@ def begin_update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> LROPoller["_models.ManagedCluster"]: + ) -> LROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates a managed cluster with the specified tags. @@ -1577,37 +1663,47 @@ def begin_update_tags( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_03_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._update_tags_initial( + raw_result = self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1626,13 +1722,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -1641,11 +1740,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1689,20 +1790,25 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-03-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_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) @@ -1712,8 +1818,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1730,17 +1842,20 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') @@ -1752,11 +1867,13 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re content_type=content_type, json=_json, template_url=self._reset_service_principal_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1778,7 +1895,7 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> LROPoller[None]: """Reset Service Principal Profile of a managed cluster. @@ -1805,23 +1922,28 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._reset_service_principal_profile_initial( + raw_result = self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1831,8 +1953,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1849,17 +1977,20 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') @@ -1871,11 +2002,13 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement content_type=content_type, json=_json, template_url=self._reset_aad_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1897,7 +2030,7 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> LROPoller[None]: """Reset AAD Profile of a managed cluster. @@ -1923,23 +2056,28 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._reset_aad_profile_initial( + raw_result = self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1949,8 +2087,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1969,13 +2113,16 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_rotate_cluster_certificates_request_initial( @@ -1984,11 +2131,13 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return resource_name=resource_name, api_version=api_version, template_url=self._rotate_cluster_certificates_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2032,20 +2181,25 @@ def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-st :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-03-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._rotate_cluster_certificates_initial( + raw_result = self._rotate_cluster_certificates_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) @@ -2055,8 +2209,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2075,13 +2235,16 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_stop_request_initial( @@ -2090,11 +2253,13 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_name, api_version=api_version, template_url=self._stop_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2138,20 +2303,25 @@ def begin_stop( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-03-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._stop_initial( + raw_result = self._stop_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) @@ -2161,8 +2331,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2181,13 +2357,16 @@ def _start_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_start_request_initial( @@ -2196,11 +2375,13 @@ def _start_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_name, api_version=api_version, template_url=self._start_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2244,20 +2425,25 @@ def begin_start( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-03-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._start_initial( + raw_result = self._start_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) @@ -2267,8 +2453,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2285,17 +2477,20 @@ def _run_command_initial( self, resource_group_name: str, resource_name: str, - request_payload: "_models.RunCommandRequest", + request_payload: _models.RunCommandRequest, **kwargs: Any - ) -> Optional["_models.RunCommandResult"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RunCommandResult"]] + ) -> Optional[_models.RunCommandResult]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] _json = self._serialize.body(request_payload, 'RunCommandRequest') @@ -2307,11 +2502,13 @@ def _run_command_initial( content_type=content_type, json=_json, template_url=self._run_command_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2339,9 +2536,9 @@ def begin_run_command( self, resource_group_name: str, resource_name: str, - request_payload: "_models.RunCommandRequest", + request_payload: _models.RunCommandRequest, **kwargs: Any - ) -> LROPoller["_models.RunCommandResult"]: + ) -> LROPoller[_models.RunCommandResult]: """Run Command against Managed Kubernetes Service. Submit a command to run against managed kubernetes service, it will create a pod to run the @@ -2367,37 +2564,47 @@ def begin_run_command( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_03_01.models.RunCommandResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.RunCommandResult] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._run_command_initial( + raw_result = self._run_command_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, request_payload=request_payload, 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): - response = pipeline_response.http_response deserialized = self._deserialize('RunCommandResult', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2417,7 +2624,7 @@ def get_command_result( resource_name: str, command_id: str, **kwargs: Any - ) -> Optional["_models.RunCommandResult"]: + ) -> Optional[_models.RunCommandResult]: """Get command result. Get command result from previous runCommand invoke. @@ -2433,13 +2640,16 @@ def get_command_result( :rtype: ~azure.mgmt.containerservice.v2021_03_01.models.RunCommandResult or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RunCommandResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] request = build_get_command_result_request( @@ -2449,11 +2659,13 @@ def get_command_result( command_id=command_id, api_version=api_version, template_url=self.get_command_result.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/operations/_operations.py index 4ff0d5abbbb9..b37f9ff585df 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/operations/_operations.py @@ -16,6 +16,7 @@ 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 @@ -29,55 +30,54 @@ def build_list_request( **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.ContainerService/operations") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class Operations(object): - """Operations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_03_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_03_01.ContainerServiceClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> Iterable["_models.OperationListResult"]: + ) -> Iterable[_models.OperationListResult]: """Gets a list of compute operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -86,31 +86,38 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_03_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/operations/_private_endpoint_connections_operations.py index d9d7bce5af67..3743dd042fa8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/operations/_private_endpoint_connections_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast from msrest import Serializer @@ -16,13 +16,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -34,9 +34,12 @@ def build_list_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections") # pylint: disable=line-too-long path_format_arguments = { @@ -48,18 +51,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -71,9 +72,12 @@ def build_get_request( private_endpoint_connection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -86,18 +90,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -108,14 +110,17 @@ def build_update_request( resource_name: str, private_endpoint_connection_name: str, *, - json: JSONType = None, + json: Optional[_models.PrivateEndpointConnection] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-03-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -128,20 +133,18 @@ def build_update_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -155,9 +158,12 @@ def build_delete_request_initial( private_endpoint_connection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -170,42 +176,38 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class PrivateEndpointConnectionsOperations(object): - """PrivateEndpointConnectionsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class PrivateEndpointConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_03_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_03_01.ContainerServiceClient`'s + :attr:`private_endpoint_connections` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -213,7 +215,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnectionListResult": + ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. Gets a list of private endpoint connections in the specified managed cluster. The operation @@ -228,13 +230,16 @@ def list( :rtype: ~azure.mgmt.containerservice.v2021_03_01.models.PrivateEndpointConnectionListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] request = build_list_request( @@ -243,11 +248,13 @@ def list( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -275,7 +282,7 @@ def get( resource_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Gets the private endpoint connection. Gets the details of the private endpoint connection by managed cluster and resource group. @@ -291,13 +298,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2021_03_01.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] request = build_get_request( @@ -307,11 +317,13 @@ def get( private_endpoint_connection_name=private_endpoint_connection_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -338,9 +350,9 @@ def update( resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - parameters: "_models.PrivateEndpointConnection", + parameters: _models.PrivateEndpointConnection, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. Updates a private endpoint connection in the specified managed cluster. @@ -358,14 +370,17 @@ def update( :rtype: ~azure.mgmt.containerservice.v2021_03_01.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] _json = self._serialize.body(parameters, 'PrivateEndpointConnection') @@ -378,11 +393,13 @@ def update( content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -410,13 +427,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -426,11 +446,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name=private_endpoint_connection_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -477,21 +499,26 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-03-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -501,8 +528,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/operations/_private_link_resources_operations.py index c989d82716bf..5cdfea5e3eef 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/operations/_private_link_resources_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/operations/_private_link_resources_operations.py @@ -15,6 +15,7 @@ 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 @@ -31,9 +32,12 @@ def build_list_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources") # pylint: disable=line-too-long path_format_arguments = { @@ -45,42 +49,38 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class PrivateLinkResourcesOperations(object): - """PrivateLinkResourcesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class PrivateLinkResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_03_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_03_01.ContainerServiceClient`'s + :attr:`private_link_resources` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -88,7 +88,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.PrivateLinkResourcesListResult": + ) -> _models.PrivateLinkResourcesListResult: """Gets a list of private link resources in the specified managed cluster. Gets a list of private link resources in the specified managed cluster. The operation returns @@ -103,13 +103,16 @@ def list( :rtype: ~azure.mgmt.containerservice.v2021_03_01.models.PrivateLinkResourcesListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourcesListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] request = build_list_request( @@ -118,11 +121,13 @@ def list( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/operations/_resolve_private_link_service_id_operations.py index 445f6e9c99a0..755ff16fe08f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/operations/_resolve_private_link_service_id_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_03_01/operations/_resolve_private_link_service_id_operations.py @@ -15,12 +15,12 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -31,14 +31,17 @@ def build_post_request( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.PrivateLinkResource] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-03-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId") # pylint: disable=line-too-long path_format_arguments = { @@ -50,55 +53,51 @@ def build_post_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs ) -class ResolvePrivateLinkServiceIdOperations(object): - """ResolvePrivateLinkServiceIdOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ResolvePrivateLinkServiceIdOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_03_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_03_01.ContainerServiceClient`'s + :attr:`resolve_private_link_service_id` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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 post( self, resource_group_name: str, resource_name: str, - parameters: "_models.PrivateLinkResource", + parameters: _models.PrivateLinkResource, **kwargs: Any - ) -> "_models.PrivateLinkResource": + ) -> _models.PrivateLinkResource: """Gets the private link service ID for the specified managed cluster. Gets the private link service ID the specified managed cluster. @@ -115,14 +114,17 @@ def post( :rtype: ~azure.mgmt.containerservice.v2021_03_01.models.PrivateLinkResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] _json = self._serialize.body(parameters, 'PrivateLinkResource') @@ -134,11 +136,13 @@ def post( content_type=content_type, json=_json, template_url=self.post.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/__init__.py index 53c675bd95e2..37a5f9e02e6f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._container_service_client import ContainerServiceClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['ContainerServiceClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/_container_service_client.py index d1c05fb1b4e1..675423a21fb2 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/_container_service_client.py @@ -72,13 +72,27 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.managed_clusters = ManagedClustersOperations(self._client, self._config, self._serialize, self._deserialize) - self.maintenance_configurations = MaintenanceConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) - self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) - self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_clusters = ManagedClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.maintenance_configurations = MaintenanceConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.agent_pools = AgentPoolsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/__init__.py index 53c675bd95e2..37a5f9e02e6f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._container_service_client import ContainerServiceClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['ContainerServiceClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/_container_service_client.py index ce14ee96b63e..7b89207043ad 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/_container_service_client.py @@ -73,13 +73,27 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.managed_clusters = ManagedClustersOperations(self._client, self._config, self._serialize, self._deserialize) - self.maintenance_configurations = MaintenanceConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) - self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) - self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_clusters = ManagedClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.maintenance_configurations = MaintenanceConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.agent_pools = AgentPoolsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/operations/__init__.py index 3942e0ca6a01..f0e265d9f2f4 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/operations/__init__.py @@ -14,6 +14,9 @@ from ._private_link_resources_operations import PrivateLinkResourcesOperations from ._resolve_private_link_service_id_operations import ResolvePrivateLinkServiceIdOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'Operations', 'ManagedClustersOperations', @@ -23,3 +26,5 @@ 'PrivateLinkResourcesOperations', 'ResolvePrivateLinkServiceIdOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/operations/_agent_pools_operations.py index f291dbe94000..501cc85d2df5 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/operations/_agent_pools_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. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ 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 @@ -26,26 +27,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class AgentPoolsOperations: - """AgentPoolsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_05_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_05_01.aio.ContainerServiceClient`'s + :attr:`agent_pools` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -53,7 +52,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> AsyncIterable["_models.AgentPoolListResult"]: + ) -> AsyncIterable[_models.AgentPoolListResult]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. @@ -68,13 +67,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_05_01.models.AgentPoolListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-05-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -84,9 +86,11 @@ def prepare_request(next_link=None): resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -96,9 +100,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -138,7 +144,7 @@ async def get( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPool": + ) -> _models.AgentPool: """Gets the specified managed cluster agent pool. Gets the specified managed cluster agent pool. @@ -154,13 +160,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2021_05_01.models.AgentPool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-05-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] request = build_get_request( @@ -170,11 +179,13 @@ async def get( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -200,17 +211,20 @@ async def _create_or_update_initial( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> "_models.AgentPool": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] + ) -> _models.AgentPool: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-05-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] _json = self._serialize.body(parameters, 'AgentPool') @@ -223,11 +237,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -258,9 +274,9 @@ async def begin_create_or_update( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> AsyncLROPoller["_models.AgentPool"]: + ) -> AsyncLROPoller[_models.AgentPool]: """Creates or updates an agent pool in the specified managed cluster. Creates or updates an agent pool in the specified managed cluster. @@ -287,17 +303,20 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_05_01.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-05-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, @@ -305,20 +324,27 @@ async def begin_create_or_update( 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): - response = pipeline_response.http_response deserialized = self._deserialize('AgentPool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -338,13 +364,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements agent_pool_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-05-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -354,11 +383,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -405,21 +436,26 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-05-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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) @@ -429,8 +465,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -450,7 +492,7 @@ async def get_upgrade_profile( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPoolUpgradeProfile": + ) -> _models.AgentPoolUpgradeProfile: """Gets the upgrade profile for an agent pool. Gets the upgrade profile for an agent pool. @@ -466,13 +508,16 @@ async def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2021_05_01.models.AgentPoolUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-05-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] request = build_get_upgrade_profile_request( @@ -482,11 +527,13 @@ async def get_upgrade_profile( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -513,7 +560,7 @@ async def get_available_agent_pool_versions( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.AgentPoolAvailableVersions": + ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported Kubernetes versions for the specified agent pool. See `supported Kubernetes versions @@ -529,13 +576,16 @@ async def get_available_agent_pool_versions( :rtype: ~azure.mgmt.containerservice.v2021_05_01.models.AgentPoolAvailableVersions :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolAvailableVersions"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-05-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] request = build_get_available_agent_pool_versions_request( @@ -544,11 +594,13 @@ async def get_available_agent_pool_versions( resource_name=resource_name, api_version=api_version, template_url=self.get_available_agent_pool_versions.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -575,14 +627,17 @@ async def _upgrade_node_image_version_initial( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> Optional["_models.AgentPool"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.AgentPool"]] + ) -> Optional[_models.AgentPool]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-05-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] request = build_upgrade_node_image_version_request_initial( @@ -592,11 +647,13 @@ async def _upgrade_node_image_version_initial( agent_pool_name=agent_pool_name, api_version=api_version, template_url=self._upgrade_node_image_version_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -626,7 +683,7 @@ async def begin_upgrade_node_image_version( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> AsyncLROPoller["_models.AgentPool"]: + ) -> AsyncLROPoller[_models.AgentPool]: """Upgrades the node image version of an agent pool to the latest. Upgrading the node image version of an agent pool applies the newest OS and runtime updates to @@ -653,35 +710,45 @@ async def begin_upgrade_node_image_version( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_05_01.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-05-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._upgrade_node_image_version_initial( + raw_result = await self._upgrade_node_image_version_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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): - response = pipeline_response.http_response deserialized = self._deserialize('AgentPool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/operations/_maintenance_configurations_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/operations/_maintenance_configurations_operations.py index d049486d2252..51cd7ea9d64e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/operations/_maintenance_configurations_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/operations/_maintenance_configurations_operations.py @@ -15,6 +15,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -24,26 +25,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class MaintenanceConfigurationsOperations: - """MaintenanceConfigurationsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_05_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_05_01.aio.ContainerServiceClient`'s + :attr:`maintenance_configurations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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_by_managed_cluster( @@ -51,7 +50,7 @@ def list_by_managed_cluster( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> AsyncIterable["_models.MaintenanceConfigurationListResult"]: + ) -> AsyncIterable[_models.MaintenanceConfigurationListResult]: """Gets a list of maintenance configurations in the specified managed cluster. Gets a list of maintenance configurations in the specified managed cluster. @@ -67,13 +66,16 @@ def list_by_managed_cluster( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_05_01.models.MaintenanceConfigurationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-05-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfigurationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfigurationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -83,9 +85,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=self.list_by_managed_cluster.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -95,9 +99,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -137,7 +143,7 @@ async def get( resource_name: str, config_name: str, **kwargs: Any - ) -> "_models.MaintenanceConfiguration": + ) -> _models.MaintenanceConfiguration: """Gets the specified maintenance configuration of a managed cluster. Gets the specified maintenance configuration of a managed cluster. @@ -153,13 +159,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2021_05_01.models.MaintenanceConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfiguration"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-05-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] request = build_get_request( @@ -169,11 +178,13 @@ async def get( config_name=config_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -200,9 +211,9 @@ async def create_or_update( resource_group_name: str, resource_name: str, config_name: str, - parameters: "_models.MaintenanceConfiguration", + parameters: _models.MaintenanceConfiguration, **kwargs: Any - ) -> "_models.MaintenanceConfiguration": + ) -> _models.MaintenanceConfiguration: """Creates or updates a maintenance configuration in the specified managed cluster. Creates or updates a maintenance configuration in the specified managed cluster. @@ -220,14 +231,17 @@ async def create_or_update( :rtype: ~azure.mgmt.containerservice.v2021_05_01.models.MaintenanceConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfiguration"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-05-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] _json = self._serialize.body(parameters, 'MaintenanceConfiguration') @@ -240,11 +254,13 @@ async def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -288,13 +304,16 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-05-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -304,11 +323,13 @@ async def delete( # pylint: disable=inconsistent-return-statements config_name=config_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/operations/_managed_clusters_operations.py index b7d265bd8637..6288ec697fba 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/operations/_managed_clusters_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. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ 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 @@ -26,26 +27,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ManagedClustersOperations: # pylint: disable=too-many-public-methods - """ManagedClustersOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_05_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_05_01.aio.ContainerServiceClient`'s + :attr:`managed_clusters` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace_async async def get_os_options( @@ -53,7 +52,7 @@ async def get_os_options( location: str, resource_type: Optional[str] = None, **kwargs: Any - ) -> "_models.OSOptionProfile": + ) -> _models.OSOptionProfile: """Gets supported OS options in the specified subscription. Gets supported OS options in the specified subscription. @@ -68,13 +67,16 @@ async def get_os_options( :rtype: ~azure.mgmt.containerservice.v2021_05_01.models.OSOptionProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OSOptionProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-05-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OSOptionProfile] request = build_get_os_options_request( @@ -83,11 +85,13 @@ async def get_os_options( api_version=api_version, resource_type=resource_type, template_url=self.get_os_options.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -112,7 +116,7 @@ async def get_os_options( def list( self, **kwargs: Any - ) -> AsyncIterable["_models.ManagedClusterListResult"]: + ) -> AsyncIterable[_models.ManagedClusterListResult]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. @@ -124,13 +128,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_05_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-05-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -138,9 +145,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -148,9 +157,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -188,7 +199,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ManagedClusterListResult"]: + ) -> AsyncIterable[_models.ManagedClusterListResult]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. @@ -202,13 +213,16 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_05_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-05-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -217,9 +231,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -228,9 +244,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -269,7 +287,7 @@ async def get_upgrade_profile( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedClusterUpgradeProfile": + ) -> _models.ManagedClusterUpgradeProfile: """Gets the upgrade profile of a managed cluster. Gets the upgrade profile of a managed cluster. @@ -283,13 +301,16 @@ async def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2021_05_01.models.ManagedClusterUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-05-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] request = build_get_upgrade_profile_request( @@ -298,11 +319,13 @@ async def get_upgrade_profile( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -330,7 +353,7 @@ async def get_access_profile( resource_name: str, role_name: str, **kwargs: Any - ) -> "_models.ManagedClusterAccessProfile": + ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. **WARNING**\ : This API will be deprecated. Instead use `ListClusterUserCredentials @@ -349,13 +372,16 @@ async def get_access_profile( :rtype: ~azure.mgmt.containerservice.v2021_05_01.models.ManagedClusterAccessProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterAccessProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-05-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] request = build_get_access_profile_request( @@ -365,11 +391,13 @@ async def get_access_profile( role_name=role_name, api_version=api_version, template_url=self.get_access_profile.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -397,7 +425,7 @@ async def list_cluster_admin_credentials( resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Lists the admin credentials of a managed cluster. Lists the admin credentials of a managed cluster. @@ -413,13 +441,16 @@ async def list_cluster_admin_credentials( :rtype: ~azure.mgmt.containerservice.v2021_05_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-05-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_admin_credentials_request( @@ -429,11 +460,13 @@ async def list_cluster_admin_credentials( api_version=api_version, server_fqdn=server_fqdn, template_url=self.list_cluster_admin_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -461,7 +494,7 @@ async def list_cluster_user_credentials( resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Lists the user credentials of a managed cluster. Lists the user credentials of a managed cluster. @@ -477,13 +510,16 @@ async def list_cluster_user_credentials( :rtype: ~azure.mgmt.containerservice.v2021_05_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-05-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_user_credentials_request( @@ -493,11 +529,13 @@ async def list_cluster_user_credentials( api_version=api_version, server_fqdn=server_fqdn, template_url=self.list_cluster_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -525,7 +563,7 @@ async def list_cluster_monitoring_user_credentials( resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Lists the cluster monitoring user credentials of a managed cluster. Lists the cluster monitoring user credentials of a managed cluster. @@ -541,13 +579,16 @@ async def list_cluster_monitoring_user_credentials( :rtype: ~azure.mgmt.containerservice.v2021_05_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-05-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_monitoring_user_credentials_request( @@ -557,11 +598,13 @@ async def list_cluster_monitoring_user_credentials( api_version=api_version, server_fqdn=server_fqdn, template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -588,7 +631,7 @@ async def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedCluster": + ) -> _models.ManagedCluster: """Gets a managed cluster. Gets a managed cluster. @@ -602,13 +645,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2021_05_01.models.ManagedCluster :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-05-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] request = build_get_request( @@ -617,11 +663,13 @@ async def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -646,17 +694,20 @@ async def _create_or_update_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-05-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'ManagedCluster') @@ -668,11 +719,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -702,9 +755,9 @@ async def begin_create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> AsyncLROPoller["_models.ManagedCluster"]: + ) -> AsyncLROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. Creates or updates a managed cluster. @@ -729,37 +782,47 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_05_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-05-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -776,17 +839,20 @@ async def _update_tags_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-05-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'TagsObject') @@ -798,11 +864,13 @@ async def _update_tags_initial( content_type=content_type, json=_json, template_url=self._update_tags_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -828,9 +896,9 @@ async def begin_update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> AsyncLROPoller["_models.ManagedCluster"]: + ) -> AsyncLROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates tags on a managed cluster. @@ -855,37 +923,47 @@ async def begin_update_tags( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_05_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-05-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._update_tags_initial( + raw_result = await self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -904,13 +982,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-05-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -919,11 +1000,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -967,20 +1050,25 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-05-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_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) @@ -990,8 +1078,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1008,17 +1102,20 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-05-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') @@ -1030,11 +1127,13 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist content_type=content_type, json=_json, template_url=self._reset_service_principal_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1056,7 +1155,7 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> AsyncLROPoller[None]: """Reset the Service Principal Profile of a managed cluster. @@ -1082,23 +1181,28 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-05-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._reset_service_principal_profile_initial( + raw_result = await self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1108,8 +1212,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1126,17 +1236,20 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-05-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') @@ -1148,11 +1261,13 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta content_type=content_type, json=_json, template_url=self._reset_aad_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1174,7 +1289,7 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> AsyncLROPoller[None]: """Reset the AAD Profile of a managed cluster. @@ -1199,23 +1314,28 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-05-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._reset_aad_profile_initial( + raw_result = await self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1225,8 +1345,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1245,13 +1371,16 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-05-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_rotate_cluster_certificates_request_initial( @@ -1260,11 +1389,13 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- resource_name=resource_name, api_version=api_version, template_url=self._rotate_cluster_certificates_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1309,20 +1440,25 @@ async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-ret :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-05-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._rotate_cluster_certificates_initial( + raw_result = await self._rotate_cluster_certificates_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) @@ -1332,8 +1468,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1352,13 +1494,16 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-05-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_stop_request_initial( @@ -1367,11 +1512,13 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_name, api_version=api_version, template_url=self._stop_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1419,20 +1566,25 @@ async def begin_stop( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-05-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._stop_initial( + raw_result = await self._stop_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) @@ -1442,8 +1594,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1462,13 +1620,16 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-05-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_start_request_initial( @@ -1477,11 +1638,13 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_name, api_version=api_version, template_url=self._start_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1526,20 +1689,25 @@ async def begin_start( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-05-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._start_initial( + raw_result = await self._start_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) @@ -1549,8 +1717,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1567,17 +1741,20 @@ async def _run_command_initial( self, resource_group_name: str, resource_name: str, - request_payload: "_models.RunCommandRequest", + request_payload: _models.RunCommandRequest, **kwargs: Any - ) -> Optional["_models.RunCommandResult"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RunCommandResult"]] + ) -> Optional[_models.RunCommandResult]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-05-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] _json = self._serialize.body(request_payload, 'RunCommandRequest') @@ -1589,11 +1766,13 @@ async def _run_command_initial( content_type=content_type, json=_json, template_url=self._run_command_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1621,9 +1800,9 @@ async def begin_run_command( self, resource_group_name: str, resource_name: str, - request_payload: "_models.RunCommandRequest", + request_payload: _models.RunCommandRequest, **kwargs: Any - ) -> AsyncLROPoller["_models.RunCommandResult"]: + ) -> AsyncLROPoller[_models.RunCommandResult]: """Submits a command to run against the Managed Cluster. AKS will create a pod to run the command. This is primarily useful for private clusters. For @@ -1650,37 +1829,47 @@ async def begin_run_command( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_05_01.models.RunCommandResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-05-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.RunCommandResult] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._run_command_initial( + raw_result = await self._run_command_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, request_payload=request_payload, 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): - response = pipeline_response.http_response deserialized = self._deserialize('RunCommandResult', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1700,7 +1889,7 @@ async def get_command_result( resource_name: str, command_id: str, **kwargs: Any - ) -> Optional["_models.RunCommandResult"]: + ) -> Optional[_models.RunCommandResult]: """Gets the results of a command which has been run on the Managed Cluster. Gets the results of a command which has been run on the Managed Cluster. @@ -1716,13 +1905,16 @@ async def get_command_result( :rtype: ~azure.mgmt.containerservice.v2021_05_01.models.RunCommandResult or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RunCommandResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-05-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] request = build_get_command_result_request( @@ -1732,11 +1924,13 @@ async def get_command_result( command_id=command_id, api_version=api_version, template_url=self.get_command_result.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1765,7 +1959,7 @@ def list_outbound_network_dependencies_endpoints( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> AsyncIterable["_models.OutboundEnvironmentEndpointCollection"]: + ) -> AsyncIterable[_models.OutboundEnvironmentEndpointCollection]: """Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. @@ -1783,13 +1977,16 @@ def list_outbound_network_dependencies_endpoints( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_05_01.models.OutboundEnvironmentEndpointCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-05-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OutboundEnvironmentEndpointCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -1799,9 +1996,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=self.list_outbound_network_dependencies_endpoints.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -1811,9 +2010,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/operations/_operations.py index 975b0090603b..328b4bb77ed0 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/operations/_operations.py @@ -14,6 +14,7 @@ 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 @@ -23,32 +24,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class Operations: - """Operations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_05_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_05_01.aio.ContainerServiceClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.OperationListResult"]: + ) -> AsyncIterable[_models.OperationListResult]: """Gets a list of operations. Gets a list of operations. @@ -59,31 +58,38 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_05_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-05-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/operations/_private_endpoint_connections_operations.py index 28090c36197b..962a12681d66 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/operations/_private_endpoint_connections_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -14,6 +14,7 @@ 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 @@ -24,26 +25,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class PrivateEndpointConnectionsOperations: - """PrivateEndpointConnectionsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_05_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_05_01.aio.ContainerServiceClient`'s + :attr:`private_endpoint_connections` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -51,7 +50,7 @@ async def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnectionListResult": + ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. To learn more about private clusters, see: @@ -66,13 +65,16 @@ async def list( :rtype: ~azure.mgmt.containerservice.v2021_05_01.models.PrivateEndpointConnectionListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-05-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] request = build_list_request( @@ -81,11 +83,13 @@ async def list( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -113,7 +117,7 @@ async def get( resource_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Gets the specified private endpoint connection. To learn more about private clusters, see: @@ -130,13 +134,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2021_05_01.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-05-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] request = build_get_request( @@ -146,11 +153,13 @@ async def get( private_endpoint_connection_name=private_endpoint_connection_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -177,9 +186,9 @@ async def update( resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - parameters: "_models.PrivateEndpointConnection", + parameters: _models.PrivateEndpointConnection, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. Updates a private endpoint connection. @@ -197,14 +206,17 @@ async def update( :rtype: ~azure.mgmt.containerservice.v2021_05_01.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-05-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] _json = self._serialize.body(parameters, 'PrivateEndpointConnection') @@ -217,11 +229,13 @@ async def update( content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -249,13 +263,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-05-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -265,11 +282,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name=private_endpoint_connection_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -316,21 +335,26 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-05-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -340,8 +364,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/operations/_private_link_resources_operations.py index ece036469a4d..9049d235536e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/operations/_private_link_resources_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/operations/_private_link_resources_operations.py @@ -13,6 +13,7 @@ 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 @@ -22,26 +23,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class PrivateLinkResourcesOperations: - """PrivateLinkResourcesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_05_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_05_01.aio.ContainerServiceClient`'s + :attr:`private_link_resources` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -49,7 +48,7 @@ async def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.PrivateLinkResourcesListResult": + ) -> _models.PrivateLinkResourcesListResult: """Gets a list of private link resources in the specified managed cluster. To learn more about private clusters, see: @@ -64,13 +63,16 @@ async def list( :rtype: ~azure.mgmt.containerservice.v2021_05_01.models.PrivateLinkResourcesListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourcesListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-05-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] request = build_list_request( @@ -79,11 +81,13 @@ async def list( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/operations/_resolve_private_link_service_id_operations.py index 1e24122cf634..fc8f5bf50aeb 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/operations/_resolve_private_link_service_id_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/aio/operations/_resolve_private_link_service_id_operations.py @@ -13,6 +13,7 @@ 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 @@ -22,35 +23,33 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ResolvePrivateLinkServiceIdOperations: - """ResolvePrivateLinkServiceIdOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_05_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_05_01.aio.ContainerServiceClient`'s + :attr:`resolve_private_link_service_id` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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 post( self, resource_group_name: str, resource_name: str, - parameters: "_models.PrivateLinkResource", + parameters: _models.PrivateLinkResource, **kwargs: Any - ) -> "_models.PrivateLinkResource": + ) -> _models.PrivateLinkResource: """Gets the private link service ID for the specified managed cluster. Gets the private link service ID for the specified managed cluster. @@ -66,14 +65,17 @@ async def post( :rtype: ~azure.mgmt.containerservice.v2021_05_01.models.PrivateLinkResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-05-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] _json = self._serialize.body(parameters, 'PrivateLinkResource') @@ -85,11 +87,13 @@ async def post( content_type=content_type, json=_json, template_url=self.post.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/models/__init__.py index 89a1af66110f..406c73f5c5c8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/models/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/models/__init__.py @@ -120,7 +120,9 @@ UpgradeChannel, WeekDay, ) - +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'AgentPool', 'AgentPoolAvailableVersions', @@ -233,3 +235,5 @@ 'UpgradeChannel', 'WeekDay', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/models/_container_service_client_enums.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/models/_container_service_client_enums.py index 35b63e247154..57806c223c4b 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/models/_container_service_client_enums.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/models/_container_service_client_enums.py @@ -7,11 +7,10 @@ # -------------------------------------------------------------------------- from enum import Enum -from six import with_metaclass from azure.core import CaseInsensitiveEnumMeta -class AgentPoolMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class AgentPoolMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: https://docs.microsoft.com/azure/aks/use-system-pools @@ -24,7 +23,7 @@ class AgentPoolMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: User agent pools are primarily for hosting your application pods. USER = "User" -class AgentPoolType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class AgentPoolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of Agent Pool. """ @@ -33,7 +32,7 @@ class AgentPoolType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Use of this is strongly discouraged. AVAILABILITY_SET = "AvailabilitySet" -class Code(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class Code(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Tells whether the cluster is Running or Stopped """ @@ -42,7 +41,7 @@ class Code(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: The cluster is stopped. STOPPED = "Stopped" -class ConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The private link service connection status. """ @@ -51,7 +50,7 @@ class ConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): REJECTED = "Rejected" DISCONNECTED = "Disconnected" -class ContainerServiceStorageProfileTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Specifies what kind of storage to use. If omitted, the default will be chosen on your behalf based on the choice of orchestrator. """ @@ -59,7 +58,7 @@ class ContainerServiceStorageProfileTypes(with_metaclass(CaseInsensitiveEnumMeta STORAGE_ACCOUNT = "StorageAccount" MANAGED_DISKS = "ManagedDisks" -class ContainerServiceVMSizeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Size of agent VMs. Note: This is no longer maintained. """ @@ -238,7 +237,7 @@ class ContainerServiceVMSizeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, E STANDARD_NV24 = "Standard_NV24" STANDARD_NV6 = "Standard_NV6" -class Count(with_metaclass(CaseInsensitiveEnumMeta, int, Enum)): +class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): """Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, and 5. The default value is 1. """ @@ -247,7 +246,7 @@ class Count(with_metaclass(CaseInsensitiveEnumMeta, int, Enum)): THREE = 3 FIVE = 5 -class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of identity that created the resource. """ @@ -256,7 +255,7 @@ class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class Expander(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class Expander(str, Enum, metaclass=CaseInsensitiveEnumMeta): """If not specified, the default is 'random'. See `expanders `_ for more information. @@ -279,13 +278,13 @@ class Expander(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Used when you don't have a particular need for the node groups to scale differently. RANDOM = "random" -class ExtendedLocationTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ExtendedLocationTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of extendedLocation. """ EDGE_ZONE = "EdgeZone" -class GPUInstanceProfile(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class GPUInstanceProfile(str, Enum, metaclass=CaseInsensitiveEnumMeta): """GPUInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU. """ @@ -295,7 +294,7 @@ class GPUInstanceProfile(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MIG4_G = "MIG4g" MIG7_G = "MIG7g" -class KubeletDiskType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class KubeletDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. """ @@ -305,7 +304,7 @@ class KubeletDiskType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Kubelet will use the temporary disk for its data. TEMPORARY = "Temporary" -class LicenseType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class LicenseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The license type to use for Windows VMs. See `Azure Hybrid User Benefits `_ for more details. """ @@ -315,7 +314,7 @@ class LicenseType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Enables Azure Hybrid User Benefits for Windows VMs. WINDOWS_SERVER = "Windows_Server" -class LoadBalancerSku(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class LoadBalancerSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the differences between load balancer SKUs. @@ -328,7 +327,7 @@ class LoadBalancerSku(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Use a basic Load Balancer with limited functionality. BASIC = "basic" -class ManagedClusterPodIdentityProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ManagedClusterPodIdentityProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The current provisioning state of the pod identity. """ @@ -337,13 +336,13 @@ class ManagedClusterPodIdentityProvisioningState(with_metaclass(CaseInsensitiveE DELETING = "Deleting" FAILED = "Failed" -class ManagedClusterSKUName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ManagedClusterSKUName(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The name of a managed cluster SKU. """ BASIC = "Basic" -class ManagedClusterSKUTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ManagedClusterSKUTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): """If not specified, the default is 'Free'. See `uptime SLA `_ for more details. """ @@ -354,7 +353,7 @@ class ManagedClusterSKUTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: No guaranteed SLA, no additional charges. Free tier clusters have an SLO of 99.5%. FREE = "Free" -class NetworkMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """This cannot be specified if networkPlugin is anything other than 'azure'. """ @@ -365,7 +364,7 @@ class NetworkMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: This is no longer supported. BRIDGE = "bridge" -class NetworkPlugin(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkPlugin(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Network plugin used for building the Kubernetes network. """ @@ -378,7 +377,7 @@ class NetworkPlugin(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: information. KUBENET = "kubenet" -class NetworkPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Network policy used for building the Kubernetes network. """ @@ -391,7 +390,7 @@ class NetworkPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: for more information. AZURE = "azure" -class OSDiskType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OSDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS @@ -407,14 +406,14 @@ class OSDiskType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: provides lower read/write latency, along with faster node scaling and cluster upgrades. EPHEMERAL = "Ephemeral" -class OSSKU(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OSSKU(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Specifies an OS SKU. This value must not be specified if OSType is Windows. """ UBUNTU = "Ubuntu" CBL_MARINER = "CBLMariner" -class OSType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The operating system type. The default is Linux. """ @@ -423,7 +422,7 @@ class OSType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Use Windows. WINDOWS = "Windows" -class OutboundType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OutboundType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type `_. """ @@ -438,7 +437,7 @@ class OutboundType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: `_. USER_DEFINED_ROUTING = "userDefinedRouting" -class PrivateEndpointConnectionProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class PrivateEndpointConnectionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The current provisioning state. """ @@ -447,7 +446,7 @@ class PrivateEndpointConnectionProvisioningState(with_metaclass(CaseInsensitiveE DELETING = "Deleting" FAILED = "Failed" -class ResourceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """For more information see `use managed identities in AKS `_. """ @@ -463,7 +462,7 @@ class ResourceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Do not use a managed identity for the Managed Cluster, service principal will be used instead. NONE = "None" -class ScaleSetEvictionPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The eviction policy specifies what to do with the VM when it is evicted. The default is Delete. For more information about eviction see `spot VMs `_ @@ -476,7 +475,7 @@ class ScaleSetEvictionPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)) #: cause issues with cluster scaling or upgrading. DEALLOCATE = "Deallocate" -class ScaleSetPriority(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ScaleSetPriority(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The Virtual Machine Scale Set priority. """ @@ -486,7 +485,7 @@ class ScaleSetPriority(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Regular VMs will be used. REGULAR = "Regular" -class UpgradeChannel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class UpgradeChannel(str, Enum, metaclass=CaseInsensitiveEnumMeta): """For more information see `setting the AKS cluster auto-upgrade channel `_. """ @@ -516,7 +515,7 @@ class UpgradeChannel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Disables auto-upgrades and keeps the cluster at its current version of Kubernetes. NONE = "none" -class WeekDay(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class WeekDay(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The weekday enum. """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/models/_models_py3.py index 5730b3e0f7bd..81bf7d1d86ef 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/models/_models_py3.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/models/_models_py3.py @@ -7,11 +7,13 @@ # -------------------------------------------------------------------------- import datetime -from typing import Dict, List, Optional, Union +from typing import Dict, List, Optional, TYPE_CHECKING, Union import msrest.serialization -from ._container_service_client_enums import * +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + import __init__ as _models class SubResource(msrest.serialization.Model): @@ -79,11 +81,11 @@ class AgentPool(SubResource): :ivar os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS - `_. Possible values - include: "Managed", "Ephemeral". + `_. Known values are: + "Managed", "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2021_05_01.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Possible values include: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_05_01.models.KubeletDiskType :ivar vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and used. @@ -97,11 +99,11 @@ class AgentPool(SubResource): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2021_05_01.models.OSType - :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Possible values include: "Ubuntu", "CBLMariner". + :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known + values are: "Ubuntu", "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2021_05_01.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. :vartype max_count: int @@ -109,14 +111,13 @@ class AgentPool(SubResource): :vartype min_count: int :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool - :ivar type_properties_type: The type of Agent Pool. Possible values include: + :ivar type_properties_type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :vartype type_properties_type: str or ~azure.mgmt.containerservice.v2021_05_01.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Possible values include: "System", - "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". :vartype mode: str or ~azure.mgmt.containerservice.v2021_05_01.models.AgentPoolMode :ivar orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -148,12 +149,12 @@ class AgentPool(SubResource): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Possible values include: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_05_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Possible values include: "Delete", - "Deallocate". Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_05_01.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which @@ -185,7 +186,7 @@ class AgentPool(SubResource): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2021_05_01.models.GPUInstanceProfile """ @@ -248,36 +249,36 @@ def __init__( count: Optional[int] = None, vm_size: Optional[str] = None, os_disk_size_gb: Optional[int] = None, - os_disk_type: Optional[Union[str, "OSDiskType"]] = None, - kubelet_disk_type: Optional[Union[str, "KubeletDiskType"]] = None, + os_disk_type: Optional[Union[str, "_models.OSDiskType"]] = None, + kubelet_disk_type: Optional[Union[str, "_models.KubeletDiskType"]] = None, vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", - os_sku: Optional[Union[str, "OSSKU"]] = None, + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - type_properties_type: Optional[Union[str, "AgentPoolType"]] = None, - mode: Optional[Union[str, "AgentPoolMode"]] = None, + type_properties_type: Optional[Union[str, "_models.AgentPoolType"]] = None, + mode: Optional[Union[str, "_models.AgentPoolMode"]] = None, orchestrator_version: Optional[str] = None, - upgrade_settings: Optional["AgentPoolUpgradeSettings"] = None, + upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", spot_max_price: Optional[float] = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, proximity_placement_group_id: Optional[str] = None, - kubelet_config: Optional["KubeletConfig"] = None, - linux_os_config: Optional["LinuxOSConfig"] = None, + kubelet_config: Optional["_models.KubeletConfig"] = None, + linux_os_config: Optional["_models.LinuxOSConfig"] = None, enable_encryption_at_host: Optional[bool] = None, enable_ultra_ssd: Optional[bool] = None, enable_fips: Optional[bool] = None, - gpu_instance_profile: Optional[Union[str, "GPUInstanceProfile"]] = None, + gpu_instance_profile: Optional[Union[str, "_models.GPUInstanceProfile"]] = None, **kwargs ): """ @@ -296,11 +297,11 @@ def __init__( :keyword os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS - `_. Possible values - include: "Managed", "Ephemeral". + `_. Known values are: + "Managed", "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2021_05_01.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Possible values include: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_05_01.models.KubeletDiskType :keyword vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and @@ -314,11 +315,11 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2021_05_01.models.OSType :keyword os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Possible values include: "Ubuntu", "CBLMariner". + Known values are: "Ubuntu", "CBLMariner". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2021_05_01.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -326,14 +327,13 @@ def __init__( :paramtype min_count: int :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool - :keyword type_properties_type: The type of Agent Pool. Possible values include: + :keyword type_properties_type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type_properties_type: str or ~azure.mgmt.containerservice.v2021_05_01.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Possible values include: "System", - "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2021_05_01.models.AgentPoolMode :keyword orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -359,12 +359,12 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Possible values include: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_05_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Possible values include: "Delete", - "Deallocate". Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_05_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which @@ -396,7 +396,7 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2021_05_01.models.GPUInstanceProfile @@ -472,7 +472,7 @@ class AgentPoolAvailableVersions(msrest.serialization.Model): def __init__( self, *, - agent_pool_versions: Optional[List["AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem"]] = None, + agent_pool_versions: Optional[List["_models.AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem"]] = None, **kwargs ): """ @@ -549,7 +549,7 @@ class AgentPoolListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["AgentPool"]] = None, + value: Optional[List["_models.AgentPool"]] = None, **kwargs ): """ @@ -576,8 +576,8 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): :vartype type: str :ivar kubernetes_version: Required. The Kubernetes version (major.minor.patch). :vartype kubernetes_version: str - :ivar os_type: Required. The operating system type. The default is Linux. Possible values - include: "Linux", "Windows". Default value: "Linux". + :ivar os_type: Required. The operating system type. The default is Linux. Known values are: + "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2021_05_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -608,16 +608,16 @@ def __init__( self, *, kubernetes_version: str, - os_type: Union[str, "OSType"] = "Linux", - upgrades: Optional[List["AgentPoolUpgradeProfilePropertiesUpgradesItem"]] = None, + os_type: Union[str, "_models.OSType"] = "Linux", + upgrades: Optional[List["_models.AgentPoolUpgradeProfilePropertiesUpgradesItem"]] = None, latest_node_image_version: Optional[str] = None, **kwargs ): """ :keyword kubernetes_version: Required. The Kubernetes version (major.minor.patch). :paramtype kubernetes_version: str - :keyword os_type: Required. The operating system type. The default is Linux. Possible values - include: "Linux", "Windows". Default value: "Linux". + :keyword os_type: Required. The operating system type. The default is Linux. Known values are: + "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2021_05_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: @@ -729,7 +729,7 @@ def __init__( code: Optional[str] = None, message: Optional[str] = None, target: Optional[str] = None, - details: Optional[List["CloudErrorBody"]] = None, + details: Optional[List["_models.CloudErrorBody"]] = None, **kwargs ): """ @@ -889,29 +889,29 @@ class Components1Q1Og48SchemasManagedclusterAllof1(msrest.serialization.Model): def __init__( self, *, - identity: Optional["ManagedClusterIdentity"] = None, + identity: Optional["_models.ManagedClusterIdentity"] = None, kubernetes_version: Optional[str] = None, dns_prefix: Optional[str] = None, fqdn_subdomain: Optional[str] = None, - agent_pool_profiles: Optional[List["ManagedClusterAgentPoolProfile"]] = None, - linux_profile: Optional["ContainerServiceLinuxProfile"] = None, - windows_profile: Optional["ManagedClusterWindowsProfile"] = None, - service_principal_profile: Optional["ManagedClusterServicePrincipalProfile"] = None, - addon_profiles: Optional[Dict[str, "ManagedClusterAddonProfile"]] = None, - pod_identity_profile: Optional["ManagedClusterPodIdentityProfile"] = None, + agent_pool_profiles: Optional[List["_models.ManagedClusterAgentPoolProfile"]] = None, + linux_profile: Optional["_models.ContainerServiceLinuxProfile"] = None, + windows_profile: Optional["_models.ManagedClusterWindowsProfile"] = None, + service_principal_profile: Optional["_models.ManagedClusterServicePrincipalProfile"] = None, + addon_profiles: Optional[Dict[str, "_models.ManagedClusterAddonProfile"]] = None, + pod_identity_profile: Optional["_models.ManagedClusterPodIdentityProfile"] = None, node_resource_group: Optional[str] = None, enable_rbac: Optional[bool] = None, enable_pod_security_policy: Optional[bool] = None, - network_profile: Optional["ContainerServiceNetworkProfile"] = None, - aad_profile: Optional["ManagedClusterAADProfile"] = None, - auto_upgrade_profile: Optional["ManagedClusterAutoUpgradeProfile"] = None, - auto_scaler_profile: Optional["ManagedClusterPropertiesAutoScalerProfile"] = None, - api_server_access_profile: Optional["ManagedClusterAPIServerAccessProfile"] = None, + network_profile: Optional["_models.ContainerServiceNetworkProfile"] = None, + aad_profile: Optional["_models.ManagedClusterAADProfile"] = None, + auto_upgrade_profile: Optional["_models.ManagedClusterAutoUpgradeProfile"] = None, + auto_scaler_profile: Optional["_models.ManagedClusterPropertiesAutoScalerProfile"] = None, + api_server_access_profile: Optional["_models.ManagedClusterAPIServerAccessProfile"] = None, disk_encryption_set_id: Optional[str] = None, - identity_profile: Optional[Dict[str, "ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties"]] = None, - private_link_resources: Optional[List["PrivateLinkResource"]] = None, + identity_profile: Optional[Dict[str, "_models.ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties"]] = None, + private_link_resources: Optional[List["_models.PrivateLinkResource"]] = None, disable_local_accounts: Optional[bool] = None, - http_proxy_config: Optional["ManagedClusterHTTPProxyConfig"] = None, + http_proxy_config: Optional["_models.ManagedClusterHTTPProxyConfig"] = None, **kwargs ): """ @@ -1150,7 +1150,7 @@ class ContainerServiceDiagnosticsProfile(msrest.serialization.Model): def __init__( self, *, - vm_diagnostics: "ContainerServiceVMDiagnostics", + vm_diagnostics: "_models.ContainerServiceVMDiagnostics", **kwargs ): """ @@ -1187,7 +1187,7 @@ def __init__( self, *, admin_username: str, - ssh: "ContainerServiceSshConfiguration", + ssh: "_models.ContainerServiceSshConfiguration", **kwargs ): """ @@ -1210,17 +1210,17 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar count: Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, - and 5. The default value is 1. Possible values include: 1, 3, 5. Default value: "1". + and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". :vartype count: int or ~azure.mgmt.containerservice.v2021_05_01.models.Count :ivar dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. :vartype dns_prefix: str - :ivar vm_size: Required. Size of agent VMs. Possible values include: "Standard_A1", - "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", - "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", - "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", - "Standard_A8m_v2", "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", - "Standard_B8ms", "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", - "Standard_D12", "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", + :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", + "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", + "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", + "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", "Standard_B8ms", + "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", "Standard_D12", + "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", "Standard_D13_v2_Promo", "Standard_D14", "Standard_D14_v2", "Standard_D14_v2_Promo", "Standard_D15_v2", "Standard_D16_v3", "Standard_D16s_v3", "Standard_D1_v2", "Standard_D2", "Standard_D2_v2", "Standard_D2_v2_Promo", "Standard_D2_v3", "Standard_D2s_v3", "Standard_D3", @@ -1265,7 +1265,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): :vartype first_consecutive_static_ip: str :ivar storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Possible values include: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". :vartype storage_profile: str or ~azure.mgmt.containerservice.v2021_05_01.models.ContainerServiceStorageProfileTypes :ivar fqdn: FQDN for the master pool. @@ -1294,27 +1294,27 @@ def __init__( self, *, dns_prefix: str, - vm_size: Union[str, "ContainerServiceVMSizeTypes"], - count: Optional[Union[int, "Count"]] = 1, + vm_size: Union[str, "_models.ContainerServiceVMSizeTypes"], + count: Optional[Union[int, "_models.Count"]] = 1, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, first_consecutive_static_ip: Optional[str] = "10.240.255.5", - storage_profile: Optional[Union[str, "ContainerServiceStorageProfileTypes"]] = None, + storage_profile: Optional[Union[str, "_models.ContainerServiceStorageProfileTypes"]] = None, **kwargs ): """ :keyword count: Number of masters (VMs) in the container service cluster. Allowed values are 1, - 3, and 5. The default value is 1. Possible values include: 1, 3, 5. Default value: "1". + 3, and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". :paramtype count: int or ~azure.mgmt.containerservice.v2021_05_01.models.Count :keyword dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. :paramtype dns_prefix: str - :keyword vm_size: Required. Size of agent VMs. Possible values include: "Standard_A1", - "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", - "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", - "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", - "Standard_A8m_v2", "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", - "Standard_B8ms", "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", - "Standard_D12", "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", + :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", + "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", + "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", + "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", "Standard_B8ms", + "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", "Standard_D12", + "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", "Standard_D13_v2_Promo", "Standard_D14", "Standard_D14_v2", "Standard_D14_v2_Promo", "Standard_D15_v2", "Standard_D16_v3", "Standard_D16s_v3", "Standard_D1_v2", "Standard_D2", "Standard_D2_v2", "Standard_D2_v2_Promo", "Standard_D2_v3", "Standard_D2s_v3", "Standard_D3", @@ -1359,7 +1359,7 @@ def __init__( :paramtype first_consecutive_static_ip: str :keyword storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Possible values include: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". :paramtype storage_profile: str or ~azure.mgmt.containerservice.v2021_05_01.models.ContainerServiceStorageProfileTypes """ @@ -1377,14 +1377,14 @@ def __init__( class ContainerServiceNetworkProfile(msrest.serialization.Model): """Profile of network configuration. - :ivar network_plugin: Network plugin used for building the Kubernetes network. Possible values - include: "azure", "kubenet". Default value: "kubenet". + :ivar network_plugin: Network plugin used for building the Kubernetes network. Known values + are: "azure", "kubenet". Default value: "kubenet". :vartype network_plugin: str or ~azure.mgmt.containerservice.v2021_05_01.models.NetworkPlugin - :ivar network_policy: Network policy used for building the Kubernetes network. Possible values - include: "calico", "azure". + :ivar network_policy: Network policy used for building the Kubernetes network. Known values + are: "calico", "azure". :vartype network_policy: str or ~azure.mgmt.containerservice.v2021_05_01.models.NetworkPolicy :ivar network_mode: This cannot be specified if networkPlugin is anything other than 'azure'. - Possible values include: "transparent", "bridge". + Known values are: "transparent", "bridge". :vartype network_mode: str or ~azure.mgmt.containerservice.v2021_05_01.models.NetworkMode :ivar pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :vartype pod_cidr: str @@ -1399,12 +1399,12 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): :vartype docker_bridge_cidr: str :ivar outbound_type: This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type - `_. Possible values include: - "loadBalancer", "userDefinedRouting". Default value: "loadBalancer". + `_. Known values are: "loadBalancer", + "userDefinedRouting". Default value: "loadBalancer". :vartype outbound_type: str or ~azure.mgmt.containerservice.v2021_05_01.models.OutboundType :ivar load_balancer_sku: The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the - differences between load balancer SKUs. Possible values include: "standard", "basic". + differences between load balancer SKUs. Known values are: "standard", "basic". :vartype load_balancer_sku: str or ~azure.mgmt.containerservice.v2021_05_01.models.LoadBalancerSku :ivar load_balancer_profile: Profile of the cluster load balancer. @@ -1435,27 +1435,27 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): def __init__( self, *, - network_plugin: Optional[Union[str, "NetworkPlugin"]] = "kubenet", - network_policy: Optional[Union[str, "NetworkPolicy"]] = None, - network_mode: Optional[Union[str, "NetworkMode"]] = None, + network_plugin: Optional[Union[str, "_models.NetworkPlugin"]] = "kubenet", + network_policy: Optional[Union[str, "_models.NetworkPolicy"]] = None, + network_mode: Optional[Union[str, "_models.NetworkMode"]] = None, pod_cidr: Optional[str] = "10.244.0.0/16", service_cidr: Optional[str] = "10.0.0.0/16", dns_service_ip: Optional[str] = "10.0.0.10", docker_bridge_cidr: Optional[str] = "172.17.0.1/16", - outbound_type: Optional[Union[str, "OutboundType"]] = "loadBalancer", - load_balancer_sku: Optional[Union[str, "LoadBalancerSku"]] = None, - load_balancer_profile: Optional["ManagedClusterLoadBalancerProfile"] = None, + outbound_type: Optional[Union[str, "_models.OutboundType"]] = "loadBalancer", + load_balancer_sku: Optional[Union[str, "_models.LoadBalancerSku"]] = None, + load_balancer_profile: Optional["_models.ManagedClusterLoadBalancerProfile"] = None, **kwargs ): """ - :keyword network_plugin: Network plugin used for building the Kubernetes network. Possible - values include: "azure", "kubenet". Default value: "kubenet". + :keyword network_plugin: Network plugin used for building the Kubernetes network. Known values + are: "azure", "kubenet". Default value: "kubenet". :paramtype network_plugin: str or ~azure.mgmt.containerservice.v2021_05_01.models.NetworkPlugin - :keyword network_policy: Network policy used for building the Kubernetes network. Possible - values include: "calico", "azure". + :keyword network_policy: Network policy used for building the Kubernetes network. Known values + are: "calico", "azure". :paramtype network_policy: str or ~azure.mgmt.containerservice.v2021_05_01.models.NetworkPolicy :keyword network_mode: This cannot be specified if networkPlugin is anything other than - 'azure'. Possible values include: "transparent", "bridge". + 'azure'. Known values are: "transparent", "bridge". :paramtype network_mode: str or ~azure.mgmt.containerservice.v2021_05_01.models.NetworkMode :keyword pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :paramtype pod_cidr: str @@ -1470,12 +1470,12 @@ def __init__( :paramtype docker_bridge_cidr: str :keyword outbound_type: This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type - `_. Possible values include: - "loadBalancer", "userDefinedRouting". Default value: "loadBalancer". + `_. Known values are: "loadBalancer", + "userDefinedRouting". Default value: "loadBalancer". :paramtype outbound_type: str or ~azure.mgmt.containerservice.v2021_05_01.models.OutboundType :keyword load_balancer_sku: The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the - differences between load balancer SKUs. Possible values include: "standard", "basic". + differences between load balancer SKUs. Known values are: "standard", "basic". :paramtype load_balancer_sku: str or ~azure.mgmt.containerservice.v2021_05_01.models.LoadBalancerSku :keyword load_balancer_profile: Profile of the cluster load balancer. @@ -1517,7 +1517,7 @@ class ContainerServiceSshConfiguration(msrest.serialization.Model): def __init__( self, *, - public_keys: List["ContainerServiceSshPublicKey"], + public_keys: List["_models.ContainerServiceSshPublicKey"], **kwargs ): """ @@ -1678,7 +1678,7 @@ def __init__( self, *, domain_name: Optional[str] = None, - endpoint_details: Optional[List["EndpointDetail"]] = None, + endpoint_details: Optional[List["_models.EndpointDetail"]] = None, **kwargs ): """ @@ -1744,7 +1744,7 @@ class ExtendedLocation(msrest.serialization.Model): :ivar name: The name of the extended location. :vartype name: str - :ivar type: The type of the extended location. Possible values include: "EdgeZone". + :ivar type: The type of the extended location. Known values are: "EdgeZone". :vartype type: str or ~azure.mgmt.containerservice.v2021_05_01.models.ExtendedLocationTypes """ @@ -1757,13 +1757,13 @@ def __init__( self, *, name: Optional[str] = None, - type: Optional[Union[str, "ExtendedLocationTypes"]] = None, + type: Optional[Union[str, "_models.ExtendedLocationTypes"]] = None, **kwargs ): """ :keyword name: The name of the extended location. :paramtype name: str - :keyword type: The type of the extended location. Possible values include: "EdgeZone". + :keyword type: The type of the extended location. Known values are: "EdgeZone". :paramtype type: str or ~azure.mgmt.containerservice.v2021_05_01.models.ExtendedLocationTypes """ super(ExtendedLocation, self).__init__(**kwargs) @@ -1922,7 +1922,7 @@ class LinuxOSConfig(msrest.serialization.Model): def __init__( self, *, - sysctls: Optional["SysctlConfig"] = None, + sysctls: Optional["_models.SysctlConfig"] = None, transparent_huge_page_enabled: Optional[str] = None, transparent_huge_page_defrag: Optional[str] = None, swap_file_size_mb: Optional[int] = None, @@ -1990,8 +1990,8 @@ class MaintenanceConfiguration(SubResource): def __init__( self, *, - time_in_week: Optional[List["TimeInWeek"]] = None, - not_allowed_time: Optional[List["TimeSpan"]] = None, + time_in_week: Optional[List["_models.TimeInWeek"]] = None, + not_allowed_time: Optional[List["_models.TimeSpan"]] = None, **kwargs ): """ @@ -2030,7 +2030,7 @@ class MaintenanceConfigurationListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["MaintenanceConfiguration"]] = None, + value: Optional[List["_models.MaintenanceConfiguration"]] = None, **kwargs ): """ @@ -2263,32 +2263,32 @@ def __init__( self, *, location: str, - identity: Optional["ManagedClusterIdentity"] = None, + identity: Optional["_models.ManagedClusterIdentity"] = None, kubernetes_version: Optional[str] = None, dns_prefix: Optional[str] = None, fqdn_subdomain: Optional[str] = None, - agent_pool_profiles: Optional[List["ManagedClusterAgentPoolProfile"]] = None, - linux_profile: Optional["ContainerServiceLinuxProfile"] = None, - windows_profile: Optional["ManagedClusterWindowsProfile"] = None, - service_principal_profile: Optional["ManagedClusterServicePrincipalProfile"] = None, - addon_profiles: Optional[Dict[str, "ManagedClusterAddonProfile"]] = None, - pod_identity_profile: Optional["ManagedClusterPodIdentityProfile"] = None, + agent_pool_profiles: Optional[List["_models.ManagedClusterAgentPoolProfile"]] = None, + linux_profile: Optional["_models.ContainerServiceLinuxProfile"] = None, + windows_profile: Optional["_models.ManagedClusterWindowsProfile"] = None, + service_principal_profile: Optional["_models.ManagedClusterServicePrincipalProfile"] = None, + addon_profiles: Optional[Dict[str, "_models.ManagedClusterAddonProfile"]] = None, + pod_identity_profile: Optional["_models.ManagedClusterPodIdentityProfile"] = None, node_resource_group: Optional[str] = None, enable_rbac: Optional[bool] = None, enable_pod_security_policy: Optional[bool] = None, - network_profile: Optional["ContainerServiceNetworkProfile"] = None, - aad_profile: Optional["ManagedClusterAADProfile"] = None, - auto_upgrade_profile: Optional["ManagedClusterAutoUpgradeProfile"] = None, - auto_scaler_profile: Optional["ManagedClusterPropertiesAutoScalerProfile"] = None, - api_server_access_profile: Optional["ManagedClusterAPIServerAccessProfile"] = None, + network_profile: Optional["_models.ContainerServiceNetworkProfile"] = None, + aad_profile: Optional["_models.ManagedClusterAADProfile"] = None, + auto_upgrade_profile: Optional["_models.ManagedClusterAutoUpgradeProfile"] = None, + auto_scaler_profile: Optional["_models.ManagedClusterPropertiesAutoScalerProfile"] = None, + api_server_access_profile: Optional["_models.ManagedClusterAPIServerAccessProfile"] = None, disk_encryption_set_id: Optional[str] = None, - identity_profile: Optional[Dict[str, "ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties"]] = None, - private_link_resources: Optional[List["PrivateLinkResource"]] = None, + identity_profile: Optional[Dict[str, "_models.ComponentsQit0EtSchemasManagedclusterpropertiesPropertiesIdentityprofileAdditionalproperties"]] = None, + private_link_resources: Optional[List["_models.PrivateLinkResource"]] = None, disable_local_accounts: Optional[bool] = None, - http_proxy_config: Optional["ManagedClusterHTTPProxyConfig"] = None, + http_proxy_config: Optional["_models.ManagedClusterHTTPProxyConfig"] = None, tags: Optional[Dict[str, str]] = None, - sku: Optional["ManagedClusterSKU"] = None, - extended_location: Optional["ExtendedLocation"] = None, + sku: Optional["_models.ManagedClusterSKU"] = None, + extended_location: Optional["_models.ExtendedLocation"] = None, **kwargs ): """ @@ -2644,11 +2644,11 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS - `_. Possible values - include: "Managed", "Ephemeral". + `_. Known values are: + "Managed", "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2021_05_01.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Possible values include: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_05_01.models.KubeletDiskType :ivar vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and used. @@ -2662,11 +2662,11 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2021_05_01.models.OSType - :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Possible values include: "Ubuntu", "CBLMariner". + :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known + values are: "Ubuntu", "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2021_05_01.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. :vartype max_count: int @@ -2674,13 +2674,12 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :vartype min_count: int :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool - :ivar type: The type of Agent Pool. Possible values include: "VirtualMachineScaleSets", + :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2021_05_01.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Possible values include: "System", - "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". :vartype mode: str or ~azure.mgmt.containerservice.v2021_05_01.models.AgentPoolMode :ivar orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -2712,12 +2711,12 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Possible values include: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_05_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Possible values include: "Delete", - "Deallocate". Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_05_01.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which @@ -2749,7 +2748,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2021_05_01.models.GPUInstanceProfile """ @@ -2806,36 +2805,36 @@ def __init__( count: Optional[int] = None, vm_size: Optional[str] = None, os_disk_size_gb: Optional[int] = None, - os_disk_type: Optional[Union[str, "OSDiskType"]] = None, - kubelet_disk_type: Optional[Union[str, "KubeletDiskType"]] = None, + os_disk_type: Optional[Union[str, "_models.OSDiskType"]] = None, + kubelet_disk_type: Optional[Union[str, "_models.KubeletDiskType"]] = None, vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", - os_sku: Optional[Union[str, "OSSKU"]] = None, + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - type: Optional[Union[str, "AgentPoolType"]] = None, - mode: Optional[Union[str, "AgentPoolMode"]] = None, + type: Optional[Union[str, "_models.AgentPoolType"]] = None, + mode: Optional[Union[str, "_models.AgentPoolMode"]] = None, orchestrator_version: Optional[str] = None, - upgrade_settings: Optional["AgentPoolUpgradeSettings"] = None, + upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", spot_max_price: Optional[float] = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, proximity_placement_group_id: Optional[str] = None, - kubelet_config: Optional["KubeletConfig"] = None, - linux_os_config: Optional["LinuxOSConfig"] = None, + kubelet_config: Optional["_models.KubeletConfig"] = None, + linux_os_config: Optional["_models.LinuxOSConfig"] = None, enable_encryption_at_host: Optional[bool] = None, enable_ultra_ssd: Optional[bool] = None, enable_fips: Optional[bool] = None, - gpu_instance_profile: Optional[Union[str, "GPUInstanceProfile"]] = None, + gpu_instance_profile: Optional[Union[str, "_models.GPUInstanceProfile"]] = None, **kwargs ): """ @@ -2854,11 +2853,11 @@ def __init__( :keyword os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS - `_. Possible values - include: "Managed", "Ephemeral". + `_. Known values are: + "Managed", "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2021_05_01.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Possible values include: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_05_01.models.KubeletDiskType :keyword vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and @@ -2872,11 +2871,11 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2021_05_01.models.OSType :keyword os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Possible values include: "Ubuntu", "CBLMariner". + Known values are: "Ubuntu", "CBLMariner". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2021_05_01.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -2884,13 +2883,12 @@ def __init__( :paramtype min_count: int :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool - :keyword type: The type of Agent Pool. Possible values include: "VirtualMachineScaleSets", + :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2021_05_01.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Possible values include: "System", - "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2021_05_01.models.AgentPoolMode :keyword orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -2916,12 +2914,12 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Possible values include: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_05_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Possible values include: "Delete", - "Deallocate". Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_05_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which @@ -2953,7 +2951,7 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2021_05_01.models.GPUInstanceProfile @@ -3019,11 +3017,11 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS - `_. Possible values - include: "Managed", "Ephemeral". + `_. Known values are: + "Managed", "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2021_05_01.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Possible values include: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_05_01.models.KubeletDiskType :ivar vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and used. @@ -3037,11 +3035,11 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2021_05_01.models.OSType - :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Possible values include: "Ubuntu", "CBLMariner". + :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known + values are: "Ubuntu", "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2021_05_01.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. :vartype max_count: int @@ -3049,13 +3047,12 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :vartype min_count: int :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool - :ivar type: The type of Agent Pool. Possible values include: "VirtualMachineScaleSets", + :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2021_05_01.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Possible values include: "System", - "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". :vartype mode: str or ~azure.mgmt.containerservice.v2021_05_01.models.AgentPoolMode :ivar orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -3087,12 +3084,12 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Possible values include: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_05_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Possible values include: "Delete", - "Deallocate". Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_05_01.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which @@ -3124,7 +3121,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2021_05_01.models.GPUInstanceProfile :ivar name: Required. Windows agent pool names must be 6 characters or less. @@ -3186,36 +3183,36 @@ def __init__( count: Optional[int] = None, vm_size: Optional[str] = None, os_disk_size_gb: Optional[int] = None, - os_disk_type: Optional[Union[str, "OSDiskType"]] = None, - kubelet_disk_type: Optional[Union[str, "KubeletDiskType"]] = None, + os_disk_type: Optional[Union[str, "_models.OSDiskType"]] = None, + kubelet_disk_type: Optional[Union[str, "_models.KubeletDiskType"]] = None, vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", - os_sku: Optional[Union[str, "OSSKU"]] = None, + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - type: Optional[Union[str, "AgentPoolType"]] = None, - mode: Optional[Union[str, "AgentPoolMode"]] = None, + type: Optional[Union[str, "_models.AgentPoolType"]] = None, + mode: Optional[Union[str, "_models.AgentPoolMode"]] = None, orchestrator_version: Optional[str] = None, - upgrade_settings: Optional["AgentPoolUpgradeSettings"] = None, + upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", spot_max_price: Optional[float] = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, proximity_placement_group_id: Optional[str] = None, - kubelet_config: Optional["KubeletConfig"] = None, - linux_os_config: Optional["LinuxOSConfig"] = None, + kubelet_config: Optional["_models.KubeletConfig"] = None, + linux_os_config: Optional["_models.LinuxOSConfig"] = None, enable_encryption_at_host: Optional[bool] = None, enable_ultra_ssd: Optional[bool] = None, enable_fips: Optional[bool] = None, - gpu_instance_profile: Optional[Union[str, "GPUInstanceProfile"]] = None, + gpu_instance_profile: Optional[Union[str, "_models.GPUInstanceProfile"]] = None, **kwargs ): """ @@ -3234,11 +3231,11 @@ def __init__( :keyword os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS - `_. Possible values - include: "Managed", "Ephemeral". + `_. Known values are: + "Managed", "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2021_05_01.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Possible values include: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_05_01.models.KubeletDiskType :keyword vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and @@ -3252,11 +3249,11 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2021_05_01.models.OSType :keyword os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Possible values include: "Ubuntu", "CBLMariner". + Known values are: "Ubuntu", "CBLMariner". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2021_05_01.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -3264,13 +3261,12 @@ def __init__( :paramtype min_count: int :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool - :keyword type: The type of Agent Pool. Possible values include: "VirtualMachineScaleSets", + :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2021_05_01.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Possible values include: "System", - "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2021_05_01.models.AgentPoolMode :keyword orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -3296,12 +3292,12 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Possible values include: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_05_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Possible values include: "Delete", - "Deallocate". Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_05_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which @@ -3333,7 +3329,7 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2021_05_01.models.GPUInstanceProfile @@ -3408,8 +3404,8 @@ class ManagedClusterAutoUpgradeProfile(msrest.serialization.Model): """Auto upgrade profile for a managed cluster. :ivar upgrade_channel: For more information see `setting the AKS cluster auto-upgrade channel - `_. Possible - values include: "rapid", "stable", "patch", "node-image", "none". + `_. Known values + are: "rapid", "stable", "patch", "node-image", "none". :vartype upgrade_channel: str or ~azure.mgmt.containerservice.v2021_05_01.models.UpgradeChannel """ @@ -3420,13 +3416,13 @@ class ManagedClusterAutoUpgradeProfile(msrest.serialization.Model): def __init__( self, *, - upgrade_channel: Optional[Union[str, "UpgradeChannel"]] = None, + upgrade_channel: Optional[Union[str, "_models.UpgradeChannel"]] = None, **kwargs ): """ :keyword upgrade_channel: For more information see `setting the AKS cluster auto-upgrade channel `_. - Possible values include: "rapid", "stable", "patch", "node-image", "none". + Known values are: "rapid", "stable", "patch", "node-image", "none". :paramtype upgrade_channel: str or ~azure.mgmt.containerservice.v2021_05_01.models.UpgradeChannel """ @@ -3492,7 +3488,7 @@ class ManagedClusterIdentity(msrest.serialization.Model): components. :vartype tenant_id: str :ivar type: For more information see `use managed identities in AKS - `_. Possible values include: + `_. Known values are: "SystemAssigned", "UserAssigned", "None". :vartype type: str or ~azure.mgmt.containerservice.v2021_05_01.models.ResourceIdentityType :ivar user_assigned_identities: The keys must be ARM resource IDs in the form: @@ -3516,13 +3512,13 @@ class ManagedClusterIdentity(msrest.serialization.Model): def __init__( self, *, - type: Optional[Union[str, "ResourceIdentityType"]] = None, - user_assigned_identities: Optional[Dict[str, "Components1Umhcm8SchemasManagedclusteridentityPropertiesUserassignedidentitiesAdditionalproperties"]] = None, + type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, + user_assigned_identities: Optional[Dict[str, "_models.Components1Umhcm8SchemasManagedclusteridentityPropertiesUserassignedidentitiesAdditionalproperties"]] = None, **kwargs ): """ :keyword type: For more information see `use managed identities in AKS - `_. Possible values include: + `_. Known values are: "SystemAssigned", "UserAssigned", "None". :paramtype type: str or ~azure.mgmt.containerservice.v2021_05_01.models.ResourceIdentityType :keyword user_assigned_identities: The keys must be ARM resource IDs in the form: @@ -3560,7 +3556,7 @@ class ManagedClusterListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["ManagedCluster"]] = None, + value: Optional[List["_models.ManagedCluster"]] = None, **kwargs ): """ @@ -3614,10 +3610,10 @@ class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): def __init__( self, *, - managed_outbound_i_ps: Optional["ManagedClusterLoadBalancerProfileManagedOutboundIPs"] = None, - outbound_ip_prefixes: Optional["ManagedClusterLoadBalancerProfileOutboundIPPrefixes"] = None, - outbound_i_ps: Optional["ManagedClusterLoadBalancerProfileOutboundIPs"] = None, - effective_outbound_i_ps: Optional[List["ResourceReference"]] = None, + managed_outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileManagedOutboundIPs"] = None, + outbound_ip_prefixes: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPPrefixes"] = None, + outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPs"] = None, + effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, allocated_outbound_ports: Optional[int] = 0, idle_timeout_in_minutes: Optional[int] = 30, **kwargs @@ -3701,7 +3697,7 @@ class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.M def __init__( self, *, - public_ip_prefixes: Optional[List["ResourceReference"]] = None, + public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, **kwargs ): """ @@ -3727,7 +3723,7 @@ class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): def __init__( self, *, - public_i_ps: Optional[List["ResourceReference"]] = None, + public_i_ps: Optional[List["_models.ResourceReference"]] = None, **kwargs ): """ @@ -3753,8 +3749,8 @@ class ManagedClusterPodIdentity(msrest.serialization.Model): :vartype binding_selector: str :ivar identity: Required. The user assigned identity details. :vartype identity: ~azure.mgmt.containerservice.v2021_05_01.models.UserAssignedIdentity - :ivar provisioning_state: The current provisioning state of the pod identity. Possible values - include: "Assigned", "Updating", "Deleting", "Failed". + :ivar provisioning_state: The current provisioning state of the pod identity. Known values are: + "Assigned", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2021_05_01.models.ManagedClusterPodIdentityProvisioningState :ivar provisioning_info: @@ -3784,7 +3780,7 @@ def __init__( *, name: str, namespace: str, - identity: "UserAssignedIdentity", + identity: "_models.UserAssignedIdentity", binding_selector: Optional[str] = None, **kwargs ): @@ -3885,8 +3881,8 @@ def __init__( *, enabled: Optional[bool] = None, allow_network_plugin_kubenet: Optional[bool] = None, - user_assigned_identities: Optional[List["ManagedClusterPodIdentity"]] = None, - user_assigned_identity_exceptions: Optional[List["ManagedClusterPodIdentityException"]] = None, + user_assigned_identities: Optional[List["_models.ManagedClusterPodIdentity"]] = None, + user_assigned_identity_exceptions: Optional[List["_models.ManagedClusterPodIdentityException"]] = None, **kwargs ): """ @@ -3927,7 +3923,7 @@ class ManagedClusterPodIdentityProvisioningError(msrest.serialization.Model): def __init__( self, *, - error: Optional["ManagedClusterPodIdentityProvisioningErrorBody"] = None, + error: Optional["_models.ManagedClusterPodIdentityProvisioningErrorBody"] = None, **kwargs ): """ @@ -3969,7 +3965,7 @@ def __init__( code: Optional[str] = None, message: Optional[str] = None, target: Optional[str] = None, - details: Optional[List["ManagedClusterPodIdentityProvisioningErrorBody"]] = None, + details: Optional[List["_models.ManagedClusterPodIdentityProvisioningErrorBody"]] = None, **kwargs ): """ @@ -4008,7 +4004,7 @@ class ManagedClusterPodIdentityProvisioningInfo(msrest.serialization.Model): def __init__( self, *, - error: Optional["ManagedClusterPodIdentityProvisioningError"] = None, + error: Optional["_models.ManagedClusterPodIdentityProvisioningError"] = None, **kwargs ): """ @@ -4029,8 +4025,8 @@ class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): :vartype kubernetes_version: str :ivar name: The Agent Pool name. :vartype name: str - :ivar os_type: Required. The operating system type. The default is Linux. Possible values - include: "Linux", "Windows". Default value: "Linux". + :ivar os_type: Required. The operating system type. The default is Linux. Known values are: + "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2021_05_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -4053,9 +4049,9 @@ def __init__( self, *, kubernetes_version: str, - os_type: Union[str, "OSType"] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", name: Optional[str] = None, - upgrades: Optional[List["ManagedClusterPoolUpgradeProfileUpgradesItem"]] = None, + upgrades: Optional[List["_models.ManagedClusterPoolUpgradeProfileUpgradesItem"]] = None, **kwargs ): """ @@ -4063,8 +4059,8 @@ def __init__( :paramtype kubernetes_version: str :keyword name: The Agent Pool name. :paramtype name: str - :keyword os_type: Required. The operating system type. The default is Linux. Possible values - include: "Linux", "Windows". Default value: "Linux". + :keyword os_type: Required. The operating system type. The default is Linux. Known values are: + "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2021_05_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: @@ -4116,8 +4112,7 @@ class ManagedClusterPropertiesAutoScalerProfile(msrest.serialization.Model): :vartype balance_similar_node_groups: str :ivar expander: If not specified, the default is 'random'. See `expanders `_ - for more information. Possible values include: "least-waste", "most-pods", "priority", - "random". + for more information. Known values are: "least-waste", "most-pods", "priority", "random". :vartype expander: str or ~azure.mgmt.containerservice.v2021_05_01.models.Expander :ivar max_empty_bulk_delete: The default is 10. :vartype max_empty_bulk_delete: str @@ -4184,7 +4179,7 @@ def __init__( self, *, balance_similar_node_groups: Optional[str] = None, - expander: Optional[Union[str, "Expander"]] = None, + expander: Optional[Union[str, "_models.Expander"]] = None, max_empty_bulk_delete: Optional[str] = None, max_graceful_termination_sec: Optional[str] = None, max_node_provision_time: Optional[str] = None, @@ -4207,8 +4202,7 @@ def __init__( :paramtype balance_similar_node_groups: str :keyword expander: If not specified, the default is 'random'. See `expanders `_ - for more information. Possible values include: "least-waste", "most-pods", "priority", - "random". + for more information. Known values are: "least-waste", "most-pods", "priority", "random". :paramtype expander: str or ~azure.mgmt.containerservice.v2021_05_01.models.Expander :keyword max_empty_bulk_delete: The default is 10. :paramtype max_empty_bulk_delete: str @@ -4312,11 +4306,11 @@ def __init__( class ManagedClusterSKU(msrest.serialization.Model): """The SKU of a Managed Cluster. - :ivar name: The name of a managed cluster SKU. Possible values include: "Basic". + :ivar name: The name of a managed cluster SKU. Known values are: "Basic". :vartype name: str or ~azure.mgmt.containerservice.v2021_05_01.models.ManagedClusterSKUName :ivar tier: If not specified, the default is 'Free'. See `uptime SLA - `_ for more details. Possible values include: - "Paid", "Free". + `_ for more details. Known values are: "Paid", + "Free". :vartype tier: str or ~azure.mgmt.containerservice.v2021_05_01.models.ManagedClusterSKUTier """ @@ -4328,16 +4322,16 @@ class ManagedClusterSKU(msrest.serialization.Model): def __init__( self, *, - name: Optional[Union[str, "ManagedClusterSKUName"]] = None, - tier: Optional[Union[str, "ManagedClusterSKUTier"]] = None, + name: Optional[Union[str, "_models.ManagedClusterSKUName"]] = None, + tier: Optional[Union[str, "_models.ManagedClusterSKUTier"]] = None, **kwargs ): """ - :keyword name: The name of a managed cluster SKU. Possible values include: "Basic". + :keyword name: The name of a managed cluster SKU. Known values are: "Basic". :paramtype name: str or ~azure.mgmt.containerservice.v2021_05_01.models.ManagedClusterSKUName :keyword tier: If not specified, the default is 'Free'. See `uptime SLA - `_ for more details. Possible values include: - "Paid", "Free". + `_ for more details. Known values are: "Paid", + "Free". :paramtype tier: str or ~azure.mgmt.containerservice.v2021_05_01.models.ManagedClusterSKUTier """ super(ManagedClusterSKU, self).__init__(**kwargs) @@ -4386,8 +4380,8 @@ class ManagedClusterUpgradeProfile(msrest.serialization.Model): def __init__( self, *, - control_plane_profile: "ManagedClusterPoolUpgradeProfile", - agent_pool_profiles: List["ManagedClusterPoolUpgradeProfile"], + control_plane_profile: "_models.ManagedClusterPoolUpgradeProfile", + agent_pool_profiles: List["_models.ManagedClusterPoolUpgradeProfile"], **kwargs ): """ @@ -4429,8 +4423,8 @@ class ManagedClusterWindowsProfile(msrest.serialization.Model): "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!". :vartype admin_password: str :ivar license_type: The license type to use for Windows VMs. See `Azure Hybrid User Benefits - `_ for more details. Possible values - include: "None", "Windows_Server". + `_ for more details. Known values are: + "None", "Windows_Server". :vartype license_type: str or ~azure.mgmt.containerservice.v2021_05_01.models.LicenseType :ivar enable_csi_proxy: For more details on CSI proxy, see the `CSI proxy GitHub repo `_. @@ -4453,7 +4447,7 @@ def __init__( *, admin_username: str, admin_password: Optional[str] = None, - license_type: Optional[Union[str, "LicenseType"]] = None, + license_type: Optional[Union[str, "_models.LicenseType"]] = None, enable_csi_proxy: Optional[bool] = None, **kwargs ): @@ -4475,8 +4469,8 @@ def __init__( "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!". :paramtype admin_password: str :keyword license_type: The license type to use for Windows VMs. See `Azure Hybrid User Benefits - `_ for more details. Possible values - include: "None", "Windows_Server". + `_ for more details. Known values are: + "None", "Windows_Server". :paramtype license_type: str or ~azure.mgmt.containerservice.v2021_05_01.models.LicenseType :keyword enable_csi_proxy: For more details on CSI proxy, see the `CSI proxy GitHub repo `_. @@ -4603,7 +4597,7 @@ class OSOptionProfile(msrest.serialization.Model): def __init__( self, *, - os_option_property_list: List["OSOptionProperty"], + os_option_property_list: List["_models.OSOptionProperty"], **kwargs ): """ @@ -4676,7 +4670,7 @@ def __init__( self, *, category: Optional[str] = None, - endpoints: Optional[List["EndpointDependency"]] = None, + endpoints: Optional[List["_models.EndpointDependency"]] = None, **kwargs ): """ @@ -4718,7 +4712,7 @@ class OutboundEnvironmentEndpointCollection(msrest.serialization.Model): def __init__( self, *, - value: List["OutboundEnvironmentEndpoint"], + value: List["_models.OutboundEnvironmentEndpoint"], **kwargs ): """ @@ -4734,8 +4728,8 @@ def __init__( class PowerState(msrest.serialization.Model): """Describes the Power State of the cluster. - :ivar code: Tells whether the cluster is Running or Stopped. Possible values include: - "Running", "Stopped". + :ivar code: Tells whether the cluster is Running or Stopped. Known values are: "Running", + "Stopped". :vartype code: str or ~azure.mgmt.containerservice.v2021_05_01.models.Code """ @@ -4746,12 +4740,12 @@ class PowerState(msrest.serialization.Model): def __init__( self, *, - code: Optional[Union[str, "Code"]] = None, + code: Optional[Union[str, "_models.Code"]] = None, **kwargs ): """ - :keyword code: Tells whether the cluster is Running or Stopped. Possible values include: - "Running", "Stopped". + :keyword code: Tells whether the cluster is Running or Stopped. Known values are: "Running", + "Stopped". :paramtype code: str or ~azure.mgmt.containerservice.v2021_05_01.models.Code """ super(PowerState, self).__init__(**kwargs) @@ -4794,7 +4788,7 @@ class PrivateEndpointConnection(msrest.serialization.Model): :vartype name: str :ivar type: The resource type. :vartype type: str - :ivar provisioning_state: The current provisioning state. Possible values include: "Succeeded", + :ivar provisioning_state: The current provisioning state. Known values are: "Succeeded", "Creating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2021_05_01.models.PrivateEndpointConnectionProvisioningState @@ -4825,8 +4819,8 @@ class PrivateEndpointConnection(msrest.serialization.Model): def __init__( self, *, - private_endpoint: Optional["PrivateEndpoint"] = None, - private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, + private_endpoint: Optional["_models.PrivateEndpoint"] = None, + private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionState"] = None, **kwargs ): """ @@ -4860,7 +4854,7 @@ class PrivateEndpointConnectionListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["PrivateEndpointConnection"]] = None, + value: Optional[List["_models.PrivateEndpointConnection"]] = None, **kwargs ): """ @@ -4950,7 +4944,7 @@ class PrivateLinkResourcesListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["PrivateLinkResource"]] = None, + value: Optional[List["_models.PrivateLinkResource"]] = None, **kwargs ): """ @@ -4964,7 +4958,7 @@ def __init__( class PrivateLinkServiceConnectionState(msrest.serialization.Model): """The state of a private link service connection. - :ivar status: The private link service connection status. Possible values include: "Pending", + :ivar status: The private link service connection status. Known values are: "Pending", "Approved", "Rejected", "Disconnected". :vartype status: str or ~azure.mgmt.containerservice.v2021_05_01.models.ConnectionStatus :ivar description: The private link service connection description. @@ -4979,13 +4973,13 @@ class PrivateLinkServiceConnectionState(msrest.serialization.Model): def __init__( self, *, - status: Optional[Union[str, "ConnectionStatus"]] = None, + status: Optional[Union[str, "_models.ConnectionStatus"]] = None, description: Optional[str] = None, **kwargs ): """ - :keyword status: The private link service connection status. Possible values include: - "Pending", "Approved", "Rejected", "Disconnected". + :keyword status: The private link service connection status. Known values are: "Pending", + "Approved", "Rejected", "Disconnected". :paramtype status: str or ~azure.mgmt.containerservice.v2021_05_01.models.ConnectionStatus :keyword description: The private link service connection description. :paramtype description: str @@ -5341,15 +5335,15 @@ class SystemData(msrest.serialization.Model): :ivar created_by: The identity that created the resource. :vartype created_by: str - :ivar created_by_type: The type of identity that created the resource. Possible values include: + :ivar created_by_type: The type of identity that created the resource. Known values are: "User", "Application", "ManagedIdentity", "Key". :vartype created_by_type: str or ~azure.mgmt.containerservice.v2021_05_01.models.CreatedByType :ivar created_at: The UTC timestamp of resource creation. :vartype created_at: ~datetime.datetime :ivar last_modified_by: The identity that last modified the resource. :vartype last_modified_by: str - :ivar last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". + :ivar last_modified_by_type: The type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", "Key". :vartype last_modified_by_type: str or ~azure.mgmt.containerservice.v2021_05_01.models.CreatedByType :ivar last_modified_at: The type of identity that last modified the resource. @@ -5369,26 +5363,26 @@ def __init__( self, *, created_by: Optional[str] = None, - created_by_type: Optional[Union[str, "CreatedByType"]] = None, + created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, created_at: Optional[datetime.datetime] = None, last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[Union[str, "CreatedByType"]] = None, + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, last_modified_at: Optional[datetime.datetime] = None, **kwargs ): """ :keyword created_by: The identity that created the resource. :paramtype created_by: str - :keyword created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". + :keyword created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", "Key". :paramtype created_by_type: str or ~azure.mgmt.containerservice.v2021_05_01.models.CreatedByType :keyword created_at: The UTC timestamp of resource creation. :paramtype created_at: ~datetime.datetime :keyword last_modified_by: The identity that last modified the resource. :paramtype last_modified_by: str - :keyword last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". + :keyword last_modified_by_type: The type of identity that last modified the resource. Known + values are: "User", "Application", "ManagedIdentity", "Key". :paramtype last_modified_by_type: str or ~azure.mgmt.containerservice.v2021_05_01.models.CreatedByType :keyword last_modified_at: The type of identity that last modified the resource. @@ -5431,8 +5425,8 @@ def __init__( class TimeInWeek(msrest.serialization.Model): """Time in a week. - :ivar day: The day of the week. Possible values include: "Sunday", "Monday", "Tuesday", - "Wednesday", "Thursday", "Friday", "Saturday". + :ivar day: The day of the week. Known values are: "Sunday", "Monday", "Tuesday", "Wednesday", + "Thursday", "Friday", "Saturday". :vartype day: str or ~azure.mgmt.containerservice.v2021_05_01.models.WeekDay :ivar hour_slots: Each integer hour represents a time range beginning at 0m after the hour ending at the next hour (non-inclusive). 0 corresponds to 00:00 UTC, 23 corresponds to 23:00 @@ -5448,12 +5442,12 @@ class TimeInWeek(msrest.serialization.Model): def __init__( self, *, - day: Optional[Union[str, "WeekDay"]] = None, + day: Optional[Union[str, "_models.WeekDay"]] = None, hour_slots: Optional[List[int]] = None, **kwargs ): """ - :keyword day: The day of the week. Possible values include: "Sunday", "Monday", "Tuesday", + :keyword day: The day of the week. Known values are: "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday". :paramtype day: str or ~azure.mgmt.containerservice.v2021_05_01.models.WeekDay :keyword hour_slots: Each integer hour represents a time range beginning at 0m after the hour diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/models/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/models/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/operations/__init__.py index 3942e0ca6a01..f0e265d9f2f4 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/operations/__init__.py @@ -14,6 +14,9 @@ from ._private_link_resources_operations import PrivateLinkResourcesOperations from ._resolve_private_link_service_id_operations import ResolvePrivateLinkServiceIdOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'Operations', 'ManagedClustersOperations', @@ -23,3 +26,5 @@ 'PrivateLinkResourcesOperations', 'ResolvePrivateLinkServiceIdOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/operations/_agent_pools_operations.py index fcf96562a472..772efaf3cd2c 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/operations/_agent_pools_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -35,9 +35,12 @@ def build_list_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-05-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools") # pylint: disable=line-too-long path_format_arguments = { @@ -49,18 +52,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -72,9 +73,12 @@ def build_get_request( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-05-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -87,18 +91,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -109,14 +111,17 @@ def build_create_or_update_request_initial( resource_name: str, agent_pool_name: str, *, - json: JSONType = None, + json: Optional[_models.AgentPool] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-05-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -129,20 +134,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -156,9 +159,12 @@ def build_delete_request_initial( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-05-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -171,18 +177,16 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -194,9 +198,12 @@ def build_get_upgrade_profile_request( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-05-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default") # pylint: disable=line-too-long path_format_arguments = { @@ -209,18 +216,16 @@ def build_get_upgrade_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -231,9 +236,12 @@ def build_get_available_agent_pool_versions_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-05-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions") # pylint: disable=line-too-long path_format_arguments = { @@ -245,18 +253,16 @@ def build_get_available_agent_pool_versions_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -268,9 +274,12 @@ def build_upgrade_node_image_version_request_initial( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-05-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion") # pylint: disable=line-too-long path_format_arguments = { @@ -283,42 +292,38 @@ def build_upgrade_node_image_version_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class AgentPoolsOperations(object): - """AgentPoolsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class AgentPoolsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_05_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_05_01.ContainerServiceClient`'s + :attr:`agent_pools` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -326,7 +331,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Iterable["_models.AgentPoolListResult"]: + ) -> Iterable[_models.AgentPoolListResult]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. @@ -341,13 +346,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_05_01.models.AgentPoolListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-05-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -357,9 +365,11 @@ def prepare_request(next_link=None): resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -369,9 +379,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -411,7 +423,7 @@ def get( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPool": + ) -> _models.AgentPool: """Gets the specified managed cluster agent pool. Gets the specified managed cluster agent pool. @@ -427,13 +439,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2021_05_01.models.AgentPool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-05-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] request = build_get_request( @@ -443,11 +458,13 @@ def get( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -473,17 +490,20 @@ def _create_or_update_initial( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> "_models.AgentPool": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] + ) -> _models.AgentPool: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-05-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] _json = self._serialize.body(parameters, 'AgentPool') @@ -496,11 +516,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -531,9 +553,9 @@ def begin_create_or_update( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> LROPoller["_models.AgentPool"]: + ) -> LROPoller[_models.AgentPool]: """Creates or updates an agent pool in the specified managed cluster. Creates or updates an agent pool in the specified managed cluster. @@ -559,17 +581,20 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_05_01.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-05-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, @@ -577,20 +602,27 @@ def begin_create_or_update( 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): - response = pipeline_response.http_response deserialized = self._deserialize('AgentPool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -610,13 +642,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements agent_pool_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-05-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -626,11 +661,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -677,21 +714,26 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-05-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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) @@ -701,8 +743,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -722,7 +770,7 @@ def get_upgrade_profile( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPoolUpgradeProfile": + ) -> _models.AgentPoolUpgradeProfile: """Gets the upgrade profile for an agent pool. Gets the upgrade profile for an agent pool. @@ -738,13 +786,16 @@ def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2021_05_01.models.AgentPoolUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-05-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] request = build_get_upgrade_profile_request( @@ -754,11 +805,13 @@ def get_upgrade_profile( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -785,7 +838,7 @@ def get_available_agent_pool_versions( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.AgentPoolAvailableVersions": + ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported Kubernetes versions for the specified agent pool. See `supported Kubernetes versions @@ -801,13 +854,16 @@ def get_available_agent_pool_versions( :rtype: ~azure.mgmt.containerservice.v2021_05_01.models.AgentPoolAvailableVersions :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolAvailableVersions"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-05-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] request = build_get_available_agent_pool_versions_request( @@ -816,11 +872,13 @@ def get_available_agent_pool_versions( resource_name=resource_name, api_version=api_version, template_url=self.get_available_agent_pool_versions.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -847,14 +905,17 @@ def _upgrade_node_image_version_initial( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> Optional["_models.AgentPool"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.AgentPool"]] + ) -> Optional[_models.AgentPool]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-05-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] request = build_upgrade_node_image_version_request_initial( @@ -864,11 +925,13 @@ def _upgrade_node_image_version_initial( agent_pool_name=agent_pool_name, api_version=api_version, template_url=self._upgrade_node_image_version_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -898,7 +961,7 @@ def begin_upgrade_node_image_version( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> LROPoller["_models.AgentPool"]: + ) -> LROPoller[_models.AgentPool]: """Upgrades the node image version of an agent pool to the latest. Upgrading the node image version of an agent pool applies the newest OS and runtime updates to @@ -924,35 +987,45 @@ def begin_upgrade_node_image_version( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_05_01.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-05-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._upgrade_node_image_version_initial( + raw_result = self._upgrade_node_image_version_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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): - response = pipeline_response.http_response deserialized = self._deserialize('AgentPool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/operations/_maintenance_configurations_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/operations/_maintenance_configurations_operations.py index 1aa957f0e773..c99e6ea5f39e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/operations/_maintenance_configurations_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/operations/_maintenance_configurations_operations.py @@ -16,12 +16,12 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -33,9 +33,12 @@ def build_list_by_managed_cluster_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-05-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations") # pylint: disable=line-too-long path_format_arguments = { @@ -47,18 +50,16 @@ def build_list_by_managed_cluster_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -70,9 +71,12 @@ def build_get_request( config_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-05-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long path_format_arguments = { @@ -85,18 +89,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -107,14 +109,17 @@ def build_create_or_update_request( resource_name: str, config_name: str, *, - json: JSONType = None, + json: Optional[_models.MaintenanceConfiguration] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-05-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long path_format_arguments = { @@ -127,20 +132,18 @@ def build_create_or_update_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -154,9 +157,12 @@ def build_delete_request( config_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-05-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long path_format_arguments = { @@ -169,42 +175,38 @@ def build_delete_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class MaintenanceConfigurationsOperations(object): - """MaintenanceConfigurationsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class MaintenanceConfigurationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_05_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_05_01.ContainerServiceClient`'s + :attr:`maintenance_configurations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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_by_managed_cluster( @@ -212,7 +214,7 @@ def list_by_managed_cluster( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Iterable["_models.MaintenanceConfigurationListResult"]: + ) -> Iterable[_models.MaintenanceConfigurationListResult]: """Gets a list of maintenance configurations in the specified managed cluster. Gets a list of maintenance configurations in the specified managed cluster. @@ -228,13 +230,16 @@ def list_by_managed_cluster( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_05_01.models.MaintenanceConfigurationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-05-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfigurationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfigurationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -244,9 +249,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=self.list_by_managed_cluster.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -256,9 +263,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -298,7 +307,7 @@ def get( resource_name: str, config_name: str, **kwargs: Any - ) -> "_models.MaintenanceConfiguration": + ) -> _models.MaintenanceConfiguration: """Gets the specified maintenance configuration of a managed cluster. Gets the specified maintenance configuration of a managed cluster. @@ -314,13 +323,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2021_05_01.models.MaintenanceConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfiguration"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-05-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] request = build_get_request( @@ -330,11 +342,13 @@ def get( config_name=config_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -361,9 +375,9 @@ def create_or_update( resource_group_name: str, resource_name: str, config_name: str, - parameters: "_models.MaintenanceConfiguration", + parameters: _models.MaintenanceConfiguration, **kwargs: Any - ) -> "_models.MaintenanceConfiguration": + ) -> _models.MaintenanceConfiguration: """Creates or updates a maintenance configuration in the specified managed cluster. Creates or updates a maintenance configuration in the specified managed cluster. @@ -381,14 +395,17 @@ def create_or_update( :rtype: ~azure.mgmt.containerservice.v2021_05_01.models.MaintenanceConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfiguration"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-05-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] _json = self._serialize.body(parameters, 'MaintenanceConfiguration') @@ -401,11 +418,13 @@ def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -449,13 +468,16 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-05-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -465,11 +487,13 @@ def delete( # pylint: disable=inconsistent-return-statements config_name=config_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/operations/_managed_clusters_operations.py index a3d615aa4880..465c9e0981e4 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/operations/_managed_clusters_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -36,9 +36,12 @@ def build_get_os_options_request( resource_type: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-05-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default") # pylint: disable=line-too-long path_format_arguments = { @@ -49,20 +52,18 @@ def build_get_os_options_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if resource_type is not None: - _query_parameters['resource-type'] = _SERIALIZER.query("resource_type", resource_type, 'str') + _params['resource-type'] = _SERIALIZER.query("resource_type", resource_type, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -71,9 +72,12 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-05-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters") path_format_arguments = { @@ -83,18 +87,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -104,9 +106,12 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-05-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters") # pylint: disable=line-too-long path_format_arguments = { @@ -117,18 +122,16 @@ def build_list_by_resource_group_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -139,9 +142,12 @@ def build_get_upgrade_profile_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-05-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default") # pylint: disable=line-too-long path_format_arguments = { @@ -153,18 +159,16 @@ def build_get_upgrade_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -176,9 +180,12 @@ def build_get_access_profile_request( role_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-05-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -191,18 +198,16 @@ def build_get_access_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -215,9 +220,12 @@ def build_list_cluster_admin_credentials_request( server_fqdn: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-05-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -229,20 +237,18 @@ def build_list_cluster_admin_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if server_fqdn is not None: - _query_parameters['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -255,9 +261,12 @@ def build_list_cluster_user_credentials_request( server_fqdn: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-05-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -269,20 +278,18 @@ def build_list_cluster_user_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if server_fqdn is not None: - _query_parameters['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -295,9 +302,12 @@ def build_list_cluster_monitoring_user_credentials_request( server_fqdn: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-05-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -309,20 +319,18 @@ def build_list_cluster_monitoring_user_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if server_fqdn is not None: - _query_parameters['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -333,9 +341,12 @@ def build_get_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-05-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -347,18 +358,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -368,14 +377,17 @@ def build_create_or_update_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedCluster] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-05-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -387,20 +399,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -412,14 +422,17 @@ def build_update_tags_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.TagsObject] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-05-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -431,20 +444,18 @@ def build_update_tags_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -457,9 +468,12 @@ def build_delete_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-05-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -471,18 +485,16 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -492,14 +504,17 @@ def build_reset_service_principal_profile_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedClusterServicePrincipalProfile] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-05-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile") # pylint: disable=line-too-long path_format_arguments = { @@ -511,20 +526,18 @@ def build_reset_service_principal_profile_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -536,14 +549,17 @@ def build_reset_aad_profile_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedClusterAADProfile] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-05-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile") # pylint: disable=line-too-long path_format_arguments = { @@ -555,20 +571,18 @@ def build_reset_aad_profile_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -581,9 +595,12 @@ def build_rotate_cluster_certificates_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-05-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates") # pylint: disable=line-too-long path_format_arguments = { @@ -595,18 +612,16 @@ def build_rotate_cluster_certificates_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -617,9 +632,12 @@ def build_stop_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-05-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop") # pylint: disable=line-too-long path_format_arguments = { @@ -631,18 +649,16 @@ def build_stop_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -653,9 +669,12 @@ def build_start_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-05-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start") # pylint: disable=line-too-long path_format_arguments = { @@ -667,18 +686,16 @@ def build_start_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -688,14 +705,17 @@ def build_run_command_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.RunCommandRequest] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-05-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand") # pylint: disable=line-too-long path_format_arguments = { @@ -707,20 +727,18 @@ def build_run_command_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -734,9 +752,12 @@ def build_get_command_result_request( command_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-05-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}") # pylint: disable=line-too-long path_format_arguments = { @@ -749,18 +770,16 @@ def build_get_command_result_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -771,9 +790,12 @@ def build_list_outbound_network_dependencies_endpoints_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-05-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints") # pylint: disable=line-too-long path_format_arguments = { @@ -785,42 +807,38 @@ def build_list_outbound_network_dependencies_endpoints_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class ManagedClustersOperations(object): # pylint: disable=too-many-public-methods - """ManagedClustersOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ManagedClustersOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_05_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_05_01.ContainerServiceClient`'s + :attr:`managed_clusters` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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_os_options( @@ -828,7 +846,7 @@ def get_os_options( location: str, resource_type: Optional[str] = None, **kwargs: Any - ) -> "_models.OSOptionProfile": + ) -> _models.OSOptionProfile: """Gets supported OS options in the specified subscription. Gets supported OS options in the specified subscription. @@ -843,13 +861,16 @@ def get_os_options( :rtype: ~azure.mgmt.containerservice.v2021_05_01.models.OSOptionProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OSOptionProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-05-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OSOptionProfile] request = build_get_os_options_request( @@ -858,11 +879,13 @@ def get_os_options( api_version=api_version, resource_type=resource_type, template_url=self.get_os_options.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -887,7 +910,7 @@ def get_os_options( def list( self, **kwargs: Any - ) -> Iterable["_models.ManagedClusterListResult"]: + ) -> Iterable[_models.ManagedClusterListResult]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. @@ -899,13 +922,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_05_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-05-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -913,9 +939,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -923,9 +951,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -963,7 +993,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.ManagedClusterListResult"]: + ) -> Iterable[_models.ManagedClusterListResult]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. @@ -977,13 +1007,16 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_05_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-05-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -992,9 +1025,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -1003,9 +1038,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -1044,7 +1081,7 @@ def get_upgrade_profile( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedClusterUpgradeProfile": + ) -> _models.ManagedClusterUpgradeProfile: """Gets the upgrade profile of a managed cluster. Gets the upgrade profile of a managed cluster. @@ -1058,13 +1095,16 @@ def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2021_05_01.models.ManagedClusterUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-05-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] request = build_get_upgrade_profile_request( @@ -1073,11 +1113,13 @@ def get_upgrade_profile( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1105,7 +1147,7 @@ def get_access_profile( resource_name: str, role_name: str, **kwargs: Any - ) -> "_models.ManagedClusterAccessProfile": + ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. **WARNING**\ : This API will be deprecated. Instead use `ListClusterUserCredentials @@ -1124,13 +1166,16 @@ def get_access_profile( :rtype: ~azure.mgmt.containerservice.v2021_05_01.models.ManagedClusterAccessProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterAccessProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-05-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] request = build_get_access_profile_request( @@ -1140,11 +1185,13 @@ def get_access_profile( role_name=role_name, api_version=api_version, template_url=self.get_access_profile.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1172,7 +1219,7 @@ def list_cluster_admin_credentials( resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Lists the admin credentials of a managed cluster. Lists the admin credentials of a managed cluster. @@ -1188,13 +1235,16 @@ def list_cluster_admin_credentials( :rtype: ~azure.mgmt.containerservice.v2021_05_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-05-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_admin_credentials_request( @@ -1204,11 +1254,13 @@ def list_cluster_admin_credentials( api_version=api_version, server_fqdn=server_fqdn, template_url=self.list_cluster_admin_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1236,7 +1288,7 @@ def list_cluster_user_credentials( resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Lists the user credentials of a managed cluster. Lists the user credentials of a managed cluster. @@ -1252,13 +1304,16 @@ def list_cluster_user_credentials( :rtype: ~azure.mgmt.containerservice.v2021_05_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-05-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_user_credentials_request( @@ -1268,11 +1323,13 @@ def list_cluster_user_credentials( api_version=api_version, server_fqdn=server_fqdn, template_url=self.list_cluster_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1300,7 +1357,7 @@ def list_cluster_monitoring_user_credentials( resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Lists the cluster monitoring user credentials of a managed cluster. Lists the cluster monitoring user credentials of a managed cluster. @@ -1316,13 +1373,16 @@ def list_cluster_monitoring_user_credentials( :rtype: ~azure.mgmt.containerservice.v2021_05_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-05-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_monitoring_user_credentials_request( @@ -1332,11 +1392,13 @@ def list_cluster_monitoring_user_credentials( api_version=api_version, server_fqdn=server_fqdn, template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1363,7 +1425,7 @@ def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedCluster": + ) -> _models.ManagedCluster: """Gets a managed cluster. Gets a managed cluster. @@ -1377,13 +1439,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2021_05_01.models.ManagedCluster :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-05-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] request = build_get_request( @@ -1392,11 +1457,13 @@ def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1421,17 +1488,20 @@ def _create_or_update_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-05-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'ManagedCluster') @@ -1443,11 +1513,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1477,9 +1549,9 @@ def begin_create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> LROPoller["_models.ManagedCluster"]: + ) -> LROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. Creates or updates a managed cluster. @@ -1504,37 +1576,47 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_05_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-05-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1551,17 +1633,20 @@ def _update_tags_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-05-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'TagsObject') @@ -1573,11 +1658,13 @@ def _update_tags_initial( content_type=content_type, json=_json, template_url=self._update_tags_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1603,9 +1690,9 @@ def begin_update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> LROPoller["_models.ManagedCluster"]: + ) -> LROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates tags on a managed cluster. @@ -1630,37 +1717,47 @@ def begin_update_tags( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_05_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-05-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._update_tags_initial( + raw_result = self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1679,13 +1776,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-05-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -1694,11 +1794,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1742,20 +1844,25 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-05-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_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) @@ -1765,8 +1872,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1783,17 +1896,20 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-05-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') @@ -1805,11 +1921,13 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re content_type=content_type, json=_json, template_url=self._reset_service_principal_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1831,7 +1949,7 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> LROPoller[None]: """Reset the Service Principal Profile of a managed cluster. @@ -1857,23 +1975,28 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-05-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._reset_service_principal_profile_initial( + raw_result = self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1883,8 +2006,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1901,17 +2030,20 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-05-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') @@ -1923,11 +2055,13 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement content_type=content_type, json=_json, template_url=self._reset_aad_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1949,7 +2083,7 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> LROPoller[None]: """Reset the AAD Profile of a managed cluster. @@ -1974,23 +2108,28 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-05-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._reset_aad_profile_initial( + raw_result = self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -2000,8 +2139,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2020,13 +2165,16 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-05-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_rotate_cluster_certificates_request_initial( @@ -2035,11 +2183,13 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return resource_name=resource_name, api_version=api_version, template_url=self._rotate_cluster_certificates_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2084,20 +2234,25 @@ def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-st :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-05-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._rotate_cluster_certificates_initial( + raw_result = self._rotate_cluster_certificates_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) @@ -2107,8 +2262,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2127,13 +2288,16 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-05-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_stop_request_initial( @@ -2142,11 +2306,13 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_name, api_version=api_version, template_url=self._stop_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2194,20 +2360,25 @@ def begin_stop( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-05-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._stop_initial( + raw_result = self._stop_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) @@ -2217,8 +2388,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2237,13 +2414,16 @@ def _start_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-05-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_start_request_initial( @@ -2252,11 +2432,13 @@ def _start_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_name, api_version=api_version, template_url=self._start_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2301,20 +2483,25 @@ def begin_start( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-05-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._start_initial( + raw_result = self._start_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) @@ -2324,8 +2511,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2342,17 +2535,20 @@ def _run_command_initial( self, resource_group_name: str, resource_name: str, - request_payload: "_models.RunCommandRequest", + request_payload: _models.RunCommandRequest, **kwargs: Any - ) -> Optional["_models.RunCommandResult"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RunCommandResult"]] + ) -> Optional[_models.RunCommandResult]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-05-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] _json = self._serialize.body(request_payload, 'RunCommandRequest') @@ -2364,11 +2560,13 @@ def _run_command_initial( content_type=content_type, json=_json, template_url=self._run_command_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2396,9 +2594,9 @@ def begin_run_command( self, resource_group_name: str, resource_name: str, - request_payload: "_models.RunCommandRequest", + request_payload: _models.RunCommandRequest, **kwargs: Any - ) -> LROPoller["_models.RunCommandResult"]: + ) -> LROPoller[_models.RunCommandResult]: """Submits a command to run against the Managed Cluster. AKS will create a pod to run the command. This is primarily useful for private clusters. For @@ -2425,37 +2623,47 @@ def begin_run_command( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_05_01.models.RunCommandResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-05-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.RunCommandResult] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._run_command_initial( + raw_result = self._run_command_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, request_payload=request_payload, 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): - response = pipeline_response.http_response deserialized = self._deserialize('RunCommandResult', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2475,7 +2683,7 @@ def get_command_result( resource_name: str, command_id: str, **kwargs: Any - ) -> Optional["_models.RunCommandResult"]: + ) -> Optional[_models.RunCommandResult]: """Gets the results of a command which has been run on the Managed Cluster. Gets the results of a command which has been run on the Managed Cluster. @@ -2491,13 +2699,16 @@ def get_command_result( :rtype: ~azure.mgmt.containerservice.v2021_05_01.models.RunCommandResult or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RunCommandResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-05-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] request = build_get_command_result_request( @@ -2507,11 +2718,13 @@ def get_command_result( command_id=command_id, api_version=api_version, template_url=self.get_command_result.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2540,7 +2753,7 @@ def list_outbound_network_dependencies_endpoints( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Iterable["_models.OutboundEnvironmentEndpointCollection"]: + ) -> Iterable[_models.OutboundEnvironmentEndpointCollection]: """Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. @@ -2558,13 +2771,16 @@ def list_outbound_network_dependencies_endpoints( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_05_01.models.OutboundEnvironmentEndpointCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-05-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OutboundEnvironmentEndpointCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -2574,9 +2790,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=self.list_outbound_network_dependencies_endpoints.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -2586,9 +2804,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/operations/_operations.py index 7a0fe8e8e42e..4a4b89db4298 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/operations/_operations.py @@ -16,6 +16,7 @@ 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 @@ -29,55 +30,54 @@ def build_list_request( **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-05-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.ContainerService/operations") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class Operations(object): - """Operations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_05_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_05_01.ContainerServiceClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> Iterable["_models.OperationListResult"]: + ) -> Iterable[_models.OperationListResult]: """Gets a list of operations. Gets a list of operations. @@ -88,31 +88,38 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_05_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-05-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/operations/_private_endpoint_connections_operations.py index 2422f8da789d..dd426c9386f7 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/operations/_private_endpoint_connections_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast from msrest import Serializer @@ -16,13 +16,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -34,9 +34,12 @@ def build_list_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-05-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections") # pylint: disable=line-too-long path_format_arguments = { @@ -48,18 +51,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -71,9 +72,12 @@ def build_get_request( private_endpoint_connection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-05-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -86,18 +90,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -108,14 +110,17 @@ def build_update_request( resource_name: str, private_endpoint_connection_name: str, *, - json: JSONType = None, + json: Optional[_models.PrivateEndpointConnection] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-05-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -128,20 +133,18 @@ def build_update_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -155,9 +158,12 @@ def build_delete_request_initial( private_endpoint_connection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-05-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -170,42 +176,38 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class PrivateEndpointConnectionsOperations(object): - """PrivateEndpointConnectionsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class PrivateEndpointConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_05_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_05_01.ContainerServiceClient`'s + :attr:`private_endpoint_connections` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -213,7 +215,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnectionListResult": + ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. To learn more about private clusters, see: @@ -228,13 +230,16 @@ def list( :rtype: ~azure.mgmt.containerservice.v2021_05_01.models.PrivateEndpointConnectionListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-05-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] request = build_list_request( @@ -243,11 +248,13 @@ def list( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -275,7 +282,7 @@ def get( resource_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Gets the specified private endpoint connection. To learn more about private clusters, see: @@ -292,13 +299,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2021_05_01.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-05-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] request = build_get_request( @@ -308,11 +318,13 @@ def get( private_endpoint_connection_name=private_endpoint_connection_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -339,9 +351,9 @@ def update( resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - parameters: "_models.PrivateEndpointConnection", + parameters: _models.PrivateEndpointConnection, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. Updates a private endpoint connection. @@ -359,14 +371,17 @@ def update( :rtype: ~azure.mgmt.containerservice.v2021_05_01.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-05-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] _json = self._serialize.body(parameters, 'PrivateEndpointConnection') @@ -379,11 +394,13 @@ def update( content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -411,13 +428,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-05-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -427,11 +447,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name=private_endpoint_connection_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -478,21 +500,26 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-05-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -502,8 +529,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/operations/_private_link_resources_operations.py index a2ce3ab3714f..865c73d23f26 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/operations/_private_link_resources_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/operations/_private_link_resources_operations.py @@ -15,6 +15,7 @@ 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 @@ -31,9 +32,12 @@ def build_list_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-05-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources") # pylint: disable=line-too-long path_format_arguments = { @@ -45,42 +49,38 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class PrivateLinkResourcesOperations(object): - """PrivateLinkResourcesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class PrivateLinkResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_05_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_05_01.ContainerServiceClient`'s + :attr:`private_link_resources` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -88,7 +88,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.PrivateLinkResourcesListResult": + ) -> _models.PrivateLinkResourcesListResult: """Gets a list of private link resources in the specified managed cluster. To learn more about private clusters, see: @@ -103,13 +103,16 @@ def list( :rtype: ~azure.mgmt.containerservice.v2021_05_01.models.PrivateLinkResourcesListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourcesListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-05-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] request = build_list_request( @@ -118,11 +121,13 @@ def list( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/operations/_resolve_private_link_service_id_operations.py index 0c4de1f7444e..90f710553d08 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/operations/_resolve_private_link_service_id_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_05_01/operations/_resolve_private_link_service_id_operations.py @@ -15,12 +15,12 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -31,14 +31,17 @@ def build_post_request( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.PrivateLinkResource] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-05-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId") # pylint: disable=line-too-long path_format_arguments = { @@ -50,55 +53,51 @@ def build_post_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs ) -class ResolvePrivateLinkServiceIdOperations(object): - """ResolvePrivateLinkServiceIdOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ResolvePrivateLinkServiceIdOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_05_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_05_01.ContainerServiceClient`'s + :attr:`resolve_private_link_service_id` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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 post( self, resource_group_name: str, resource_name: str, - parameters: "_models.PrivateLinkResource", + parameters: _models.PrivateLinkResource, **kwargs: Any - ) -> "_models.PrivateLinkResource": + ) -> _models.PrivateLinkResource: """Gets the private link service ID for the specified managed cluster. Gets the private link service ID for the specified managed cluster. @@ -114,14 +113,17 @@ def post( :rtype: ~azure.mgmt.containerservice.v2021_05_01.models.PrivateLinkResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-05-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-05-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] _json = self._serialize.body(parameters, 'PrivateLinkResource') @@ -133,11 +135,13 @@ def post( content_type=content_type, json=_json, template_url=self.post.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/__init__.py index 53c675bd95e2..37a5f9e02e6f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._container_service_client import ContainerServiceClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['ContainerServiceClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/_container_service_client.py index a4c9312f3b85..012dd7e2a2c3 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/_container_service_client.py @@ -72,13 +72,27 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.managed_clusters = ManagedClustersOperations(self._client, self._config, self._serialize, self._deserialize) - self.maintenance_configurations = MaintenanceConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) - self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) - self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_clusters = ManagedClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.maintenance_configurations = MaintenanceConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.agent_pools = AgentPoolsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/__init__.py index 53c675bd95e2..37a5f9e02e6f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._container_service_client import ContainerServiceClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['ContainerServiceClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/_container_service_client.py index 0084764b8d3d..4744c95be1f3 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/_container_service_client.py @@ -73,13 +73,27 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.managed_clusters = ManagedClustersOperations(self._client, self._config, self._serialize, self._deserialize) - self.maintenance_configurations = MaintenanceConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) - self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) - self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_clusters = ManagedClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.maintenance_configurations = MaintenanceConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.agent_pools = AgentPoolsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/operations/__init__.py index 3942e0ca6a01..f0e265d9f2f4 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/operations/__init__.py @@ -14,6 +14,9 @@ from ._private_link_resources_operations import PrivateLinkResourcesOperations from ._resolve_private_link_service_id_operations import ResolvePrivateLinkServiceIdOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'Operations', 'ManagedClustersOperations', @@ -23,3 +26,5 @@ 'PrivateLinkResourcesOperations', 'ResolvePrivateLinkServiceIdOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/operations/_agent_pools_operations.py index 8b7f97e16859..39ba03d9fa8e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/operations/_agent_pools_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. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ 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 @@ -26,26 +27,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class AgentPoolsOperations: - """AgentPoolsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_07_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_07_01.aio.ContainerServiceClient`'s + :attr:`agent_pools` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -53,7 +52,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> AsyncIterable["_models.AgentPoolListResult"]: + ) -> AsyncIterable[_models.AgentPoolListResult]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. @@ -68,13 +67,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_07_01.models.AgentPoolListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -84,9 +86,11 @@ def prepare_request(next_link=None): resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -96,9 +100,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -138,7 +144,7 @@ async def get( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPool": + ) -> _models.AgentPool: """Gets the specified managed cluster agent pool. Gets the specified managed cluster agent pool. @@ -154,13 +160,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2021_07_01.models.AgentPool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] request = build_get_request( @@ -170,11 +179,13 @@ async def get( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -200,17 +211,20 @@ async def _create_or_update_initial( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> "_models.AgentPool": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] + ) -> _models.AgentPool: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] _json = self._serialize.body(parameters, 'AgentPool') @@ -223,11 +237,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -258,9 +274,9 @@ async def begin_create_or_update( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> AsyncLROPoller["_models.AgentPool"]: + ) -> AsyncLROPoller[_models.AgentPool]: """Creates or updates an agent pool in the specified managed cluster. Creates or updates an agent pool in the specified managed cluster. @@ -287,17 +303,20 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_07_01.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, @@ -305,20 +324,27 @@ async def begin_create_or_update( 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): - response = pipeline_response.http_response deserialized = self._deserialize('AgentPool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -338,13 +364,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements agent_pool_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -354,11 +383,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -405,21 +436,26 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-07-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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) @@ -429,8 +465,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -450,7 +492,7 @@ async def get_upgrade_profile( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPoolUpgradeProfile": + ) -> _models.AgentPoolUpgradeProfile: """Gets the upgrade profile for an agent pool. Gets the upgrade profile for an agent pool. @@ -466,13 +508,16 @@ async def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2021_07_01.models.AgentPoolUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] request = build_get_upgrade_profile_request( @@ -482,11 +527,13 @@ async def get_upgrade_profile( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -513,7 +560,7 @@ async def get_available_agent_pool_versions( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.AgentPoolAvailableVersions": + ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported Kubernetes versions for the specified agent pool. See `supported Kubernetes versions @@ -529,13 +576,16 @@ async def get_available_agent_pool_versions( :rtype: ~azure.mgmt.containerservice.v2021_07_01.models.AgentPoolAvailableVersions :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolAvailableVersions"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] request = build_get_available_agent_pool_versions_request( @@ -544,11 +594,13 @@ async def get_available_agent_pool_versions( resource_name=resource_name, api_version=api_version, template_url=self.get_available_agent_pool_versions.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -575,14 +627,17 @@ async def _upgrade_node_image_version_initial( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> Optional["_models.AgentPool"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.AgentPool"]] + ) -> Optional[_models.AgentPool]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] request = build_upgrade_node_image_version_request_initial( @@ -592,11 +647,13 @@ async def _upgrade_node_image_version_initial( agent_pool_name=agent_pool_name, api_version=api_version, template_url=self._upgrade_node_image_version_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -626,7 +683,7 @@ async def begin_upgrade_node_image_version( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> AsyncLROPoller["_models.AgentPool"]: + ) -> AsyncLROPoller[_models.AgentPool]: """Upgrades the node image version of an agent pool to the latest. Upgrading the node image version of an agent pool applies the newest OS and runtime updates to @@ -653,35 +710,45 @@ async def begin_upgrade_node_image_version( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_07_01.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._upgrade_node_image_version_initial( + raw_result = await self._upgrade_node_image_version_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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): - response = pipeline_response.http_response deserialized = self._deserialize('AgentPool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/operations/_maintenance_configurations_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/operations/_maintenance_configurations_operations.py index 1b712374a997..e16ec2b6b9b2 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/operations/_maintenance_configurations_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/operations/_maintenance_configurations_operations.py @@ -15,6 +15,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -24,26 +25,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class MaintenanceConfigurationsOperations: - """MaintenanceConfigurationsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_07_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_07_01.aio.ContainerServiceClient`'s + :attr:`maintenance_configurations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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_by_managed_cluster( @@ -51,7 +50,7 @@ def list_by_managed_cluster( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> AsyncIterable["_models.MaintenanceConfigurationListResult"]: + ) -> AsyncIterable[_models.MaintenanceConfigurationListResult]: """Gets a list of maintenance configurations in the specified managed cluster. Gets a list of maintenance configurations in the specified managed cluster. @@ -67,13 +66,16 @@ def list_by_managed_cluster( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_07_01.models.MaintenanceConfigurationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfigurationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfigurationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -83,9 +85,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=self.list_by_managed_cluster.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -95,9 +99,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -137,7 +143,7 @@ async def get( resource_name: str, config_name: str, **kwargs: Any - ) -> "_models.MaintenanceConfiguration": + ) -> _models.MaintenanceConfiguration: """Gets the specified maintenance configuration of a managed cluster. Gets the specified maintenance configuration of a managed cluster. @@ -153,13 +159,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2021_07_01.models.MaintenanceConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfiguration"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] request = build_get_request( @@ -169,11 +178,13 @@ async def get( config_name=config_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -200,9 +211,9 @@ async def create_or_update( resource_group_name: str, resource_name: str, config_name: str, - parameters: "_models.MaintenanceConfiguration", + parameters: _models.MaintenanceConfiguration, **kwargs: Any - ) -> "_models.MaintenanceConfiguration": + ) -> _models.MaintenanceConfiguration: """Creates or updates a maintenance configuration in the specified managed cluster. Creates or updates a maintenance configuration in the specified managed cluster. @@ -220,14 +231,17 @@ async def create_or_update( :rtype: ~azure.mgmt.containerservice.v2021_07_01.models.MaintenanceConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfiguration"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] _json = self._serialize.body(parameters, 'MaintenanceConfiguration') @@ -240,11 +254,13 @@ async def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -288,13 +304,16 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -304,11 +323,13 @@ async def delete( # pylint: disable=inconsistent-return-statements config_name=config_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/operations/_managed_clusters_operations.py index 8219db655817..26a3132a0203 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/operations/_managed_clusters_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. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ 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 @@ -26,26 +27,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ManagedClustersOperations: # pylint: disable=too-many-public-methods - """ManagedClustersOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_07_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_07_01.aio.ContainerServiceClient`'s + :attr:`managed_clusters` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace_async async def get_os_options( @@ -53,7 +52,7 @@ async def get_os_options( location: str, resource_type: Optional[str] = None, **kwargs: Any - ) -> "_models.OSOptionProfile": + ) -> _models.OSOptionProfile: """Gets supported OS options in the specified subscription. Gets supported OS options in the specified subscription. @@ -68,13 +67,16 @@ async def get_os_options( :rtype: ~azure.mgmt.containerservice.v2021_07_01.models.OSOptionProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OSOptionProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OSOptionProfile] request = build_get_os_options_request( @@ -83,11 +85,13 @@ async def get_os_options( api_version=api_version, resource_type=resource_type, template_url=self.get_os_options.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -112,7 +116,7 @@ async def get_os_options( def list( self, **kwargs: Any - ) -> AsyncIterable["_models.ManagedClusterListResult"]: + ) -> AsyncIterable[_models.ManagedClusterListResult]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. @@ -124,13 +128,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_07_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -138,9 +145,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -148,9 +157,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -188,7 +199,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ManagedClusterListResult"]: + ) -> AsyncIterable[_models.ManagedClusterListResult]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. @@ -202,13 +213,16 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_07_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -217,9 +231,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -228,9 +244,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -269,7 +287,7 @@ async def get_upgrade_profile( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedClusterUpgradeProfile": + ) -> _models.ManagedClusterUpgradeProfile: """Gets the upgrade profile of a managed cluster. Gets the upgrade profile of a managed cluster. @@ -283,13 +301,16 @@ async def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2021_07_01.models.ManagedClusterUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] request = build_get_upgrade_profile_request( @@ -298,11 +319,13 @@ async def get_upgrade_profile( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -330,7 +353,7 @@ async def get_access_profile( resource_name: str, role_name: str, **kwargs: Any - ) -> "_models.ManagedClusterAccessProfile": + ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. **WARNING**\ : This API will be deprecated. Instead use `ListClusterUserCredentials @@ -349,13 +372,16 @@ async def get_access_profile( :rtype: ~azure.mgmt.containerservice.v2021_07_01.models.ManagedClusterAccessProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterAccessProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] request = build_get_access_profile_request( @@ -365,11 +391,13 @@ async def get_access_profile( role_name=role_name, api_version=api_version, template_url=self.get_access_profile.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -397,7 +425,7 @@ async def list_cluster_admin_credentials( resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Lists the admin credentials of a managed cluster. Lists the admin credentials of a managed cluster. @@ -413,13 +441,16 @@ async def list_cluster_admin_credentials( :rtype: ~azure.mgmt.containerservice.v2021_07_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_admin_credentials_request( @@ -429,11 +460,13 @@ async def list_cluster_admin_credentials( api_version=api_version, server_fqdn=server_fqdn, template_url=self.list_cluster_admin_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -461,7 +494,7 @@ async def list_cluster_user_credentials( resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Lists the user credentials of a managed cluster. Lists the user credentials of a managed cluster. @@ -477,13 +510,16 @@ async def list_cluster_user_credentials( :rtype: ~azure.mgmt.containerservice.v2021_07_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_user_credentials_request( @@ -493,11 +529,13 @@ async def list_cluster_user_credentials( api_version=api_version, server_fqdn=server_fqdn, template_url=self.list_cluster_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -525,7 +563,7 @@ async def list_cluster_monitoring_user_credentials( resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Lists the cluster monitoring user credentials of a managed cluster. Lists the cluster monitoring user credentials of a managed cluster. @@ -541,13 +579,16 @@ async def list_cluster_monitoring_user_credentials( :rtype: ~azure.mgmt.containerservice.v2021_07_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_monitoring_user_credentials_request( @@ -557,11 +598,13 @@ async def list_cluster_monitoring_user_credentials( api_version=api_version, server_fqdn=server_fqdn, template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -588,7 +631,7 @@ async def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedCluster": + ) -> _models.ManagedCluster: """Gets a managed cluster. Gets a managed cluster. @@ -602,13 +645,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2021_07_01.models.ManagedCluster :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] request = build_get_request( @@ -617,11 +663,13 @@ async def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -646,17 +694,20 @@ async def _create_or_update_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'ManagedCluster') @@ -668,11 +719,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -702,9 +755,9 @@ async def begin_create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> AsyncLROPoller["_models.ManagedCluster"]: + ) -> AsyncLROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. Creates or updates a managed cluster. @@ -729,37 +782,47 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_07_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -776,17 +839,20 @@ async def _update_tags_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'TagsObject') @@ -798,11 +864,13 @@ async def _update_tags_initial( content_type=content_type, json=_json, template_url=self._update_tags_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -828,9 +896,9 @@ async def begin_update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> AsyncLROPoller["_models.ManagedCluster"]: + ) -> AsyncLROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates tags on a managed cluster. @@ -855,37 +923,47 @@ async def begin_update_tags( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_07_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._update_tags_initial( + raw_result = await self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -904,13 +982,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -919,11 +1000,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -967,20 +1050,25 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-07-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_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) @@ -990,8 +1078,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1008,17 +1102,20 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') @@ -1030,11 +1127,13 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist content_type=content_type, json=_json, template_url=self._reset_service_principal_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1056,7 +1155,7 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> AsyncLROPoller[None]: """Reset the Service Principal Profile of a managed cluster. @@ -1082,23 +1181,28 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._reset_service_principal_profile_initial( + raw_result = await self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1108,8 +1212,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1126,17 +1236,20 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') @@ -1148,11 +1261,13 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta content_type=content_type, json=_json, template_url=self._reset_aad_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1174,7 +1289,7 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> AsyncLROPoller[None]: """Reset the AAD Profile of a managed cluster. @@ -1199,23 +1314,28 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._reset_aad_profile_initial( + raw_result = await self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1225,8 +1345,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1245,13 +1371,16 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_rotate_cluster_certificates_request_initial( @@ -1260,11 +1389,13 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- resource_name=resource_name, api_version=api_version, template_url=self._rotate_cluster_certificates_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1309,20 +1440,25 @@ async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-ret :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-07-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._rotate_cluster_certificates_initial( + raw_result = await self._rotate_cluster_certificates_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) @@ -1332,8 +1468,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1352,13 +1494,16 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_stop_request_initial( @@ -1367,11 +1512,13 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_name, api_version=api_version, template_url=self._stop_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1419,20 +1566,25 @@ async def begin_stop( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-07-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._stop_initial( + raw_result = await self._stop_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) @@ -1442,8 +1594,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1462,13 +1620,16 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_start_request_initial( @@ -1477,11 +1638,13 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_name, api_version=api_version, template_url=self._start_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1526,20 +1689,25 @@ async def begin_start( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-07-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._start_initial( + raw_result = await self._start_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) @@ -1549,8 +1717,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1567,17 +1741,20 @@ async def _run_command_initial( self, resource_group_name: str, resource_name: str, - request_payload: "_models.RunCommandRequest", + request_payload: _models.RunCommandRequest, **kwargs: Any - ) -> Optional["_models.RunCommandResult"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RunCommandResult"]] + ) -> Optional[_models.RunCommandResult]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] _json = self._serialize.body(request_payload, 'RunCommandRequest') @@ -1589,11 +1766,13 @@ async def _run_command_initial( content_type=content_type, json=_json, template_url=self._run_command_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1621,9 +1800,9 @@ async def begin_run_command( self, resource_group_name: str, resource_name: str, - request_payload: "_models.RunCommandRequest", + request_payload: _models.RunCommandRequest, **kwargs: Any - ) -> AsyncLROPoller["_models.RunCommandResult"]: + ) -> AsyncLROPoller[_models.RunCommandResult]: """Submits a command to run against the Managed Cluster. AKS will create a pod to run the command. This is primarily useful for private clusters. For @@ -1650,37 +1829,47 @@ async def begin_run_command( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_07_01.models.RunCommandResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.RunCommandResult] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._run_command_initial( + raw_result = await self._run_command_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, request_payload=request_payload, 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): - response = pipeline_response.http_response deserialized = self._deserialize('RunCommandResult', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1700,7 +1889,7 @@ async def get_command_result( resource_name: str, command_id: str, **kwargs: Any - ) -> Optional["_models.RunCommandResult"]: + ) -> Optional[_models.RunCommandResult]: """Gets the results of a command which has been run on the Managed Cluster. Gets the results of a command which has been run on the Managed Cluster. @@ -1716,13 +1905,16 @@ async def get_command_result( :rtype: ~azure.mgmt.containerservice.v2021_07_01.models.RunCommandResult or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RunCommandResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] request = build_get_command_result_request( @@ -1732,11 +1924,13 @@ async def get_command_result( command_id=command_id, api_version=api_version, template_url=self.get_command_result.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1765,7 +1959,7 @@ def list_outbound_network_dependencies_endpoints( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> AsyncIterable["_models.OutboundEnvironmentEndpointCollection"]: + ) -> AsyncIterable[_models.OutboundEnvironmentEndpointCollection]: """Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. @@ -1783,13 +1977,16 @@ def list_outbound_network_dependencies_endpoints( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_07_01.models.OutboundEnvironmentEndpointCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OutboundEnvironmentEndpointCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -1799,9 +1996,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=self.list_outbound_network_dependencies_endpoints.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -1811,9 +2010,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/operations/_operations.py index eb4371a65590..1f56b8faa7b1 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/operations/_operations.py @@ -14,6 +14,7 @@ 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 @@ -23,32 +24,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class Operations: - """Operations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_07_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_07_01.aio.ContainerServiceClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.OperationListResult"]: + ) -> AsyncIterable[_models.OperationListResult]: """Gets a list of operations. Gets a list of operations. @@ -59,31 +58,38 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_07_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/operations/_private_endpoint_connections_operations.py index 73a7ee4bce98..ac4f47bd6778 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/operations/_private_endpoint_connections_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -14,6 +14,7 @@ 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 @@ -24,26 +25,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class PrivateEndpointConnectionsOperations: - """PrivateEndpointConnectionsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_07_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_07_01.aio.ContainerServiceClient`'s + :attr:`private_endpoint_connections` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -51,7 +50,7 @@ async def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnectionListResult": + ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. To learn more about private clusters, see: @@ -66,13 +65,16 @@ async def list( :rtype: ~azure.mgmt.containerservice.v2021_07_01.models.PrivateEndpointConnectionListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] request = build_list_request( @@ -81,11 +83,13 @@ async def list( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -113,7 +117,7 @@ async def get( resource_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Gets the specified private endpoint connection. To learn more about private clusters, see: @@ -130,13 +134,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2021_07_01.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] request = build_get_request( @@ -146,11 +153,13 @@ async def get( private_endpoint_connection_name=private_endpoint_connection_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -177,9 +186,9 @@ async def update( resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - parameters: "_models.PrivateEndpointConnection", + parameters: _models.PrivateEndpointConnection, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. Updates a private endpoint connection. @@ -197,14 +206,17 @@ async def update( :rtype: ~azure.mgmt.containerservice.v2021_07_01.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] _json = self._serialize.body(parameters, 'PrivateEndpointConnection') @@ -217,11 +229,13 @@ async def update( content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -249,13 +263,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -265,11 +282,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name=private_endpoint_connection_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -316,21 +335,26 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-07-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -340,8 +364,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/operations/_private_link_resources_operations.py index 96d3d506346e..b2aaec80a485 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/operations/_private_link_resources_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/operations/_private_link_resources_operations.py @@ -13,6 +13,7 @@ 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 @@ -22,26 +23,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class PrivateLinkResourcesOperations: - """PrivateLinkResourcesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_07_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_07_01.aio.ContainerServiceClient`'s + :attr:`private_link_resources` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -49,7 +48,7 @@ async def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.PrivateLinkResourcesListResult": + ) -> _models.PrivateLinkResourcesListResult: """Gets a list of private link resources in the specified managed cluster. To learn more about private clusters, see: @@ -64,13 +63,16 @@ async def list( :rtype: ~azure.mgmt.containerservice.v2021_07_01.models.PrivateLinkResourcesListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourcesListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] request = build_list_request( @@ -79,11 +81,13 @@ async def list( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/operations/_resolve_private_link_service_id_operations.py index 6798c2df8a89..72c94e17afd3 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/operations/_resolve_private_link_service_id_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/aio/operations/_resolve_private_link_service_id_operations.py @@ -13,6 +13,7 @@ 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 @@ -22,35 +23,33 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ResolvePrivateLinkServiceIdOperations: - """ResolvePrivateLinkServiceIdOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_07_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_07_01.aio.ContainerServiceClient`'s + :attr:`resolve_private_link_service_id` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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 post( self, resource_group_name: str, resource_name: str, - parameters: "_models.PrivateLinkResource", + parameters: _models.PrivateLinkResource, **kwargs: Any - ) -> "_models.PrivateLinkResource": + ) -> _models.PrivateLinkResource: """Gets the private link service ID for the specified managed cluster. Gets the private link service ID for the specified managed cluster. @@ -66,14 +65,17 @@ async def post( :rtype: ~azure.mgmt.containerservice.v2021_07_01.models.PrivateLinkResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] _json = self._serialize.body(parameters, 'PrivateLinkResource') @@ -85,11 +87,13 @@ async def post( content_type=content_type, json=_json, template_url=self.post.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/models/__init__.py index 35d5a286ea52..6fa1f42d9634 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/models/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/models/__init__.py @@ -123,7 +123,9 @@ UpgradeChannel, WeekDay, ) - +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'AgentPool', 'AgentPoolAvailableVersions', @@ -239,3 +241,5 @@ 'UpgradeChannel', 'WeekDay', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/models/_container_service_client_enums.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/models/_container_service_client_enums.py index da540000be1b..2954de10e246 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/models/_container_service_client_enums.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/models/_container_service_client_enums.py @@ -7,11 +7,10 @@ # -------------------------------------------------------------------------- from enum import Enum -from six import with_metaclass from azure.core import CaseInsensitiveEnumMeta -class AgentPoolMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class AgentPoolMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: https://docs.microsoft.com/azure/aks/use-system-pools @@ -24,7 +23,7 @@ class AgentPoolMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: User agent pools are primarily for hosting your application pods. USER = "User" -class AgentPoolType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class AgentPoolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of Agent Pool. """ @@ -33,7 +32,7 @@ class AgentPoolType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Use of this is strongly discouraged. AVAILABILITY_SET = "AvailabilitySet" -class Code(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class Code(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Tells whether the cluster is Running or Stopped """ @@ -42,7 +41,7 @@ class Code(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: The cluster is stopped. STOPPED = "Stopped" -class ConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The private link service connection status. """ @@ -51,7 +50,7 @@ class ConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): REJECTED = "Rejected" DISCONNECTED = "Disconnected" -class ContainerServiceStorageProfileTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Specifies what kind of storage to use. If omitted, the default will be chosen on your behalf based on the choice of orchestrator. """ @@ -59,7 +58,7 @@ class ContainerServiceStorageProfileTypes(with_metaclass(CaseInsensitiveEnumMeta STORAGE_ACCOUNT = "StorageAccount" MANAGED_DISKS = "ManagedDisks" -class ContainerServiceVMSizeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Size of agent VMs. Note: This is no longer maintained. """ @@ -238,7 +237,7 @@ class ContainerServiceVMSizeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, E STANDARD_NV24 = "Standard_NV24" STANDARD_NV6 = "Standard_NV6" -class Count(with_metaclass(CaseInsensitiveEnumMeta, int, Enum)): +class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): """Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, and 5. The default value is 1. """ @@ -247,7 +246,7 @@ class Count(with_metaclass(CaseInsensitiveEnumMeta, int, Enum)): THREE = 3 FIVE = 5 -class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of identity that created the resource. """ @@ -256,7 +255,7 @@ class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class Expander(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class Expander(str, Enum, metaclass=CaseInsensitiveEnumMeta): """If not specified, the default is 'random'. See `expanders `_ for more information. @@ -279,13 +278,13 @@ class Expander(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Used when you don't have a particular need for the node groups to scale differently. RANDOM = "random" -class ExtendedLocationTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ExtendedLocationTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of extendedLocation. """ EDGE_ZONE = "EdgeZone" -class GPUInstanceProfile(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class GPUInstanceProfile(str, Enum, metaclass=CaseInsensitiveEnumMeta): """GPUInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU. """ @@ -295,7 +294,7 @@ class GPUInstanceProfile(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MIG4_G = "MIG4g" MIG7_G = "MIG7g" -class KubeletDiskType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class KubeletDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. """ @@ -305,7 +304,7 @@ class KubeletDiskType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Kubelet will use the temporary disk for its data. TEMPORARY = "Temporary" -class LicenseType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class LicenseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The license type to use for Windows VMs. See `Azure Hybrid User Benefits `_ for more details. """ @@ -315,7 +314,7 @@ class LicenseType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Enables Azure Hybrid User Benefits for Windows VMs. WINDOWS_SERVER = "Windows_Server" -class LoadBalancerSku(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class LoadBalancerSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the differences between load balancer SKUs. @@ -328,7 +327,7 @@ class LoadBalancerSku(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Use a basic Load Balancer with limited functionality. BASIC = "basic" -class ManagedClusterPodIdentityProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ManagedClusterPodIdentityProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The current provisioning state of the pod identity. """ @@ -337,13 +336,13 @@ class ManagedClusterPodIdentityProvisioningState(with_metaclass(CaseInsensitiveE DELETING = "Deleting" FAILED = "Failed" -class ManagedClusterSKUName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ManagedClusterSKUName(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The name of a managed cluster SKU. """ BASIC = "Basic" -class ManagedClusterSKUTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ManagedClusterSKUTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): """If not specified, the default is 'Free'. See `uptime SLA `_ for more details. """ @@ -354,7 +353,7 @@ class ManagedClusterSKUTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: No guaranteed SLA, no additional charges. Free tier clusters have an SLO of 99.5%. FREE = "Free" -class NetworkMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """This cannot be specified if networkPlugin is anything other than 'azure'. """ @@ -365,7 +364,7 @@ class NetworkMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: This is no longer supported. BRIDGE = "bridge" -class NetworkPlugin(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkPlugin(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Network plugin used for building the Kubernetes network. """ @@ -378,7 +377,7 @@ class NetworkPlugin(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: information. KUBENET = "kubenet" -class NetworkPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Network policy used for building the Kubernetes network. """ @@ -391,7 +390,7 @@ class NetworkPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: for more information. AZURE = "azure" -class OSDiskType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OSDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS @@ -407,14 +406,14 @@ class OSDiskType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: provides lower read/write latency, along with faster node scaling and cluster upgrades. EPHEMERAL = "Ephemeral" -class OSSKU(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OSSKU(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Specifies an OS SKU. This value must not be specified if OSType is Windows. """ UBUNTU = "Ubuntu" CBL_MARINER = "CBLMariner" -class OSType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The operating system type. The default is Linux. """ @@ -423,7 +422,7 @@ class OSType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Use Windows. WINDOWS = "Windows" -class OutboundType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OutboundType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type `_. """ @@ -443,7 +442,7 @@ class OutboundType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: advanced scenario and requires proper network configuration. USER_ASSIGNED_NAT_GATEWAY = "userAssignedNATGateway" -class PrivateEndpointConnectionProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class PrivateEndpointConnectionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The current provisioning state. """ @@ -452,7 +451,7 @@ class PrivateEndpointConnectionProvisioningState(with_metaclass(CaseInsensitiveE DELETING = "Deleting" FAILED = "Failed" -class ResourceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """For more information see `use managed identities in AKS `_. """ @@ -468,7 +467,7 @@ class ResourceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Do not use a managed identity for the Managed Cluster, service principal will be used instead. NONE = "None" -class ScaleDownMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ScaleDownMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Describes how VMs are added to or removed from Agent Pools. See `billing states `_. """ @@ -479,7 +478,7 @@ class ScaleDownMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: during scale down. DEALLOCATE = "Deallocate" -class ScaleSetEvictionPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The eviction policy specifies what to do with the VM when it is evicted. The default is Delete. For more information about eviction see `spot VMs `_ @@ -492,7 +491,7 @@ class ScaleSetEvictionPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)) #: cause issues with cluster scaling or upgrading. DEALLOCATE = "Deallocate" -class ScaleSetPriority(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ScaleSetPriority(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The Virtual Machine Scale Set priority. """ @@ -502,7 +501,7 @@ class ScaleSetPriority(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Regular VMs will be used. REGULAR = "Regular" -class UpgradeChannel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class UpgradeChannel(str, Enum, metaclass=CaseInsensitiveEnumMeta): """For more information see `setting the AKS cluster auto-upgrade channel `_. """ @@ -532,7 +531,7 @@ class UpgradeChannel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Disables auto-upgrades and keeps the cluster at its current version of Kubernetes. NONE = "none" -class WeekDay(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class WeekDay(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The weekday enum. """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/models/_models_py3.py index 6f998aaa0c09..e3090b44cb1c 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/models/_models_py3.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/models/_models_py3.py @@ -7,11 +7,13 @@ # -------------------------------------------------------------------------- import datetime -from typing import Dict, List, Optional, Union +from typing import Dict, List, Optional, TYPE_CHECKING, Union import msrest.serialization -from ._container_service_client_enums import * +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + import __init__ as _models class SubResource(msrest.serialization.Model): @@ -79,11 +81,11 @@ class AgentPool(SubResource): :ivar os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS - `_. Possible values - include: "Managed", "Ephemeral". + `_. Known values are: + "Managed", "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2021_07_01.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Possible values include: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_07_01.models.KubeletDiskType :ivar vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and used. @@ -97,11 +99,11 @@ class AgentPool(SubResource): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2021_07_01.models.OSType - :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Possible values include: "Ubuntu", "CBLMariner". + :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known + values are: "Ubuntu", "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2021_07_01.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. :vartype max_count: int @@ -110,16 +112,15 @@ class AgentPool(SubResource): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it - defaults to Delete. Possible values include: "Delete", "Deallocate". + defaults to Delete. Known values are: "Delete", "Deallocate". :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2021_07_01.models.ScaleDownMode - :ivar type_properties_type: The type of Agent Pool. Possible values include: + :ivar type_properties_type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :vartype type_properties_type: str or ~azure.mgmt.containerservice.v2021_07_01.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Possible values include: "System", - "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". :vartype mode: str or ~azure.mgmt.containerservice.v2021_07_01.models.AgentPoolMode :ivar orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -151,12 +152,12 @@ class AgentPool(SubResource): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Possible values include: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_07_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Possible values include: "Delete", - "Deallocate". Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_07_01.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which @@ -188,7 +189,7 @@ class AgentPool(SubResource): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2021_07_01.models.GPUInstanceProfile """ @@ -252,37 +253,37 @@ def __init__( count: Optional[int] = None, vm_size: Optional[str] = None, os_disk_size_gb: Optional[int] = None, - os_disk_type: Optional[Union[str, "OSDiskType"]] = None, - kubelet_disk_type: Optional[Union[str, "KubeletDiskType"]] = None, + os_disk_type: Optional[Union[str, "_models.OSDiskType"]] = None, + kubelet_disk_type: Optional[Union[str, "_models.KubeletDiskType"]] = None, vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", - os_sku: Optional[Union[str, "OSSKU"]] = None, + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - scale_down_mode: Optional[Union[str, "ScaleDownMode"]] = None, - type_properties_type: Optional[Union[str, "AgentPoolType"]] = None, - mode: Optional[Union[str, "AgentPoolMode"]] = None, + scale_down_mode: Optional[Union[str, "_models.ScaleDownMode"]] = None, + type_properties_type: Optional[Union[str, "_models.AgentPoolType"]] = None, + mode: Optional[Union[str, "_models.AgentPoolMode"]] = None, orchestrator_version: Optional[str] = None, - upgrade_settings: Optional["AgentPoolUpgradeSettings"] = None, + upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", spot_max_price: Optional[float] = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, proximity_placement_group_id: Optional[str] = None, - kubelet_config: Optional["KubeletConfig"] = None, - linux_os_config: Optional["LinuxOSConfig"] = None, + kubelet_config: Optional["_models.KubeletConfig"] = None, + linux_os_config: Optional["_models.LinuxOSConfig"] = None, enable_encryption_at_host: Optional[bool] = None, enable_ultra_ssd: Optional[bool] = None, enable_fips: Optional[bool] = None, - gpu_instance_profile: Optional[Union[str, "GPUInstanceProfile"]] = None, + gpu_instance_profile: Optional[Union[str, "_models.GPUInstanceProfile"]] = None, **kwargs ): """ @@ -301,11 +302,11 @@ def __init__( :keyword os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS - `_. Possible values - include: "Managed", "Ephemeral". + `_. Known values are: + "Managed", "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2021_07_01.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Possible values include: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_07_01.models.KubeletDiskType :keyword vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and @@ -319,11 +320,11 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2021_07_01.models.OSType :keyword os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Possible values include: "Ubuntu", "CBLMariner". + Known values are: "Ubuntu", "CBLMariner". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2021_07_01.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -332,17 +333,16 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, - it defaults to Delete. Possible values include: "Delete", "Deallocate". + it defaults to Delete. Known values are: "Delete", "Deallocate". :paramtype scale_down_mode: str or ~azure.mgmt.containerservice.v2021_07_01.models.ScaleDownMode - :keyword type_properties_type: The type of Agent Pool. Possible values include: + :keyword type_properties_type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type_properties_type: str or ~azure.mgmt.containerservice.v2021_07_01.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Possible values include: "System", - "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2021_07_01.models.AgentPoolMode :keyword orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -368,12 +368,12 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Possible values include: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_07_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Possible values include: "Delete", - "Deallocate". Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_07_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which @@ -405,7 +405,7 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2021_07_01.models.GPUInstanceProfile @@ -482,7 +482,7 @@ class AgentPoolAvailableVersions(msrest.serialization.Model): def __init__( self, *, - agent_pool_versions: Optional[List["AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem"]] = None, + agent_pool_versions: Optional[List["_models.AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem"]] = None, **kwargs ): """ @@ -559,7 +559,7 @@ class AgentPoolListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["AgentPool"]] = None, + value: Optional[List["_models.AgentPool"]] = None, **kwargs ): """ @@ -586,8 +586,8 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): :vartype type: str :ivar kubernetes_version: Required. The Kubernetes version (major.minor.patch). :vartype kubernetes_version: str - :ivar os_type: Required. The operating system type. The default is Linux. Possible values - include: "Linux", "Windows". Default value: "Linux". + :ivar os_type: Required. The operating system type. The default is Linux. Known values are: + "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2021_07_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -618,16 +618,16 @@ def __init__( self, *, kubernetes_version: str, - os_type: Union[str, "OSType"] = "Linux", - upgrades: Optional[List["AgentPoolUpgradeProfilePropertiesUpgradesItem"]] = None, + os_type: Union[str, "_models.OSType"] = "Linux", + upgrades: Optional[List["_models.AgentPoolUpgradeProfilePropertiesUpgradesItem"]] = None, latest_node_image_version: Optional[str] = None, **kwargs ): """ :keyword kubernetes_version: Required. The Kubernetes version (major.minor.patch). :paramtype kubernetes_version: str - :keyword os_type: Required. The operating system type. The default is Linux. Possible values - include: "Linux", "Windows". Default value: "Linux". + :keyword os_type: Required. The operating system type. The default is Linux. Known values are: + "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2021_07_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: @@ -739,7 +739,7 @@ def __init__( code: Optional[str] = None, message: Optional[str] = None, target: Optional[str] = None, - details: Optional[List["CloudErrorBody"]] = None, + details: Optional[List["_models.CloudErrorBody"]] = None, **kwargs ): """ @@ -783,7 +783,7 @@ class ContainerServiceDiagnosticsProfile(msrest.serialization.Model): def __init__( self, *, - vm_diagnostics: "ContainerServiceVMDiagnostics", + vm_diagnostics: "_models.ContainerServiceVMDiagnostics", **kwargs ): """ @@ -820,7 +820,7 @@ def __init__( self, *, admin_username: str, - ssh: "ContainerServiceSshConfiguration", + ssh: "_models.ContainerServiceSshConfiguration", **kwargs ): """ @@ -843,17 +843,17 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar count: Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, - and 5. The default value is 1. Possible values include: 1, 3, 5. Default value: "1". + and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". :vartype count: int or ~azure.mgmt.containerservice.v2021_07_01.models.Count :ivar dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. :vartype dns_prefix: str - :ivar vm_size: Required. Size of agent VMs. Possible values include: "Standard_A1", - "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", - "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", - "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", - "Standard_A8m_v2", "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", - "Standard_B8ms", "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", - "Standard_D12", "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", + :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", + "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", + "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", + "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", "Standard_B8ms", + "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", "Standard_D12", + "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", "Standard_D13_v2_Promo", "Standard_D14", "Standard_D14_v2", "Standard_D14_v2_Promo", "Standard_D15_v2", "Standard_D16_v3", "Standard_D16s_v3", "Standard_D1_v2", "Standard_D2", "Standard_D2_v2", "Standard_D2_v2_Promo", "Standard_D2_v3", "Standard_D2s_v3", "Standard_D3", @@ -898,7 +898,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): :vartype first_consecutive_static_ip: str :ivar storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Possible values include: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". :vartype storage_profile: str or ~azure.mgmt.containerservice.v2021_07_01.models.ContainerServiceStorageProfileTypes :ivar fqdn: FQDN for the master pool. @@ -927,27 +927,27 @@ def __init__( self, *, dns_prefix: str, - vm_size: Union[str, "ContainerServiceVMSizeTypes"], - count: Optional[Union[int, "Count"]] = 1, + vm_size: Union[str, "_models.ContainerServiceVMSizeTypes"], + count: Optional[Union[int, "_models.Count"]] = 1, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, first_consecutive_static_ip: Optional[str] = "10.240.255.5", - storage_profile: Optional[Union[str, "ContainerServiceStorageProfileTypes"]] = None, + storage_profile: Optional[Union[str, "_models.ContainerServiceStorageProfileTypes"]] = None, **kwargs ): """ :keyword count: Number of masters (VMs) in the container service cluster. Allowed values are 1, - 3, and 5. The default value is 1. Possible values include: 1, 3, 5. Default value: "1". + 3, and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". :paramtype count: int or ~azure.mgmt.containerservice.v2021_07_01.models.Count :keyword dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. :paramtype dns_prefix: str - :keyword vm_size: Required. Size of agent VMs. Possible values include: "Standard_A1", - "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", - "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", - "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", - "Standard_A8m_v2", "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", - "Standard_B8ms", "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", - "Standard_D12", "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", + :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", + "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", + "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", + "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", "Standard_B8ms", + "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", "Standard_D12", + "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", "Standard_D13_v2_Promo", "Standard_D14", "Standard_D14_v2", "Standard_D14_v2_Promo", "Standard_D15_v2", "Standard_D16_v3", "Standard_D16s_v3", "Standard_D1_v2", "Standard_D2", "Standard_D2_v2", "Standard_D2_v2_Promo", "Standard_D2_v3", "Standard_D2s_v3", "Standard_D3", @@ -992,7 +992,7 @@ def __init__( :paramtype first_consecutive_static_ip: str :keyword storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Possible values include: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". :paramtype storage_profile: str or ~azure.mgmt.containerservice.v2021_07_01.models.ContainerServiceStorageProfileTypes """ @@ -1010,14 +1010,14 @@ def __init__( class ContainerServiceNetworkProfile(msrest.serialization.Model): """Profile of network configuration. - :ivar network_plugin: Network plugin used for building the Kubernetes network. Possible values - include: "azure", "kubenet". Default value: "kubenet". + :ivar network_plugin: Network plugin used for building the Kubernetes network. Known values + are: "azure", "kubenet". Default value: "kubenet". :vartype network_plugin: str or ~azure.mgmt.containerservice.v2021_07_01.models.NetworkPlugin - :ivar network_policy: Network policy used for building the Kubernetes network. Possible values - include: "calico", "azure". + :ivar network_policy: Network policy used for building the Kubernetes network. Known values + are: "calico", "azure". :vartype network_policy: str or ~azure.mgmt.containerservice.v2021_07_01.models.NetworkPolicy :ivar network_mode: This cannot be specified if networkPlugin is anything other than 'azure'. - Possible values include: "transparent", "bridge". + Known values are: "transparent", "bridge". :vartype network_mode: str or ~azure.mgmt.containerservice.v2021_07_01.models.NetworkMode :ivar pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :vartype pod_cidr: str @@ -1032,13 +1032,13 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): :vartype docker_bridge_cidr: str :ivar outbound_type: This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type - `_. Possible values include: - "loadBalancer", "userDefinedRouting", "managedNATGateway", "userAssignedNATGateway". Default - value: "loadBalancer". + `_. Known values are: "loadBalancer", + "userDefinedRouting", "managedNATGateway", "userAssignedNATGateway". Default value: + "loadBalancer". :vartype outbound_type: str or ~azure.mgmt.containerservice.v2021_07_01.models.OutboundType :ivar load_balancer_sku: The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the - differences between load balancer SKUs. Possible values include: "standard", "basic". + differences between load balancer SKUs. Known values are: "standard", "basic". :vartype load_balancer_sku: str or ~azure.mgmt.containerservice.v2021_07_01.models.LoadBalancerSku :ivar load_balancer_profile: Profile of the cluster load balancer. @@ -1073,28 +1073,28 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): def __init__( self, *, - network_plugin: Optional[Union[str, "NetworkPlugin"]] = "kubenet", - network_policy: Optional[Union[str, "NetworkPolicy"]] = None, - network_mode: Optional[Union[str, "NetworkMode"]] = None, + network_plugin: Optional[Union[str, "_models.NetworkPlugin"]] = "kubenet", + network_policy: Optional[Union[str, "_models.NetworkPolicy"]] = None, + network_mode: Optional[Union[str, "_models.NetworkMode"]] = None, pod_cidr: Optional[str] = "10.244.0.0/16", service_cidr: Optional[str] = "10.0.0.0/16", dns_service_ip: Optional[str] = "10.0.0.10", docker_bridge_cidr: Optional[str] = "172.17.0.1/16", - outbound_type: Optional[Union[str, "OutboundType"]] = "loadBalancer", - load_balancer_sku: Optional[Union[str, "LoadBalancerSku"]] = None, - load_balancer_profile: Optional["ManagedClusterLoadBalancerProfile"] = None, - nat_gateway_profile: Optional["ManagedClusterNATGatewayProfile"] = None, + outbound_type: Optional[Union[str, "_models.OutboundType"]] = "loadBalancer", + load_balancer_sku: Optional[Union[str, "_models.LoadBalancerSku"]] = None, + load_balancer_profile: Optional["_models.ManagedClusterLoadBalancerProfile"] = None, + nat_gateway_profile: Optional["_models.ManagedClusterNATGatewayProfile"] = None, **kwargs ): """ - :keyword network_plugin: Network plugin used for building the Kubernetes network. Possible - values include: "azure", "kubenet". Default value: "kubenet". + :keyword network_plugin: Network plugin used for building the Kubernetes network. Known values + are: "azure", "kubenet". Default value: "kubenet". :paramtype network_plugin: str or ~azure.mgmt.containerservice.v2021_07_01.models.NetworkPlugin - :keyword network_policy: Network policy used for building the Kubernetes network. Possible - values include: "calico", "azure". + :keyword network_policy: Network policy used for building the Kubernetes network. Known values + are: "calico", "azure". :paramtype network_policy: str or ~azure.mgmt.containerservice.v2021_07_01.models.NetworkPolicy :keyword network_mode: This cannot be specified if networkPlugin is anything other than - 'azure'. Possible values include: "transparent", "bridge". + 'azure'. Known values are: "transparent", "bridge". :paramtype network_mode: str or ~azure.mgmt.containerservice.v2021_07_01.models.NetworkMode :keyword pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :paramtype pod_cidr: str @@ -1109,13 +1109,13 @@ def __init__( :paramtype docker_bridge_cidr: str :keyword outbound_type: This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type - `_. Possible values include: - "loadBalancer", "userDefinedRouting", "managedNATGateway", "userAssignedNATGateway". Default - value: "loadBalancer". + `_. Known values are: "loadBalancer", + "userDefinedRouting", "managedNATGateway", "userAssignedNATGateway". Default value: + "loadBalancer". :paramtype outbound_type: str or ~azure.mgmt.containerservice.v2021_07_01.models.OutboundType :keyword load_balancer_sku: The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the - differences between load balancer SKUs. Possible values include: "standard", "basic". + differences between load balancer SKUs. Known values are: "standard", "basic". :paramtype load_balancer_sku: str or ~azure.mgmt.containerservice.v2021_07_01.models.LoadBalancerSku :keyword load_balancer_profile: Profile of the cluster load balancer. @@ -1161,7 +1161,7 @@ class ContainerServiceSshConfiguration(msrest.serialization.Model): def __init__( self, *, - public_keys: List["ContainerServiceSshPublicKey"], + public_keys: List["_models.ContainerServiceSshPublicKey"], **kwargs ): """ @@ -1322,7 +1322,7 @@ def __init__( self, *, domain_name: Optional[str] = None, - endpoint_details: Optional[List["EndpointDetail"]] = None, + endpoint_details: Optional[List["_models.EndpointDetail"]] = None, **kwargs ): """ @@ -1388,7 +1388,7 @@ class ExtendedLocation(msrest.serialization.Model): :ivar name: The name of the extended location. :vartype name: str - :ivar type: The type of the extended location. Possible values include: "EdgeZone". + :ivar type: The type of the extended location. Known values are: "EdgeZone". :vartype type: str or ~azure.mgmt.containerservice.v2021_07_01.models.ExtendedLocationTypes """ @@ -1401,13 +1401,13 @@ def __init__( self, *, name: Optional[str] = None, - type: Optional[Union[str, "ExtendedLocationTypes"]] = None, + type: Optional[Union[str, "_models.ExtendedLocationTypes"]] = None, **kwargs ): """ :keyword name: The name of the extended location. :paramtype name: str - :keyword type: The type of the extended location. Possible values include: "EdgeZone". + :keyword type: The type of the extended location. Known values are: "EdgeZone". :paramtype type: str or ~azure.mgmt.containerservice.v2021_07_01.models.ExtendedLocationTypes """ super(ExtendedLocation, self).__init__(**kwargs) @@ -1566,7 +1566,7 @@ class LinuxOSConfig(msrest.serialization.Model): def __init__( self, *, - sysctls: Optional["SysctlConfig"] = None, + sysctls: Optional["_models.SysctlConfig"] = None, transparent_huge_page_enabled: Optional[str] = None, transparent_huge_page_defrag: Optional[str] = None, swap_file_size_mb: Optional[int] = None, @@ -1634,8 +1634,8 @@ class MaintenanceConfiguration(SubResource): def __init__( self, *, - time_in_week: Optional[List["TimeInWeek"]] = None, - not_allowed_time: Optional[List["TimeSpan"]] = None, + time_in_week: Optional[List["_models.TimeInWeek"]] = None, + not_allowed_time: Optional[List["_models.TimeSpan"]] = None, **kwargs ): """ @@ -1674,7 +1674,7 @@ class MaintenanceConfigurationListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["MaintenanceConfiguration"]] = None, + value: Optional[List["_models.MaintenanceConfiguration"]] = None, **kwargs ): """ @@ -1912,32 +1912,32 @@ def __init__( *, location: str, tags: Optional[Dict[str, str]] = None, - sku: Optional["ManagedClusterSKU"] = None, - extended_location: Optional["ExtendedLocation"] = None, - identity: Optional["ManagedClusterIdentity"] = None, + sku: Optional["_models.ManagedClusterSKU"] = None, + extended_location: Optional["_models.ExtendedLocation"] = None, + identity: Optional["_models.ManagedClusterIdentity"] = None, kubernetes_version: Optional[str] = None, dns_prefix: Optional[str] = None, fqdn_subdomain: Optional[str] = None, - agent_pool_profiles: Optional[List["ManagedClusterAgentPoolProfile"]] = None, - linux_profile: Optional["ContainerServiceLinuxProfile"] = None, - windows_profile: Optional["ManagedClusterWindowsProfile"] = None, - service_principal_profile: Optional["ManagedClusterServicePrincipalProfile"] = None, - addon_profiles: Optional[Dict[str, "ManagedClusterAddonProfile"]] = None, - pod_identity_profile: Optional["ManagedClusterPodIdentityProfile"] = None, + agent_pool_profiles: Optional[List["_models.ManagedClusterAgentPoolProfile"]] = None, + linux_profile: Optional["_models.ContainerServiceLinuxProfile"] = None, + windows_profile: Optional["_models.ManagedClusterWindowsProfile"] = None, + service_principal_profile: Optional["_models.ManagedClusterServicePrincipalProfile"] = None, + addon_profiles: Optional[Dict[str, "_models.ManagedClusterAddonProfile"]] = None, + pod_identity_profile: Optional["_models.ManagedClusterPodIdentityProfile"] = None, node_resource_group: Optional[str] = None, enable_rbac: Optional[bool] = None, enable_pod_security_policy: Optional[bool] = None, - network_profile: Optional["ContainerServiceNetworkProfile"] = None, - aad_profile: Optional["ManagedClusterAADProfile"] = None, - auto_upgrade_profile: Optional["ManagedClusterAutoUpgradeProfile"] = None, - auto_scaler_profile: Optional["ManagedClusterPropertiesAutoScalerProfile"] = None, - api_server_access_profile: Optional["ManagedClusterAPIServerAccessProfile"] = None, + network_profile: Optional["_models.ContainerServiceNetworkProfile"] = None, + aad_profile: Optional["_models.ManagedClusterAADProfile"] = None, + auto_upgrade_profile: Optional["_models.ManagedClusterAutoUpgradeProfile"] = None, + auto_scaler_profile: Optional["_models.ManagedClusterPropertiesAutoScalerProfile"] = None, + api_server_access_profile: Optional["_models.ManagedClusterAPIServerAccessProfile"] = None, disk_encryption_set_id: Optional[str] = None, - identity_profile: Optional[Dict[str, "UserAssignedIdentity"]] = None, - private_link_resources: Optional[List["PrivateLinkResource"]] = None, + identity_profile: Optional[Dict[str, "_models.UserAssignedIdentity"]] = None, + private_link_resources: Optional[List["_models.PrivateLinkResource"]] = None, disable_local_accounts: Optional[bool] = None, - http_proxy_config: Optional["ManagedClusterHTTPProxyConfig"] = None, - security_profile: Optional["ManagedClusterSecurityProfile"] = None, + http_proxy_config: Optional["_models.ManagedClusterHTTPProxyConfig"] = None, + security_profile: Optional["_models.ManagedClusterSecurityProfile"] = None, **kwargs ): """ @@ -2331,11 +2331,11 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS - `_. Possible values - include: "Managed", "Ephemeral". + `_. Known values are: + "Managed", "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2021_07_01.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Possible values include: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_07_01.models.KubeletDiskType :ivar vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and used. @@ -2349,11 +2349,11 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2021_07_01.models.OSType - :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Possible values include: "Ubuntu", "CBLMariner". + :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known + values are: "Ubuntu", "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2021_07_01.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. :vartype max_count: int @@ -2362,15 +2362,14 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it - defaults to Delete. Possible values include: "Delete", "Deallocate". + defaults to Delete. Known values are: "Delete", "Deallocate". :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2021_07_01.models.ScaleDownMode - :ivar type: The type of Agent Pool. Possible values include: "VirtualMachineScaleSets", + :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2021_07_01.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Possible values include: "System", - "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". :vartype mode: str or ~azure.mgmt.containerservice.v2021_07_01.models.AgentPoolMode :ivar orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -2402,12 +2401,12 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Possible values include: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_07_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Possible values include: "Delete", - "Deallocate". Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_07_01.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which @@ -2439,7 +2438,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2021_07_01.models.GPUInstanceProfile """ @@ -2497,37 +2496,37 @@ def __init__( count: Optional[int] = None, vm_size: Optional[str] = None, os_disk_size_gb: Optional[int] = None, - os_disk_type: Optional[Union[str, "OSDiskType"]] = None, - kubelet_disk_type: Optional[Union[str, "KubeletDiskType"]] = None, + os_disk_type: Optional[Union[str, "_models.OSDiskType"]] = None, + kubelet_disk_type: Optional[Union[str, "_models.KubeletDiskType"]] = None, vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", - os_sku: Optional[Union[str, "OSSKU"]] = None, + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - scale_down_mode: Optional[Union[str, "ScaleDownMode"]] = None, - type: Optional[Union[str, "AgentPoolType"]] = None, - mode: Optional[Union[str, "AgentPoolMode"]] = None, + scale_down_mode: Optional[Union[str, "_models.ScaleDownMode"]] = None, + type: Optional[Union[str, "_models.AgentPoolType"]] = None, + mode: Optional[Union[str, "_models.AgentPoolMode"]] = None, orchestrator_version: Optional[str] = None, - upgrade_settings: Optional["AgentPoolUpgradeSettings"] = None, + upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", spot_max_price: Optional[float] = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, proximity_placement_group_id: Optional[str] = None, - kubelet_config: Optional["KubeletConfig"] = None, - linux_os_config: Optional["LinuxOSConfig"] = None, + kubelet_config: Optional["_models.KubeletConfig"] = None, + linux_os_config: Optional["_models.LinuxOSConfig"] = None, enable_encryption_at_host: Optional[bool] = None, enable_ultra_ssd: Optional[bool] = None, enable_fips: Optional[bool] = None, - gpu_instance_profile: Optional[Union[str, "GPUInstanceProfile"]] = None, + gpu_instance_profile: Optional[Union[str, "_models.GPUInstanceProfile"]] = None, **kwargs ): """ @@ -2546,11 +2545,11 @@ def __init__( :keyword os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS - `_. Possible values - include: "Managed", "Ephemeral". + `_. Known values are: + "Managed", "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2021_07_01.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Possible values include: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_07_01.models.KubeletDiskType :keyword vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and @@ -2564,11 +2563,11 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2021_07_01.models.OSType :keyword os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Possible values include: "Ubuntu", "CBLMariner". + Known values are: "Ubuntu", "CBLMariner". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2021_07_01.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -2577,16 +2576,15 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, - it defaults to Delete. Possible values include: "Delete", "Deallocate". + it defaults to Delete. Known values are: "Delete", "Deallocate". :paramtype scale_down_mode: str or ~azure.mgmt.containerservice.v2021_07_01.models.ScaleDownMode - :keyword type: The type of Agent Pool. Possible values include: "VirtualMachineScaleSets", + :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2021_07_01.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Possible values include: "System", - "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2021_07_01.models.AgentPoolMode :keyword orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -2612,12 +2610,12 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Possible values include: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_07_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Possible values include: "Delete", - "Deallocate". Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_07_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which @@ -2649,7 +2647,7 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2021_07_01.models.GPUInstanceProfile @@ -2716,11 +2714,11 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS - `_. Possible values - include: "Managed", "Ephemeral". + `_. Known values are: + "Managed", "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2021_07_01.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Possible values include: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_07_01.models.KubeletDiskType :ivar vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and used. @@ -2734,11 +2732,11 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2021_07_01.models.OSType - :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Possible values include: "Ubuntu", "CBLMariner". + :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known + values are: "Ubuntu", "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2021_07_01.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. :vartype max_count: int @@ -2747,15 +2745,14 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it - defaults to Delete. Possible values include: "Delete", "Deallocate". + defaults to Delete. Known values are: "Delete", "Deallocate". :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2021_07_01.models.ScaleDownMode - :ivar type: The type of Agent Pool. Possible values include: "VirtualMachineScaleSets", + :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2021_07_01.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Possible values include: "System", - "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". :vartype mode: str or ~azure.mgmt.containerservice.v2021_07_01.models.AgentPoolMode :ivar orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -2787,12 +2784,12 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Possible values include: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_07_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Possible values include: "Delete", - "Deallocate". Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_07_01.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which @@ -2824,7 +2821,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2021_07_01.models.GPUInstanceProfile :ivar name: Required. Windows agent pool names must be 6 characters or less. @@ -2887,37 +2884,37 @@ def __init__( count: Optional[int] = None, vm_size: Optional[str] = None, os_disk_size_gb: Optional[int] = None, - os_disk_type: Optional[Union[str, "OSDiskType"]] = None, - kubelet_disk_type: Optional[Union[str, "KubeletDiskType"]] = None, + os_disk_type: Optional[Union[str, "_models.OSDiskType"]] = None, + kubelet_disk_type: Optional[Union[str, "_models.KubeletDiskType"]] = None, vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", - os_sku: Optional[Union[str, "OSSKU"]] = None, + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - scale_down_mode: Optional[Union[str, "ScaleDownMode"]] = None, - type: Optional[Union[str, "AgentPoolType"]] = None, - mode: Optional[Union[str, "AgentPoolMode"]] = None, + scale_down_mode: Optional[Union[str, "_models.ScaleDownMode"]] = None, + type: Optional[Union[str, "_models.AgentPoolType"]] = None, + mode: Optional[Union[str, "_models.AgentPoolMode"]] = None, orchestrator_version: Optional[str] = None, - upgrade_settings: Optional["AgentPoolUpgradeSettings"] = None, + upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", spot_max_price: Optional[float] = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, proximity_placement_group_id: Optional[str] = None, - kubelet_config: Optional["KubeletConfig"] = None, - linux_os_config: Optional["LinuxOSConfig"] = None, + kubelet_config: Optional["_models.KubeletConfig"] = None, + linux_os_config: Optional["_models.LinuxOSConfig"] = None, enable_encryption_at_host: Optional[bool] = None, enable_ultra_ssd: Optional[bool] = None, enable_fips: Optional[bool] = None, - gpu_instance_profile: Optional[Union[str, "GPUInstanceProfile"]] = None, + gpu_instance_profile: Optional[Union[str, "_models.GPUInstanceProfile"]] = None, **kwargs ): """ @@ -2936,11 +2933,11 @@ def __init__( :keyword os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS - `_. Possible values - include: "Managed", "Ephemeral". + `_. Known values are: + "Managed", "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2021_07_01.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Possible values include: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_07_01.models.KubeletDiskType :keyword vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and @@ -2954,11 +2951,11 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2021_07_01.models.OSType :keyword os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Possible values include: "Ubuntu", "CBLMariner". + Known values are: "Ubuntu", "CBLMariner". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2021_07_01.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -2967,16 +2964,15 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, - it defaults to Delete. Possible values include: "Delete", "Deallocate". + it defaults to Delete. Known values are: "Delete", "Deallocate". :paramtype scale_down_mode: str or ~azure.mgmt.containerservice.v2021_07_01.models.ScaleDownMode - :keyword type: The type of Agent Pool. Possible values include: "VirtualMachineScaleSets", + :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2021_07_01.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Possible values include: "System", - "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2021_07_01.models.AgentPoolMode :keyword orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -3002,12 +2998,12 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Possible values include: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_07_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Possible values include: "Delete", - "Deallocate". Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_07_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which @@ -3039,7 +3035,7 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2021_07_01.models.GPUInstanceProfile @@ -3114,8 +3110,8 @@ class ManagedClusterAutoUpgradeProfile(msrest.serialization.Model): """Auto upgrade profile for a managed cluster. :ivar upgrade_channel: For more information see `setting the AKS cluster auto-upgrade channel - `_. Possible - values include: "rapid", "stable", "patch", "node-image", "none". + `_. Known values + are: "rapid", "stable", "patch", "node-image", "none". :vartype upgrade_channel: str or ~azure.mgmt.containerservice.v2021_07_01.models.UpgradeChannel """ @@ -3126,13 +3122,13 @@ class ManagedClusterAutoUpgradeProfile(msrest.serialization.Model): def __init__( self, *, - upgrade_channel: Optional[Union[str, "UpgradeChannel"]] = None, + upgrade_channel: Optional[Union[str, "_models.UpgradeChannel"]] = None, **kwargs ): """ :keyword upgrade_channel: For more information see `setting the AKS cluster auto-upgrade channel `_. - Possible values include: "rapid", "stable", "patch", "node-image", "none". + Known values are: "rapid", "stable", "patch", "node-image", "none". :paramtype upgrade_channel: str or ~azure.mgmt.containerservice.v2021_07_01.models.UpgradeChannel """ @@ -3198,7 +3194,7 @@ class ManagedClusterIdentity(msrest.serialization.Model): components. :vartype tenant_id: str :ivar type: For more information see `use managed identities in AKS - `_. Possible values include: + `_. Known values are: "SystemAssigned", "UserAssigned", "None". :vartype type: str or ~azure.mgmt.containerservice.v2021_07_01.models.ResourceIdentityType :ivar user_assigned_identities: The keys must be ARM resource IDs in the form: @@ -3222,13 +3218,13 @@ class ManagedClusterIdentity(msrest.serialization.Model): def __init__( self, *, - type: Optional[Union[str, "ResourceIdentityType"]] = None, - user_assigned_identities: Optional[Dict[str, "ManagedServiceIdentityUserAssignedIdentitiesValue"]] = None, + type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, + user_assigned_identities: Optional[Dict[str, "_models.ManagedServiceIdentityUserAssignedIdentitiesValue"]] = None, **kwargs ): """ :keyword type: For more information see `use managed identities in AKS - `_. Possible values include: + `_. Known values are: "SystemAssigned", "UserAssigned", "None". :paramtype type: str or ~azure.mgmt.containerservice.v2021_07_01.models.ResourceIdentityType :keyword user_assigned_identities: The keys must be ARM resource IDs in the form: @@ -3266,7 +3262,7 @@ class ManagedClusterListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["ManagedCluster"]] = None, + value: Optional[List["_models.ManagedCluster"]] = None, **kwargs ): """ @@ -3320,10 +3316,10 @@ class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): def __init__( self, *, - managed_outbound_i_ps: Optional["ManagedClusterLoadBalancerProfileManagedOutboundIPs"] = None, - outbound_ip_prefixes: Optional["ManagedClusterLoadBalancerProfileOutboundIPPrefixes"] = None, - outbound_i_ps: Optional["ManagedClusterLoadBalancerProfileOutboundIPs"] = None, - effective_outbound_i_ps: Optional[List["ResourceReference"]] = None, + managed_outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileManagedOutboundIPs"] = None, + outbound_ip_prefixes: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPPrefixes"] = None, + outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPs"] = None, + effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, allocated_outbound_ports: Optional[int] = 0, idle_timeout_in_minutes: Optional[int] = 30, **kwargs @@ -3407,7 +3403,7 @@ class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.M def __init__( self, *, - public_ip_prefixes: Optional[List["ResourceReference"]] = None, + public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, **kwargs ): """ @@ -3433,7 +3429,7 @@ class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): def __init__( self, *, - public_i_ps: Optional[List["ResourceReference"]] = None, + public_i_ps: Optional[List["_models.ResourceReference"]] = None, **kwargs ): """ @@ -3503,8 +3499,8 @@ class ManagedClusterNATGatewayProfile(msrest.serialization.Model): def __init__( self, *, - managed_outbound_ip_profile: Optional["ManagedClusterManagedOutboundIPProfile"] = None, - effective_outbound_i_ps: Optional[List["ResourceReference"]] = None, + managed_outbound_ip_profile: Optional["_models.ManagedClusterManagedOutboundIPProfile"] = None, + effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, idle_timeout_in_minutes: Optional[int] = 4, **kwargs ): @@ -3542,8 +3538,8 @@ class ManagedClusterPodIdentity(msrest.serialization.Model): :vartype binding_selector: str :ivar identity: Required. The user assigned identity details. :vartype identity: ~azure.mgmt.containerservice.v2021_07_01.models.UserAssignedIdentity - :ivar provisioning_state: The current provisioning state of the pod identity. Possible values - include: "Assigned", "Updating", "Deleting", "Failed". + :ivar provisioning_state: The current provisioning state of the pod identity. Known values are: + "Assigned", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2021_07_01.models.ManagedClusterPodIdentityProvisioningState :ivar provisioning_info: @@ -3573,7 +3569,7 @@ def __init__( *, name: str, namespace: str, - identity: "UserAssignedIdentity", + identity: "_models.UserAssignedIdentity", binding_selector: Optional[str] = None, **kwargs ): @@ -3674,8 +3670,8 @@ def __init__( *, enabled: Optional[bool] = None, allow_network_plugin_kubenet: Optional[bool] = None, - user_assigned_identities: Optional[List["ManagedClusterPodIdentity"]] = None, - user_assigned_identity_exceptions: Optional[List["ManagedClusterPodIdentityException"]] = None, + user_assigned_identities: Optional[List["_models.ManagedClusterPodIdentity"]] = None, + user_assigned_identity_exceptions: Optional[List["_models.ManagedClusterPodIdentityException"]] = None, **kwargs ): """ @@ -3716,7 +3712,7 @@ class ManagedClusterPodIdentityProvisioningError(msrest.serialization.Model): def __init__( self, *, - error: Optional["ManagedClusterPodIdentityProvisioningErrorBody"] = None, + error: Optional["_models.ManagedClusterPodIdentityProvisioningErrorBody"] = None, **kwargs ): """ @@ -3758,7 +3754,7 @@ def __init__( code: Optional[str] = None, message: Optional[str] = None, target: Optional[str] = None, - details: Optional[List["ManagedClusterPodIdentityProvisioningErrorBody"]] = None, + details: Optional[List["_models.ManagedClusterPodIdentityProvisioningErrorBody"]] = None, **kwargs ): """ @@ -3797,7 +3793,7 @@ class ManagedClusterPodIdentityProvisioningInfo(msrest.serialization.Model): def __init__( self, *, - error: Optional["ManagedClusterPodIdentityProvisioningError"] = None, + error: Optional["_models.ManagedClusterPodIdentityProvisioningError"] = None, **kwargs ): """ @@ -3818,8 +3814,8 @@ class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): :vartype kubernetes_version: str :ivar name: The Agent Pool name. :vartype name: str - :ivar os_type: Required. The operating system type. The default is Linux. Possible values - include: "Linux", "Windows". Default value: "Linux". + :ivar os_type: Required. The operating system type. The default is Linux. Known values are: + "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2021_07_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -3842,9 +3838,9 @@ def __init__( self, *, kubernetes_version: str, - os_type: Union[str, "OSType"] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", name: Optional[str] = None, - upgrades: Optional[List["ManagedClusterPoolUpgradeProfileUpgradesItem"]] = None, + upgrades: Optional[List["_models.ManagedClusterPoolUpgradeProfileUpgradesItem"]] = None, **kwargs ): """ @@ -3852,8 +3848,8 @@ def __init__( :paramtype kubernetes_version: str :keyword name: The Agent Pool name. :paramtype name: str - :keyword os_type: Required. The operating system type. The default is Linux. Possible values - include: "Linux", "Windows". Default value: "Linux". + :keyword os_type: Required. The operating system type. The default is Linux. Known values are: + "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2021_07_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: @@ -3905,8 +3901,7 @@ class ManagedClusterPropertiesAutoScalerProfile(msrest.serialization.Model): :vartype balance_similar_node_groups: str :ivar expander: If not specified, the default is 'random'. See `expanders `_ - for more information. Possible values include: "least-waste", "most-pods", "priority", - "random". + for more information. Known values are: "least-waste", "most-pods", "priority", "random". :vartype expander: str or ~azure.mgmt.containerservice.v2021_07_01.models.Expander :ivar max_empty_bulk_delete: The default is 10. :vartype max_empty_bulk_delete: str @@ -3973,7 +3968,7 @@ def __init__( self, *, balance_similar_node_groups: Optional[str] = None, - expander: Optional[Union[str, "Expander"]] = None, + expander: Optional[Union[str, "_models.Expander"]] = None, max_empty_bulk_delete: Optional[str] = None, max_graceful_termination_sec: Optional[str] = None, max_node_provision_time: Optional[str] = None, @@ -3996,8 +3991,7 @@ def __init__( :paramtype balance_similar_node_groups: str :keyword expander: If not specified, the default is 'random'. See `expanders `_ - for more information. Possible values include: "least-waste", "most-pods", "priority", - "random". + for more information. Known values are: "least-waste", "most-pods", "priority", "random". :paramtype expander: str or ~azure.mgmt.containerservice.v2021_07_01.models.Expander :keyword max_empty_bulk_delete: The default is 10. :paramtype max_empty_bulk_delete: str @@ -4075,7 +4069,7 @@ class ManagedClusterSecurityProfile(msrest.serialization.Model): def __init__( self, *, - azure_defender: Optional["ManagedClusterSecurityProfileAzureDefender"] = None, + azure_defender: Optional["_models.ManagedClusterSecurityProfileAzureDefender"] = None, **kwargs ): """ @@ -4166,11 +4160,11 @@ def __init__( class ManagedClusterSKU(msrest.serialization.Model): """The SKU of a Managed Cluster. - :ivar name: The name of a managed cluster SKU. Possible values include: "Basic". + :ivar name: The name of a managed cluster SKU. Known values are: "Basic". :vartype name: str or ~azure.mgmt.containerservice.v2021_07_01.models.ManagedClusterSKUName :ivar tier: If not specified, the default is 'Free'. See `uptime SLA - `_ for more details. Possible values include: - "Paid", "Free". + `_ for more details. Known values are: "Paid", + "Free". :vartype tier: str or ~azure.mgmt.containerservice.v2021_07_01.models.ManagedClusterSKUTier """ @@ -4182,16 +4176,16 @@ class ManagedClusterSKU(msrest.serialization.Model): def __init__( self, *, - name: Optional[Union[str, "ManagedClusterSKUName"]] = None, - tier: Optional[Union[str, "ManagedClusterSKUTier"]] = None, + name: Optional[Union[str, "_models.ManagedClusterSKUName"]] = None, + tier: Optional[Union[str, "_models.ManagedClusterSKUTier"]] = None, **kwargs ): """ - :keyword name: The name of a managed cluster SKU. Possible values include: "Basic". + :keyword name: The name of a managed cluster SKU. Known values are: "Basic". :paramtype name: str or ~azure.mgmt.containerservice.v2021_07_01.models.ManagedClusterSKUName :keyword tier: If not specified, the default is 'Free'. See `uptime SLA - `_ for more details. Possible values include: - "Paid", "Free". + `_ for more details. Known values are: "Paid", + "Free". :paramtype tier: str or ~azure.mgmt.containerservice.v2021_07_01.models.ManagedClusterSKUTier """ super(ManagedClusterSKU, self).__init__(**kwargs) @@ -4240,8 +4234,8 @@ class ManagedClusterUpgradeProfile(msrest.serialization.Model): def __init__( self, *, - control_plane_profile: "ManagedClusterPoolUpgradeProfile", - agent_pool_profiles: List["ManagedClusterPoolUpgradeProfile"], + control_plane_profile: "_models.ManagedClusterPoolUpgradeProfile", + agent_pool_profiles: List["_models.ManagedClusterPoolUpgradeProfile"], **kwargs ): """ @@ -4283,8 +4277,8 @@ class ManagedClusterWindowsProfile(msrest.serialization.Model): "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!". :vartype admin_password: str :ivar license_type: The license type to use for Windows VMs. See `Azure Hybrid User Benefits - `_ for more details. Possible values - include: "None", "Windows_Server". + `_ for more details. Known values are: + "None", "Windows_Server". :vartype license_type: str or ~azure.mgmt.containerservice.v2021_07_01.models.LicenseType :ivar enable_csi_proxy: For more details on CSI proxy, see the `CSI proxy GitHub repo `_. @@ -4307,7 +4301,7 @@ def __init__( *, admin_username: str, admin_password: Optional[str] = None, - license_type: Optional[Union[str, "LicenseType"]] = None, + license_type: Optional[Union[str, "_models.LicenseType"]] = None, enable_csi_proxy: Optional[bool] = None, **kwargs ): @@ -4329,8 +4323,8 @@ def __init__( "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!". :paramtype admin_password: str :keyword license_type: The license type to use for Windows VMs. See `Azure Hybrid User Benefits - `_ for more details. Possible values - include: "None", "Windows_Server". + `_ for more details. Known values are: + "None", "Windows_Server". :paramtype license_type: str or ~azure.mgmt.containerservice.v2021_07_01.models.LicenseType :keyword enable_csi_proxy: For more details on CSI proxy, see the `CSI proxy GitHub repo `_. @@ -4489,7 +4483,7 @@ class OSOptionProfile(msrest.serialization.Model): def __init__( self, *, - os_option_property_list: List["OSOptionProperty"], + os_option_property_list: List["_models.OSOptionProperty"], **kwargs ): """ @@ -4562,7 +4556,7 @@ def __init__( self, *, category: Optional[str] = None, - endpoints: Optional[List["EndpointDependency"]] = None, + endpoints: Optional[List["_models.EndpointDependency"]] = None, **kwargs ): """ @@ -4604,7 +4598,7 @@ class OutboundEnvironmentEndpointCollection(msrest.serialization.Model): def __init__( self, *, - value: List["OutboundEnvironmentEndpoint"], + value: List["_models.OutboundEnvironmentEndpoint"], **kwargs ): """ @@ -4620,8 +4614,8 @@ def __init__( class PowerState(msrest.serialization.Model): """Describes the Power State of the cluster. - :ivar code: Tells whether the cluster is Running or Stopped. Possible values include: - "Running", "Stopped". + :ivar code: Tells whether the cluster is Running or Stopped. Known values are: "Running", + "Stopped". :vartype code: str or ~azure.mgmt.containerservice.v2021_07_01.models.Code """ @@ -4632,12 +4626,12 @@ class PowerState(msrest.serialization.Model): def __init__( self, *, - code: Optional[Union[str, "Code"]] = None, + code: Optional[Union[str, "_models.Code"]] = None, **kwargs ): """ - :keyword code: Tells whether the cluster is Running or Stopped. Possible values include: - "Running", "Stopped". + :keyword code: Tells whether the cluster is Running or Stopped. Known values are: "Running", + "Stopped". :paramtype code: str or ~azure.mgmt.containerservice.v2021_07_01.models.Code """ super(PowerState, self).__init__(**kwargs) @@ -4680,7 +4674,7 @@ class PrivateEndpointConnection(msrest.serialization.Model): :vartype name: str :ivar type: The resource type. :vartype type: str - :ivar provisioning_state: The current provisioning state. Possible values include: "Succeeded", + :ivar provisioning_state: The current provisioning state. Known values are: "Succeeded", "Creating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2021_07_01.models.PrivateEndpointConnectionProvisioningState @@ -4711,8 +4705,8 @@ class PrivateEndpointConnection(msrest.serialization.Model): def __init__( self, *, - private_endpoint: Optional["PrivateEndpoint"] = None, - private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, + private_endpoint: Optional["_models.PrivateEndpoint"] = None, + private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionState"] = None, **kwargs ): """ @@ -4746,7 +4740,7 @@ class PrivateEndpointConnectionListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["PrivateEndpointConnection"]] = None, + value: Optional[List["_models.PrivateEndpointConnection"]] = None, **kwargs ): """ @@ -4836,7 +4830,7 @@ class PrivateLinkResourcesListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["PrivateLinkResource"]] = None, + value: Optional[List["_models.PrivateLinkResource"]] = None, **kwargs ): """ @@ -4850,7 +4844,7 @@ def __init__( class PrivateLinkServiceConnectionState(msrest.serialization.Model): """The state of a private link service connection. - :ivar status: The private link service connection status. Possible values include: "Pending", + :ivar status: The private link service connection status. Known values are: "Pending", "Approved", "Rejected", "Disconnected". :vartype status: str or ~azure.mgmt.containerservice.v2021_07_01.models.ConnectionStatus :ivar description: The private link service connection description. @@ -4865,13 +4859,13 @@ class PrivateLinkServiceConnectionState(msrest.serialization.Model): def __init__( self, *, - status: Optional[Union[str, "ConnectionStatus"]] = None, + status: Optional[Union[str, "_models.ConnectionStatus"]] = None, description: Optional[str] = None, **kwargs ): """ - :keyword status: The private link service connection status. Possible values include: - "Pending", "Approved", "Rejected", "Disconnected". + :keyword status: The private link service connection status. Known values are: "Pending", + "Approved", "Rejected", "Disconnected". :paramtype status: str or ~azure.mgmt.containerservice.v2021_07_01.models.ConnectionStatus :keyword description: The private link service connection description. :paramtype description: str @@ -5227,15 +5221,15 @@ class SystemData(msrest.serialization.Model): :ivar created_by: The identity that created the resource. :vartype created_by: str - :ivar created_by_type: The type of identity that created the resource. Possible values include: + :ivar created_by_type: The type of identity that created the resource. Known values are: "User", "Application", "ManagedIdentity", "Key". :vartype created_by_type: str or ~azure.mgmt.containerservice.v2021_07_01.models.CreatedByType :ivar created_at: The UTC timestamp of resource creation. :vartype created_at: ~datetime.datetime :ivar last_modified_by: The identity that last modified the resource. :vartype last_modified_by: str - :ivar last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". + :ivar last_modified_by_type: The type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", "Key". :vartype last_modified_by_type: str or ~azure.mgmt.containerservice.v2021_07_01.models.CreatedByType :ivar last_modified_at: The type of identity that last modified the resource. @@ -5255,26 +5249,26 @@ def __init__( self, *, created_by: Optional[str] = None, - created_by_type: Optional[Union[str, "CreatedByType"]] = None, + created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, created_at: Optional[datetime.datetime] = None, last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[Union[str, "CreatedByType"]] = None, + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, last_modified_at: Optional[datetime.datetime] = None, **kwargs ): """ :keyword created_by: The identity that created the resource. :paramtype created_by: str - :keyword created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". + :keyword created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", "Key". :paramtype created_by_type: str or ~azure.mgmt.containerservice.v2021_07_01.models.CreatedByType :keyword created_at: The UTC timestamp of resource creation. :paramtype created_at: ~datetime.datetime :keyword last_modified_by: The identity that last modified the resource. :paramtype last_modified_by: str - :keyword last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". + :keyword last_modified_by_type: The type of identity that last modified the resource. Known + values are: "User", "Application", "ManagedIdentity", "Key". :paramtype last_modified_by_type: str or ~azure.mgmt.containerservice.v2021_07_01.models.CreatedByType :keyword last_modified_at: The type of identity that last modified the resource. @@ -5317,8 +5311,8 @@ def __init__( class TimeInWeek(msrest.serialization.Model): """Time in a week. - :ivar day: The day of the week. Possible values include: "Sunday", "Monday", "Tuesday", - "Wednesday", "Thursday", "Friday", "Saturday". + :ivar day: The day of the week. Known values are: "Sunday", "Monday", "Tuesday", "Wednesday", + "Thursday", "Friday", "Saturday". :vartype day: str or ~azure.mgmt.containerservice.v2021_07_01.models.WeekDay :ivar hour_slots: Each integer hour represents a time range beginning at 0m after the hour ending at the next hour (non-inclusive). 0 corresponds to 00:00 UTC, 23 corresponds to 23:00 @@ -5334,12 +5328,12 @@ class TimeInWeek(msrest.serialization.Model): def __init__( self, *, - day: Optional[Union[str, "WeekDay"]] = None, + day: Optional[Union[str, "_models.WeekDay"]] = None, hour_slots: Optional[List[int]] = None, **kwargs ): """ - :keyword day: The day of the week. Possible values include: "Sunday", "Monday", "Tuesday", + :keyword day: The day of the week. Known values are: "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday". :paramtype day: str or ~azure.mgmt.containerservice.v2021_07_01.models.WeekDay :keyword hour_slots: Each integer hour represents a time range beginning at 0m after the hour diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/models/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/models/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/operations/__init__.py index 3942e0ca6a01..f0e265d9f2f4 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/operations/__init__.py @@ -14,6 +14,9 @@ from ._private_link_resources_operations import PrivateLinkResourcesOperations from ._resolve_private_link_service_id_operations import ResolvePrivateLinkServiceIdOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'Operations', 'ManagedClustersOperations', @@ -23,3 +26,5 @@ 'PrivateLinkResourcesOperations', 'ResolvePrivateLinkServiceIdOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/operations/_agent_pools_operations.py index 9537fa082104..4c8bdf758b1c 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/operations/_agent_pools_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -35,9 +35,12 @@ def build_list_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools") # pylint: disable=line-too-long path_format_arguments = { @@ -49,18 +52,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -72,9 +73,12 @@ def build_get_request( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -87,18 +91,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -109,14 +111,17 @@ def build_create_or_update_request_initial( resource_name: str, agent_pool_name: str, *, - json: JSONType = None, + json: Optional[_models.AgentPool] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-07-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -129,20 +134,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -156,9 +159,12 @@ def build_delete_request_initial( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -171,18 +177,16 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -194,9 +198,12 @@ def build_get_upgrade_profile_request( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default") # pylint: disable=line-too-long path_format_arguments = { @@ -209,18 +216,16 @@ def build_get_upgrade_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -231,9 +236,12 @@ def build_get_available_agent_pool_versions_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions") # pylint: disable=line-too-long path_format_arguments = { @@ -245,18 +253,16 @@ def build_get_available_agent_pool_versions_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -268,9 +274,12 @@ def build_upgrade_node_image_version_request_initial( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion") # pylint: disable=line-too-long path_format_arguments = { @@ -283,42 +292,38 @@ def build_upgrade_node_image_version_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class AgentPoolsOperations(object): - """AgentPoolsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class AgentPoolsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_07_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_07_01.ContainerServiceClient`'s + :attr:`agent_pools` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -326,7 +331,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Iterable["_models.AgentPoolListResult"]: + ) -> Iterable[_models.AgentPoolListResult]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. @@ -341,13 +346,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_07_01.models.AgentPoolListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -357,9 +365,11 @@ def prepare_request(next_link=None): resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -369,9 +379,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -411,7 +423,7 @@ def get( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPool": + ) -> _models.AgentPool: """Gets the specified managed cluster agent pool. Gets the specified managed cluster agent pool. @@ -427,13 +439,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2021_07_01.models.AgentPool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] request = build_get_request( @@ -443,11 +458,13 @@ def get( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -473,17 +490,20 @@ def _create_or_update_initial( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> "_models.AgentPool": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] + ) -> _models.AgentPool: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] _json = self._serialize.body(parameters, 'AgentPool') @@ -496,11 +516,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -531,9 +553,9 @@ def begin_create_or_update( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> LROPoller["_models.AgentPool"]: + ) -> LROPoller[_models.AgentPool]: """Creates or updates an agent pool in the specified managed cluster. Creates or updates an agent pool in the specified managed cluster. @@ -559,17 +581,20 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_07_01.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, @@ -577,20 +602,27 @@ def begin_create_or_update( 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): - response = pipeline_response.http_response deserialized = self._deserialize('AgentPool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -610,13 +642,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements agent_pool_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -626,11 +661,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -677,21 +714,26 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-07-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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) @@ -701,8 +743,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -722,7 +770,7 @@ def get_upgrade_profile( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPoolUpgradeProfile": + ) -> _models.AgentPoolUpgradeProfile: """Gets the upgrade profile for an agent pool. Gets the upgrade profile for an agent pool. @@ -738,13 +786,16 @@ def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2021_07_01.models.AgentPoolUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] request = build_get_upgrade_profile_request( @@ -754,11 +805,13 @@ def get_upgrade_profile( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -785,7 +838,7 @@ def get_available_agent_pool_versions( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.AgentPoolAvailableVersions": + ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported Kubernetes versions for the specified agent pool. See `supported Kubernetes versions @@ -801,13 +854,16 @@ def get_available_agent_pool_versions( :rtype: ~azure.mgmt.containerservice.v2021_07_01.models.AgentPoolAvailableVersions :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolAvailableVersions"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] request = build_get_available_agent_pool_versions_request( @@ -816,11 +872,13 @@ def get_available_agent_pool_versions( resource_name=resource_name, api_version=api_version, template_url=self.get_available_agent_pool_versions.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -847,14 +905,17 @@ def _upgrade_node_image_version_initial( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> Optional["_models.AgentPool"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.AgentPool"]] + ) -> Optional[_models.AgentPool]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] request = build_upgrade_node_image_version_request_initial( @@ -864,11 +925,13 @@ def _upgrade_node_image_version_initial( agent_pool_name=agent_pool_name, api_version=api_version, template_url=self._upgrade_node_image_version_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -898,7 +961,7 @@ def begin_upgrade_node_image_version( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> LROPoller["_models.AgentPool"]: + ) -> LROPoller[_models.AgentPool]: """Upgrades the node image version of an agent pool to the latest. Upgrading the node image version of an agent pool applies the newest OS and runtime updates to @@ -924,35 +987,45 @@ def begin_upgrade_node_image_version( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_07_01.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._upgrade_node_image_version_initial( + raw_result = self._upgrade_node_image_version_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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): - response = pipeline_response.http_response deserialized = self._deserialize('AgentPool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/operations/_maintenance_configurations_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/operations/_maintenance_configurations_operations.py index f470648bfd4c..18481c77bffd 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/operations/_maintenance_configurations_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/operations/_maintenance_configurations_operations.py @@ -16,12 +16,12 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -33,9 +33,12 @@ def build_list_by_managed_cluster_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations") # pylint: disable=line-too-long path_format_arguments = { @@ -47,18 +50,16 @@ def build_list_by_managed_cluster_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -70,9 +71,12 @@ def build_get_request( config_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long path_format_arguments = { @@ -85,18 +89,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -107,14 +109,17 @@ def build_create_or_update_request( resource_name: str, config_name: str, *, - json: JSONType = None, + json: Optional[_models.MaintenanceConfiguration] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-07-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long path_format_arguments = { @@ -127,20 +132,18 @@ def build_create_or_update_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -154,9 +157,12 @@ def build_delete_request( config_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long path_format_arguments = { @@ -169,42 +175,38 @@ def build_delete_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class MaintenanceConfigurationsOperations(object): - """MaintenanceConfigurationsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class MaintenanceConfigurationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_07_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_07_01.ContainerServiceClient`'s + :attr:`maintenance_configurations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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_by_managed_cluster( @@ -212,7 +214,7 @@ def list_by_managed_cluster( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Iterable["_models.MaintenanceConfigurationListResult"]: + ) -> Iterable[_models.MaintenanceConfigurationListResult]: """Gets a list of maintenance configurations in the specified managed cluster. Gets a list of maintenance configurations in the specified managed cluster. @@ -228,13 +230,16 @@ def list_by_managed_cluster( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_07_01.models.MaintenanceConfigurationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfigurationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfigurationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -244,9 +249,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=self.list_by_managed_cluster.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -256,9 +263,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -298,7 +307,7 @@ def get( resource_name: str, config_name: str, **kwargs: Any - ) -> "_models.MaintenanceConfiguration": + ) -> _models.MaintenanceConfiguration: """Gets the specified maintenance configuration of a managed cluster. Gets the specified maintenance configuration of a managed cluster. @@ -314,13 +323,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2021_07_01.models.MaintenanceConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfiguration"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] request = build_get_request( @@ -330,11 +342,13 @@ def get( config_name=config_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -361,9 +375,9 @@ def create_or_update( resource_group_name: str, resource_name: str, config_name: str, - parameters: "_models.MaintenanceConfiguration", + parameters: _models.MaintenanceConfiguration, **kwargs: Any - ) -> "_models.MaintenanceConfiguration": + ) -> _models.MaintenanceConfiguration: """Creates or updates a maintenance configuration in the specified managed cluster. Creates or updates a maintenance configuration in the specified managed cluster. @@ -381,14 +395,17 @@ def create_or_update( :rtype: ~azure.mgmt.containerservice.v2021_07_01.models.MaintenanceConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfiguration"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] _json = self._serialize.body(parameters, 'MaintenanceConfiguration') @@ -401,11 +418,13 @@ def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -449,13 +468,16 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -465,11 +487,13 @@ def delete( # pylint: disable=inconsistent-return-statements config_name=config_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/operations/_managed_clusters_operations.py index 812e5c27e792..1f2ee126f4af 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/operations/_managed_clusters_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -36,9 +36,12 @@ def build_get_os_options_request( resource_type: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default") # pylint: disable=line-too-long path_format_arguments = { @@ -49,20 +52,18 @@ def build_get_os_options_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if resource_type is not None: - _query_parameters['resource-type'] = _SERIALIZER.query("resource_type", resource_type, 'str') + _params['resource-type'] = _SERIALIZER.query("resource_type", resource_type, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -71,9 +72,12 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters") path_format_arguments = { @@ -83,18 +87,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -104,9 +106,12 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters") # pylint: disable=line-too-long path_format_arguments = { @@ -117,18 +122,16 @@ def build_list_by_resource_group_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -139,9 +142,12 @@ def build_get_upgrade_profile_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default") # pylint: disable=line-too-long path_format_arguments = { @@ -153,18 +159,16 @@ def build_get_upgrade_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -176,9 +180,12 @@ def build_get_access_profile_request( role_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -191,18 +198,16 @@ def build_get_access_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -215,9 +220,12 @@ def build_list_cluster_admin_credentials_request( server_fqdn: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -229,20 +237,18 @@ def build_list_cluster_admin_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if server_fqdn is not None: - _query_parameters['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -255,9 +261,12 @@ def build_list_cluster_user_credentials_request( server_fqdn: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -269,20 +278,18 @@ def build_list_cluster_user_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if server_fqdn is not None: - _query_parameters['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -295,9 +302,12 @@ def build_list_cluster_monitoring_user_credentials_request( server_fqdn: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -309,20 +319,18 @@ def build_list_cluster_monitoring_user_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if server_fqdn is not None: - _query_parameters['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -333,9 +341,12 @@ def build_get_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -347,18 +358,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -368,14 +377,17 @@ def build_create_or_update_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedCluster] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-07-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -387,20 +399,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -412,14 +422,17 @@ def build_update_tags_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.TagsObject] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-07-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -431,20 +444,18 @@ def build_update_tags_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -457,9 +468,12 @@ def build_delete_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -471,18 +485,16 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -492,14 +504,17 @@ def build_reset_service_principal_profile_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedClusterServicePrincipalProfile] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-07-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile") # pylint: disable=line-too-long path_format_arguments = { @@ -511,20 +526,18 @@ def build_reset_service_principal_profile_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -536,14 +549,17 @@ def build_reset_aad_profile_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedClusterAADProfile] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-07-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile") # pylint: disable=line-too-long path_format_arguments = { @@ -555,20 +571,18 @@ def build_reset_aad_profile_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -581,9 +595,12 @@ def build_rotate_cluster_certificates_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates") # pylint: disable=line-too-long path_format_arguments = { @@ -595,18 +612,16 @@ def build_rotate_cluster_certificates_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -617,9 +632,12 @@ def build_stop_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop") # pylint: disable=line-too-long path_format_arguments = { @@ -631,18 +649,16 @@ def build_stop_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -653,9 +669,12 @@ def build_start_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start") # pylint: disable=line-too-long path_format_arguments = { @@ -667,18 +686,16 @@ def build_start_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -688,14 +705,17 @@ def build_run_command_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.RunCommandRequest] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-07-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand") # pylint: disable=line-too-long path_format_arguments = { @@ -707,20 +727,18 @@ def build_run_command_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -734,9 +752,12 @@ def build_get_command_result_request( command_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}") # pylint: disable=line-too-long path_format_arguments = { @@ -749,18 +770,16 @@ def build_get_command_result_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -771,9 +790,12 @@ def build_list_outbound_network_dependencies_endpoints_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints") # pylint: disable=line-too-long path_format_arguments = { @@ -785,42 +807,38 @@ def build_list_outbound_network_dependencies_endpoints_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class ManagedClustersOperations(object): # pylint: disable=too-many-public-methods - """ManagedClustersOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ManagedClustersOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_07_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_07_01.ContainerServiceClient`'s + :attr:`managed_clusters` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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_os_options( @@ -828,7 +846,7 @@ def get_os_options( location: str, resource_type: Optional[str] = None, **kwargs: Any - ) -> "_models.OSOptionProfile": + ) -> _models.OSOptionProfile: """Gets supported OS options in the specified subscription. Gets supported OS options in the specified subscription. @@ -843,13 +861,16 @@ def get_os_options( :rtype: ~azure.mgmt.containerservice.v2021_07_01.models.OSOptionProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OSOptionProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OSOptionProfile] request = build_get_os_options_request( @@ -858,11 +879,13 @@ def get_os_options( api_version=api_version, resource_type=resource_type, template_url=self.get_os_options.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -887,7 +910,7 @@ def get_os_options( def list( self, **kwargs: Any - ) -> Iterable["_models.ManagedClusterListResult"]: + ) -> Iterable[_models.ManagedClusterListResult]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. @@ -899,13 +922,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_07_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -913,9 +939,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -923,9 +951,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -963,7 +993,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.ManagedClusterListResult"]: + ) -> Iterable[_models.ManagedClusterListResult]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. @@ -977,13 +1007,16 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_07_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -992,9 +1025,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -1003,9 +1038,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -1044,7 +1081,7 @@ def get_upgrade_profile( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedClusterUpgradeProfile": + ) -> _models.ManagedClusterUpgradeProfile: """Gets the upgrade profile of a managed cluster. Gets the upgrade profile of a managed cluster. @@ -1058,13 +1095,16 @@ def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2021_07_01.models.ManagedClusterUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] request = build_get_upgrade_profile_request( @@ -1073,11 +1113,13 @@ def get_upgrade_profile( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1105,7 +1147,7 @@ def get_access_profile( resource_name: str, role_name: str, **kwargs: Any - ) -> "_models.ManagedClusterAccessProfile": + ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. **WARNING**\ : This API will be deprecated. Instead use `ListClusterUserCredentials @@ -1124,13 +1166,16 @@ def get_access_profile( :rtype: ~azure.mgmt.containerservice.v2021_07_01.models.ManagedClusterAccessProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterAccessProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] request = build_get_access_profile_request( @@ -1140,11 +1185,13 @@ def get_access_profile( role_name=role_name, api_version=api_version, template_url=self.get_access_profile.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1172,7 +1219,7 @@ def list_cluster_admin_credentials( resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Lists the admin credentials of a managed cluster. Lists the admin credentials of a managed cluster. @@ -1188,13 +1235,16 @@ def list_cluster_admin_credentials( :rtype: ~azure.mgmt.containerservice.v2021_07_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_admin_credentials_request( @@ -1204,11 +1254,13 @@ def list_cluster_admin_credentials( api_version=api_version, server_fqdn=server_fqdn, template_url=self.list_cluster_admin_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1236,7 +1288,7 @@ def list_cluster_user_credentials( resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Lists the user credentials of a managed cluster. Lists the user credentials of a managed cluster. @@ -1252,13 +1304,16 @@ def list_cluster_user_credentials( :rtype: ~azure.mgmt.containerservice.v2021_07_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_user_credentials_request( @@ -1268,11 +1323,13 @@ def list_cluster_user_credentials( api_version=api_version, server_fqdn=server_fqdn, template_url=self.list_cluster_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1300,7 +1357,7 @@ def list_cluster_monitoring_user_credentials( resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Lists the cluster monitoring user credentials of a managed cluster. Lists the cluster monitoring user credentials of a managed cluster. @@ -1316,13 +1373,16 @@ def list_cluster_monitoring_user_credentials( :rtype: ~azure.mgmt.containerservice.v2021_07_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_monitoring_user_credentials_request( @@ -1332,11 +1392,13 @@ def list_cluster_monitoring_user_credentials( api_version=api_version, server_fqdn=server_fqdn, template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1363,7 +1425,7 @@ def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedCluster": + ) -> _models.ManagedCluster: """Gets a managed cluster. Gets a managed cluster. @@ -1377,13 +1439,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2021_07_01.models.ManagedCluster :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] request = build_get_request( @@ -1392,11 +1457,13 @@ def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1421,17 +1488,20 @@ def _create_or_update_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'ManagedCluster') @@ -1443,11 +1513,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1477,9 +1549,9 @@ def begin_create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> LROPoller["_models.ManagedCluster"]: + ) -> LROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. Creates or updates a managed cluster. @@ -1504,37 +1576,47 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_07_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1551,17 +1633,20 @@ def _update_tags_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'TagsObject') @@ -1573,11 +1658,13 @@ def _update_tags_initial( content_type=content_type, json=_json, template_url=self._update_tags_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1603,9 +1690,9 @@ def begin_update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> LROPoller["_models.ManagedCluster"]: + ) -> LROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates tags on a managed cluster. @@ -1630,37 +1717,47 @@ def begin_update_tags( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_07_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._update_tags_initial( + raw_result = self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1679,13 +1776,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -1694,11 +1794,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1742,20 +1844,25 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-07-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_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) @@ -1765,8 +1872,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1783,17 +1896,20 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') @@ -1805,11 +1921,13 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re content_type=content_type, json=_json, template_url=self._reset_service_principal_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1831,7 +1949,7 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> LROPoller[None]: """Reset the Service Principal Profile of a managed cluster. @@ -1857,23 +1975,28 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._reset_service_principal_profile_initial( + raw_result = self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1883,8 +2006,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1901,17 +2030,20 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') @@ -1923,11 +2055,13 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement content_type=content_type, json=_json, template_url=self._reset_aad_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1949,7 +2083,7 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> LROPoller[None]: """Reset the AAD Profile of a managed cluster. @@ -1974,23 +2108,28 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._reset_aad_profile_initial( + raw_result = self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -2000,8 +2139,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2020,13 +2165,16 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_rotate_cluster_certificates_request_initial( @@ -2035,11 +2183,13 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return resource_name=resource_name, api_version=api_version, template_url=self._rotate_cluster_certificates_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2084,20 +2234,25 @@ def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-st :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-07-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._rotate_cluster_certificates_initial( + raw_result = self._rotate_cluster_certificates_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) @@ -2107,8 +2262,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2127,13 +2288,16 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_stop_request_initial( @@ -2142,11 +2306,13 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_name, api_version=api_version, template_url=self._stop_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2194,20 +2360,25 @@ def begin_stop( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-07-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._stop_initial( + raw_result = self._stop_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) @@ -2217,8 +2388,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2237,13 +2414,16 @@ def _start_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_start_request_initial( @@ -2252,11 +2432,13 @@ def _start_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_name, api_version=api_version, template_url=self._start_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2301,20 +2483,25 @@ def begin_start( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-07-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._start_initial( + raw_result = self._start_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) @@ -2324,8 +2511,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2342,17 +2535,20 @@ def _run_command_initial( self, resource_group_name: str, resource_name: str, - request_payload: "_models.RunCommandRequest", + request_payload: _models.RunCommandRequest, **kwargs: Any - ) -> Optional["_models.RunCommandResult"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RunCommandResult"]] + ) -> Optional[_models.RunCommandResult]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] _json = self._serialize.body(request_payload, 'RunCommandRequest') @@ -2364,11 +2560,13 @@ def _run_command_initial( content_type=content_type, json=_json, template_url=self._run_command_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2396,9 +2594,9 @@ def begin_run_command( self, resource_group_name: str, resource_name: str, - request_payload: "_models.RunCommandRequest", + request_payload: _models.RunCommandRequest, **kwargs: Any - ) -> LROPoller["_models.RunCommandResult"]: + ) -> LROPoller[_models.RunCommandResult]: """Submits a command to run against the Managed Cluster. AKS will create a pod to run the command. This is primarily useful for private clusters. For @@ -2425,37 +2623,47 @@ def begin_run_command( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_07_01.models.RunCommandResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.RunCommandResult] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._run_command_initial( + raw_result = self._run_command_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, request_payload=request_payload, 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): - response = pipeline_response.http_response deserialized = self._deserialize('RunCommandResult', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2475,7 +2683,7 @@ def get_command_result( resource_name: str, command_id: str, **kwargs: Any - ) -> Optional["_models.RunCommandResult"]: + ) -> Optional[_models.RunCommandResult]: """Gets the results of a command which has been run on the Managed Cluster. Gets the results of a command which has been run on the Managed Cluster. @@ -2491,13 +2699,16 @@ def get_command_result( :rtype: ~azure.mgmt.containerservice.v2021_07_01.models.RunCommandResult or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RunCommandResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] request = build_get_command_result_request( @@ -2507,11 +2718,13 @@ def get_command_result( command_id=command_id, api_version=api_version, template_url=self.get_command_result.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2540,7 +2753,7 @@ def list_outbound_network_dependencies_endpoints( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Iterable["_models.OutboundEnvironmentEndpointCollection"]: + ) -> Iterable[_models.OutboundEnvironmentEndpointCollection]: """Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. @@ -2558,13 +2771,16 @@ def list_outbound_network_dependencies_endpoints( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_07_01.models.OutboundEnvironmentEndpointCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OutboundEnvironmentEndpointCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -2574,9 +2790,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=self.list_outbound_network_dependencies_endpoints.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -2586,9 +2804,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/operations/_operations.py index f244de015dda..52dd4bcc98e8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/operations/_operations.py @@ -16,6 +16,7 @@ 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 @@ -29,55 +30,54 @@ def build_list_request( **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.ContainerService/operations") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class Operations(object): - """Operations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_07_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_07_01.ContainerServiceClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> Iterable["_models.OperationListResult"]: + ) -> Iterable[_models.OperationListResult]: """Gets a list of operations. Gets a list of operations. @@ -88,31 +88,38 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_07_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/operations/_private_endpoint_connections_operations.py index c7cce877f10d..f95d89d99430 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/operations/_private_endpoint_connections_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast from msrest import Serializer @@ -16,13 +16,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -34,9 +34,12 @@ def build_list_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections") # pylint: disable=line-too-long path_format_arguments = { @@ -48,18 +51,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -71,9 +72,12 @@ def build_get_request( private_endpoint_connection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -86,18 +90,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -108,14 +110,17 @@ def build_update_request( resource_name: str, private_endpoint_connection_name: str, *, - json: JSONType = None, + json: Optional[_models.PrivateEndpointConnection] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-07-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -128,20 +133,18 @@ def build_update_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -155,9 +158,12 @@ def build_delete_request_initial( private_endpoint_connection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -170,42 +176,38 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class PrivateEndpointConnectionsOperations(object): - """PrivateEndpointConnectionsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class PrivateEndpointConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_07_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_07_01.ContainerServiceClient`'s + :attr:`private_endpoint_connections` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -213,7 +215,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnectionListResult": + ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. To learn more about private clusters, see: @@ -228,13 +230,16 @@ def list( :rtype: ~azure.mgmt.containerservice.v2021_07_01.models.PrivateEndpointConnectionListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] request = build_list_request( @@ -243,11 +248,13 @@ def list( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -275,7 +282,7 @@ def get( resource_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Gets the specified private endpoint connection. To learn more about private clusters, see: @@ -292,13 +299,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2021_07_01.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] request = build_get_request( @@ -308,11 +318,13 @@ def get( private_endpoint_connection_name=private_endpoint_connection_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -339,9 +351,9 @@ def update( resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - parameters: "_models.PrivateEndpointConnection", + parameters: _models.PrivateEndpointConnection, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. Updates a private endpoint connection. @@ -359,14 +371,17 @@ def update( :rtype: ~azure.mgmt.containerservice.v2021_07_01.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] _json = self._serialize.body(parameters, 'PrivateEndpointConnection') @@ -379,11 +394,13 @@ def update( content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -411,13 +428,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -427,11 +447,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name=private_endpoint_connection_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -478,21 +500,26 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-07-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -502,8 +529,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/operations/_private_link_resources_operations.py index ed00a089129b..e0c1dbcdb114 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/operations/_private_link_resources_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/operations/_private_link_resources_operations.py @@ -15,6 +15,7 @@ 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 @@ -31,9 +32,12 @@ def build_list_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources") # pylint: disable=line-too-long path_format_arguments = { @@ -45,42 +49,38 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class PrivateLinkResourcesOperations(object): - """PrivateLinkResourcesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class PrivateLinkResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_07_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_07_01.ContainerServiceClient`'s + :attr:`private_link_resources` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -88,7 +88,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.PrivateLinkResourcesListResult": + ) -> _models.PrivateLinkResourcesListResult: """Gets a list of private link resources in the specified managed cluster. To learn more about private clusters, see: @@ -103,13 +103,16 @@ def list( :rtype: ~azure.mgmt.containerservice.v2021_07_01.models.PrivateLinkResourcesListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourcesListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] request = build_list_request( @@ -118,11 +121,13 @@ def list( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/operations/_resolve_private_link_service_id_operations.py index 17fa22596def..85a323a75cc9 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/operations/_resolve_private_link_service_id_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_07_01/operations/_resolve_private_link_service_id_operations.py @@ -15,12 +15,12 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -31,14 +31,17 @@ def build_post_request( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.PrivateLinkResource] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-07-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId") # pylint: disable=line-too-long path_format_arguments = { @@ -50,55 +53,51 @@ def build_post_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs ) -class ResolvePrivateLinkServiceIdOperations(object): - """ResolvePrivateLinkServiceIdOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ResolvePrivateLinkServiceIdOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_07_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_07_01.ContainerServiceClient`'s + :attr:`resolve_private_link_service_id` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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 post( self, resource_group_name: str, resource_name: str, - parameters: "_models.PrivateLinkResource", + parameters: _models.PrivateLinkResource, **kwargs: Any - ) -> "_models.PrivateLinkResource": + ) -> _models.PrivateLinkResource: """Gets the private link service ID for the specified managed cluster. Gets the private link service ID for the specified managed cluster. @@ -114,14 +113,17 @@ def post( :rtype: ~azure.mgmt.containerservice.v2021_07_01.models.PrivateLinkResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] _json = self._serialize.body(parameters, 'PrivateLinkResource') @@ -133,11 +135,13 @@ def post( content_type=content_type, json=_json, template_url=self.post.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/__init__.py index 53c675bd95e2..37a5f9e02e6f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._container_service_client import ContainerServiceClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['ContainerServiceClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/_container_service_client.py index 0b4688cb2c18..a3cb871d8336 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/_container_service_client.py @@ -74,14 +74,30 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.managed_clusters = ManagedClustersOperations(self._client, self._config, self._serialize, self._deserialize) - self.maintenance_configurations = MaintenanceConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) - self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) - self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations(self._client, self._config, self._serialize, self._deserialize) - self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_clusters = ManagedClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.maintenance_configurations = MaintenanceConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.agent_pools = AgentPoolsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.snapshots = SnapshotsOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/__init__.py index 53c675bd95e2..37a5f9e02e6f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._container_service_client import ContainerServiceClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['ContainerServiceClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/_container_service_client.py index c129399799aa..9211f22d2213 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/_container_service_client.py @@ -75,14 +75,30 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.managed_clusters = ManagedClustersOperations(self._client, self._config, self._serialize, self._deserialize) - self.maintenance_configurations = MaintenanceConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) - self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) - self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations(self._client, self._config, self._serialize, self._deserialize) - self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_clusters = ManagedClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.maintenance_configurations = MaintenanceConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.agent_pools = AgentPoolsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.snapshots = SnapshotsOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/operations/__init__.py index 5e1e5e72fa59..e0748876288c 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/operations/__init__.py @@ -15,6 +15,9 @@ from ._resolve_private_link_service_id_operations import ResolvePrivateLinkServiceIdOperations from ._snapshots_operations import SnapshotsOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'Operations', 'ManagedClustersOperations', @@ -25,3 +28,5 @@ 'ResolvePrivateLinkServiceIdOperations', 'SnapshotsOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/operations/_agent_pools_operations.py index 3e16bcfe4e6d..afdc0001f22c 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/operations/_agent_pools_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. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ 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 @@ -26,26 +27,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class AgentPoolsOperations: - """AgentPoolsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_08_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_08_01.aio.ContainerServiceClient`'s + :attr:`agent_pools` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -53,7 +52,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> AsyncIterable["_models.AgentPoolListResult"]: + ) -> AsyncIterable[_models.AgentPoolListResult]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. @@ -68,13 +67,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_08_01.models.AgentPoolListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -84,9 +86,11 @@ def prepare_request(next_link=None): resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -96,9 +100,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -138,7 +144,7 @@ async def get( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPool": + ) -> _models.AgentPool: """Gets the specified managed cluster agent pool. Gets the specified managed cluster agent pool. @@ -154,13 +160,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.AgentPool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] request = build_get_request( @@ -170,11 +179,13 @@ async def get( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -200,17 +211,20 @@ async def _create_or_update_initial( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> "_models.AgentPool": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] + ) -> _models.AgentPool: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-08-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] _json = self._serialize.body(parameters, 'AgentPool') @@ -223,11 +237,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -258,9 +274,9 @@ async def begin_create_or_update( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> AsyncLROPoller["_models.AgentPool"]: + ) -> AsyncLROPoller[_models.AgentPool]: """Creates or updates an agent pool in the specified managed cluster. Creates or updates an agent pool in the specified managed cluster. @@ -287,17 +303,20 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_08_01.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-08-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, @@ -305,20 +324,27 @@ async def begin_create_or_update( 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): - response = pipeline_response.http_response deserialized = self._deserialize('AgentPool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -338,13 +364,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements agent_pool_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -354,11 +383,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -405,21 +436,26 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-08-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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) @@ -429,8 +465,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -450,7 +492,7 @@ async def get_upgrade_profile( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPoolUpgradeProfile": + ) -> _models.AgentPoolUpgradeProfile: """Gets the upgrade profile for an agent pool. Gets the upgrade profile for an agent pool. @@ -466,13 +508,16 @@ async def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.AgentPoolUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] request = build_get_upgrade_profile_request( @@ -482,11 +527,13 @@ async def get_upgrade_profile( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -513,7 +560,7 @@ async def get_available_agent_pool_versions( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.AgentPoolAvailableVersions": + ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported Kubernetes versions for the specified agent pool. See `supported Kubernetes versions @@ -529,13 +576,16 @@ async def get_available_agent_pool_versions( :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.AgentPoolAvailableVersions :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolAvailableVersions"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] request = build_get_available_agent_pool_versions_request( @@ -544,11 +594,13 @@ async def get_available_agent_pool_versions( resource_name=resource_name, api_version=api_version, template_url=self.get_available_agent_pool_versions.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -575,14 +627,17 @@ async def _upgrade_node_image_version_initial( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> Optional["_models.AgentPool"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.AgentPool"]] + ) -> Optional[_models.AgentPool]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] request = build_upgrade_node_image_version_request_initial( @@ -592,11 +647,13 @@ async def _upgrade_node_image_version_initial( agent_pool_name=agent_pool_name, api_version=api_version, template_url=self._upgrade_node_image_version_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -626,7 +683,7 @@ async def begin_upgrade_node_image_version( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> AsyncLROPoller["_models.AgentPool"]: + ) -> AsyncLROPoller[_models.AgentPool]: """Upgrades the node image version of an agent pool to the latest. Upgrading the node image version of an agent pool applies the newest OS and runtime updates to @@ -653,35 +710,45 @@ async def begin_upgrade_node_image_version( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_08_01.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._upgrade_node_image_version_initial( + raw_result = await self._upgrade_node_image_version_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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): - response = pipeline_response.http_response deserialized = self._deserialize('AgentPool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/operations/_maintenance_configurations_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/operations/_maintenance_configurations_operations.py index 03b8b4b99620..c3a2a5767fbb 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/operations/_maintenance_configurations_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/operations/_maintenance_configurations_operations.py @@ -15,6 +15,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -24,26 +25,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class MaintenanceConfigurationsOperations: - """MaintenanceConfigurationsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_08_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_08_01.aio.ContainerServiceClient`'s + :attr:`maintenance_configurations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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_by_managed_cluster( @@ -51,7 +50,7 @@ def list_by_managed_cluster( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> AsyncIterable["_models.MaintenanceConfigurationListResult"]: + ) -> AsyncIterable[_models.MaintenanceConfigurationListResult]: """Gets a list of maintenance configurations in the specified managed cluster. Gets a list of maintenance configurations in the specified managed cluster. @@ -67,13 +66,16 @@ def list_by_managed_cluster( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_08_01.models.MaintenanceConfigurationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfigurationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfigurationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -83,9 +85,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=self.list_by_managed_cluster.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -95,9 +99,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -137,7 +143,7 @@ async def get( resource_name: str, config_name: str, **kwargs: Any - ) -> "_models.MaintenanceConfiguration": + ) -> _models.MaintenanceConfiguration: """Gets the specified maintenance configuration of a managed cluster. Gets the specified maintenance configuration of a managed cluster. @@ -153,13 +159,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.MaintenanceConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfiguration"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] request = build_get_request( @@ -169,11 +178,13 @@ async def get( config_name=config_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -200,9 +211,9 @@ async def create_or_update( resource_group_name: str, resource_name: str, config_name: str, - parameters: "_models.MaintenanceConfiguration", + parameters: _models.MaintenanceConfiguration, **kwargs: Any - ) -> "_models.MaintenanceConfiguration": + ) -> _models.MaintenanceConfiguration: """Creates or updates a maintenance configuration in the specified managed cluster. Creates or updates a maintenance configuration in the specified managed cluster. @@ -220,14 +231,17 @@ async def create_or_update( :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.MaintenanceConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfiguration"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-08-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] _json = self._serialize.body(parameters, 'MaintenanceConfiguration') @@ -240,11 +254,13 @@ async def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -288,13 +304,16 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -304,11 +323,13 @@ async def delete( # pylint: disable=inconsistent-return-statements config_name=config_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/operations/_managed_clusters_operations.py index be70ec665a60..c22a95020c9b 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/operations/_managed_clusters_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. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ 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 @@ -26,26 +27,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ManagedClustersOperations: # pylint: disable=too-many-public-methods - """ManagedClustersOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_08_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_08_01.aio.ContainerServiceClient`'s + :attr:`managed_clusters` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace_async async def get_os_options( @@ -53,7 +52,7 @@ async def get_os_options( location: str, resource_type: Optional[str] = None, **kwargs: Any - ) -> "_models.OSOptionProfile": + ) -> _models.OSOptionProfile: """Gets supported OS options in the specified subscription. Gets supported OS options in the specified subscription. @@ -68,13 +67,16 @@ async def get_os_options( :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.OSOptionProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OSOptionProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OSOptionProfile] request = build_get_os_options_request( @@ -83,11 +85,13 @@ async def get_os_options( api_version=api_version, resource_type=resource_type, template_url=self.get_os_options.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -112,7 +116,7 @@ async def get_os_options( def list( self, **kwargs: Any - ) -> AsyncIterable["_models.ManagedClusterListResult"]: + ) -> AsyncIterable[_models.ManagedClusterListResult]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. @@ -124,13 +128,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_08_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -138,9 +145,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -148,9 +157,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -188,7 +199,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ManagedClusterListResult"]: + ) -> AsyncIterable[_models.ManagedClusterListResult]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. @@ -202,13 +213,16 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_08_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -217,9 +231,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -228,9 +244,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -269,7 +287,7 @@ async def get_upgrade_profile( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedClusterUpgradeProfile": + ) -> _models.ManagedClusterUpgradeProfile: """Gets the upgrade profile of a managed cluster. Gets the upgrade profile of a managed cluster. @@ -283,13 +301,16 @@ async def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.ManagedClusterUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] request = build_get_upgrade_profile_request( @@ -298,11 +319,13 @@ async def get_upgrade_profile( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -330,7 +353,7 @@ async def get_access_profile( resource_name: str, role_name: str, **kwargs: Any - ) -> "_models.ManagedClusterAccessProfile": + ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. **WARNING**\ : This API will be deprecated. Instead use `ListClusterUserCredentials @@ -349,13 +372,16 @@ async def get_access_profile( :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.ManagedClusterAccessProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterAccessProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] request = build_get_access_profile_request( @@ -365,11 +391,13 @@ async def get_access_profile( role_name=role_name, api_version=api_version, template_url=self.get_access_profile.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -397,7 +425,7 @@ async def list_cluster_admin_credentials( resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Lists the admin credentials of a managed cluster. Lists the admin credentials of a managed cluster. @@ -413,13 +441,16 @@ async def list_cluster_admin_credentials( :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_admin_credentials_request( @@ -429,11 +460,13 @@ async def list_cluster_admin_credentials( api_version=api_version, server_fqdn=server_fqdn, template_url=self.list_cluster_admin_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -461,7 +494,7 @@ async def list_cluster_user_credentials( resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Lists the user credentials of a managed cluster. Lists the user credentials of a managed cluster. @@ -477,13 +510,16 @@ async def list_cluster_user_credentials( :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_user_credentials_request( @@ -493,11 +529,13 @@ async def list_cluster_user_credentials( api_version=api_version, server_fqdn=server_fqdn, template_url=self.list_cluster_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -525,7 +563,7 @@ async def list_cluster_monitoring_user_credentials( resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Lists the cluster monitoring user credentials of a managed cluster. Lists the cluster monitoring user credentials of a managed cluster. @@ -541,13 +579,16 @@ async def list_cluster_monitoring_user_credentials( :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_monitoring_user_credentials_request( @@ -557,11 +598,13 @@ async def list_cluster_monitoring_user_credentials( api_version=api_version, server_fqdn=server_fqdn, template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -588,7 +631,7 @@ async def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedCluster": + ) -> _models.ManagedCluster: """Gets a managed cluster. Gets a managed cluster. @@ -602,13 +645,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.ManagedCluster :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] request = build_get_request( @@ -617,11 +663,13 @@ async def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -646,17 +694,20 @@ async def _create_or_update_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-08-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'ManagedCluster') @@ -668,11 +719,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -702,9 +755,9 @@ async def begin_create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> AsyncLROPoller["_models.ManagedCluster"]: + ) -> AsyncLROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. Creates or updates a managed cluster. @@ -729,37 +782,47 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_08_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-08-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -776,17 +839,20 @@ async def _update_tags_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-08-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'TagsObject') @@ -798,11 +864,13 @@ async def _update_tags_initial( content_type=content_type, json=_json, template_url=self._update_tags_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -828,9 +896,9 @@ async def begin_update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> AsyncLROPoller["_models.ManagedCluster"]: + ) -> AsyncLROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates tags on a managed cluster. @@ -855,37 +923,47 @@ async def begin_update_tags( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_08_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-08-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._update_tags_initial( + raw_result = await self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -904,13 +982,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -919,11 +1000,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -967,20 +1050,25 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-08-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_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) @@ -990,8 +1078,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1008,17 +1102,20 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-08-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') @@ -1030,11 +1127,13 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist content_type=content_type, json=_json, template_url=self._reset_service_principal_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1056,7 +1155,7 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> AsyncLROPoller[None]: """Reset the Service Principal Profile of a managed cluster. @@ -1082,23 +1181,28 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-08-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._reset_service_principal_profile_initial( + raw_result = await self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1108,8 +1212,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1126,17 +1236,20 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-08-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') @@ -1148,11 +1261,13 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta content_type=content_type, json=_json, template_url=self._reset_aad_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1174,7 +1289,7 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> AsyncLROPoller[None]: """Reset the AAD Profile of a managed cluster. @@ -1199,23 +1314,28 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-08-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._reset_aad_profile_initial( + raw_result = await self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1225,8 +1345,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1245,13 +1371,16 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_rotate_cluster_certificates_request_initial( @@ -1260,11 +1389,13 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- resource_name=resource_name, api_version=api_version, template_url=self._rotate_cluster_certificates_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1309,20 +1440,25 @@ async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-ret :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-08-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._rotate_cluster_certificates_initial( + raw_result = await self._rotate_cluster_certificates_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) @@ -1332,8 +1468,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1352,13 +1494,16 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_stop_request_initial( @@ -1367,11 +1512,13 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_name, api_version=api_version, template_url=self._stop_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1419,20 +1566,25 @@ async def begin_stop( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-08-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._stop_initial( + raw_result = await self._stop_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) @@ -1442,8 +1594,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1462,13 +1620,16 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_start_request_initial( @@ -1477,11 +1638,13 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_name, api_version=api_version, template_url=self._start_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1526,20 +1689,25 @@ async def begin_start( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-08-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._start_initial( + raw_result = await self._start_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) @@ -1549,8 +1717,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1567,17 +1741,20 @@ async def _run_command_initial( self, resource_group_name: str, resource_name: str, - request_payload: "_models.RunCommandRequest", + request_payload: _models.RunCommandRequest, **kwargs: Any - ) -> Optional["_models.RunCommandResult"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RunCommandResult"]] + ) -> Optional[_models.RunCommandResult]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-08-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] _json = self._serialize.body(request_payload, 'RunCommandRequest') @@ -1589,11 +1766,13 @@ async def _run_command_initial( content_type=content_type, json=_json, template_url=self._run_command_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1621,9 +1800,9 @@ async def begin_run_command( self, resource_group_name: str, resource_name: str, - request_payload: "_models.RunCommandRequest", + request_payload: _models.RunCommandRequest, **kwargs: Any - ) -> AsyncLROPoller["_models.RunCommandResult"]: + ) -> AsyncLROPoller[_models.RunCommandResult]: """Submits a command to run against the Managed Cluster. AKS will create a pod to run the command. This is primarily useful for private clusters. For @@ -1650,37 +1829,47 @@ async def begin_run_command( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_08_01.models.RunCommandResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-08-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.RunCommandResult] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._run_command_initial( + raw_result = await self._run_command_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, request_payload=request_payload, 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): - response = pipeline_response.http_response deserialized = self._deserialize('RunCommandResult', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1700,7 +1889,7 @@ async def get_command_result( resource_name: str, command_id: str, **kwargs: Any - ) -> Optional["_models.RunCommandResult"]: + ) -> Optional[_models.RunCommandResult]: """Gets the results of a command which has been run on the Managed Cluster. Gets the results of a command which has been run on the Managed Cluster. @@ -1716,13 +1905,16 @@ async def get_command_result( :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.RunCommandResult or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RunCommandResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] request = build_get_command_result_request( @@ -1732,11 +1924,13 @@ async def get_command_result( command_id=command_id, api_version=api_version, template_url=self.get_command_result.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1765,7 +1959,7 @@ def list_outbound_network_dependencies_endpoints( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> AsyncIterable["_models.OutboundEnvironmentEndpointCollection"]: + ) -> AsyncIterable[_models.OutboundEnvironmentEndpointCollection]: """Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. @@ -1783,13 +1977,16 @@ def list_outbound_network_dependencies_endpoints( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_08_01.models.OutboundEnvironmentEndpointCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OutboundEnvironmentEndpointCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -1799,9 +1996,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=self.list_outbound_network_dependencies_endpoints.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -1811,9 +2010,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/operations/_operations.py index 05ed9625eb41..a42042da6dc9 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/operations/_operations.py @@ -14,6 +14,7 @@ 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 @@ -23,32 +24,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class Operations: - """Operations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_08_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_08_01.aio.ContainerServiceClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.OperationListResult"]: + ) -> AsyncIterable[_models.OperationListResult]: """Gets a list of operations. Gets a list of operations. @@ -59,31 +58,38 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_08_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/operations/_private_endpoint_connections_operations.py index 46314b1a13c5..e03d5930a1b2 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/operations/_private_endpoint_connections_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -14,6 +14,7 @@ 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 @@ -24,26 +25,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class PrivateEndpointConnectionsOperations: - """PrivateEndpointConnectionsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_08_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_08_01.aio.ContainerServiceClient`'s + :attr:`private_endpoint_connections` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -51,7 +50,7 @@ async def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnectionListResult": + ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. To learn more about private clusters, see: @@ -66,13 +65,16 @@ async def list( :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.PrivateEndpointConnectionListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] request = build_list_request( @@ -81,11 +83,13 @@ async def list( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -113,7 +117,7 @@ async def get( resource_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Gets the specified private endpoint connection. To learn more about private clusters, see: @@ -130,13 +134,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] request = build_get_request( @@ -146,11 +153,13 @@ async def get( private_endpoint_connection_name=private_endpoint_connection_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -177,9 +186,9 @@ async def update( resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - parameters: "_models.PrivateEndpointConnection", + parameters: _models.PrivateEndpointConnection, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. Updates a private endpoint connection. @@ -197,14 +206,17 @@ async def update( :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-08-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] _json = self._serialize.body(parameters, 'PrivateEndpointConnection') @@ -217,11 +229,13 @@ async def update( content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -249,13 +263,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -265,11 +282,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name=private_endpoint_connection_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -316,21 +335,26 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-08-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -340,8 +364,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/operations/_private_link_resources_operations.py index e313f0499505..ed4805ff59d3 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/operations/_private_link_resources_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/operations/_private_link_resources_operations.py @@ -13,6 +13,7 @@ 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 @@ -22,26 +23,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class PrivateLinkResourcesOperations: - """PrivateLinkResourcesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_08_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_08_01.aio.ContainerServiceClient`'s + :attr:`private_link_resources` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -49,7 +48,7 @@ async def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.PrivateLinkResourcesListResult": + ) -> _models.PrivateLinkResourcesListResult: """Gets a list of private link resources in the specified managed cluster. To learn more about private clusters, see: @@ -64,13 +63,16 @@ async def list( :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.PrivateLinkResourcesListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourcesListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] request = build_list_request( @@ -79,11 +81,13 @@ async def list( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/operations/_resolve_private_link_service_id_operations.py index 8a6ff346571b..6eed10383efd 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/operations/_resolve_private_link_service_id_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/operations/_resolve_private_link_service_id_operations.py @@ -13,6 +13,7 @@ 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 @@ -22,35 +23,33 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ResolvePrivateLinkServiceIdOperations: - """ResolvePrivateLinkServiceIdOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_08_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_08_01.aio.ContainerServiceClient`'s + :attr:`resolve_private_link_service_id` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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 post( self, resource_group_name: str, resource_name: str, - parameters: "_models.PrivateLinkResource", + parameters: _models.PrivateLinkResource, **kwargs: Any - ) -> "_models.PrivateLinkResource": + ) -> _models.PrivateLinkResource: """Gets the private link service ID for the specified managed cluster. Gets the private link service ID for the specified managed cluster. @@ -66,14 +65,17 @@ async def post( :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.PrivateLinkResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-08-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] _json = self._serialize.body(parameters, 'PrivateLinkResource') @@ -85,11 +87,13 @@ async def post( content_type=content_type, json=_json, template_url=self.post.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/operations/_snapshots_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/operations/_snapshots_operations.py index 15407e897ecd..2042f8feb05a 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/operations/_snapshots_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/aio/operations/_snapshots_operations.py @@ -15,6 +15,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -24,32 +25,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class SnapshotsOperations: - """SnapshotsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_08_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_08_01.aio.ContainerServiceClient`'s + :attr:`snapshots` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.SnapshotListResult"]: + ) -> AsyncIterable[_models.SnapshotListResult]: """Gets a list of snapshots in the specified subscription. Gets a list of snapshots in the specified subscription. @@ -60,13 +59,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_08_01.models.SnapshotListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -74,9 +76,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -84,9 +88,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -124,7 +130,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.SnapshotListResult"]: + ) -> AsyncIterable[_models.SnapshotListResult]: """Lists snapshots in the specified subscription and resource group. Lists snapshots in the specified subscription and resource group. @@ -137,13 +143,16 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_08_01.models.SnapshotListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -152,9 +161,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -163,9 +174,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -204,7 +217,7 @@ async def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.Snapshot": + ) -> _models.Snapshot: """Gets a snapshot. Gets a snapshot. @@ -218,13 +231,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.Snapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] request = build_get_request( @@ -233,11 +249,13 @@ async def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -263,9 +281,9 @@ async def create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.Snapshot", + parameters: _models.Snapshot, **kwargs: Any - ) -> "_models.Snapshot": + ) -> _models.Snapshot: """Creates or updates a snapshot. Creates or updates a snapshot. @@ -281,14 +299,17 @@ async def create_or_update( :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.Snapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-08-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] _json = self._serialize.body(parameters, 'Snapshot') @@ -300,11 +321,13 @@ async def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -334,9 +357,9 @@ async def update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.Snapshot": + ) -> _models.Snapshot: """Updates tags on a snapshot. Updates tags on a snapshot. @@ -352,14 +375,17 @@ async def update_tags( :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.Snapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-08-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] _json = self._serialize.body(parameters, 'TagsObject') @@ -371,11 +397,13 @@ async def update_tags( content_type=content_type, json=_json, template_url=self.update_tags.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -416,13 +444,16 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -431,11 +462,13 @@ async def delete( # pylint: disable=inconsistent-return-statements resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/models/__init__.py index db5980a4e09a..c36cee9c95c1 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/models/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/models/__init__.py @@ -129,7 +129,9 @@ WeekDay, WorkloadRuntime, ) - +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'AgentPool', 'AgentPoolAvailableVersions', @@ -251,3 +253,5 @@ 'WeekDay', 'WorkloadRuntime', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/models/_container_service_client_enums.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/models/_container_service_client_enums.py index 54490bab6467..ca3b2ccab3e1 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/models/_container_service_client_enums.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/models/_container_service_client_enums.py @@ -7,11 +7,10 @@ # -------------------------------------------------------------------------- from enum import Enum -from six import with_metaclass from azure.core import CaseInsensitiveEnumMeta -class AgentPoolMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class AgentPoolMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: https://docs.microsoft.com/azure/aks/use-system-pools @@ -24,7 +23,7 @@ class AgentPoolMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: User agent pools are primarily for hosting your application pods. USER = "User" -class AgentPoolType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class AgentPoolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of Agent Pool. """ @@ -33,7 +32,7 @@ class AgentPoolType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Use of this is strongly discouraged. AVAILABILITY_SET = "AvailabilitySet" -class Code(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class Code(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Tells whether the cluster is Running or Stopped """ @@ -42,7 +41,7 @@ class Code(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: The cluster is stopped. STOPPED = "Stopped" -class ConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The private link service connection status. """ @@ -51,7 +50,7 @@ class ConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): REJECTED = "Rejected" DISCONNECTED = "Disconnected" -class ContainerServiceStorageProfileTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Specifies what kind of storage to use. If omitted, the default will be chosen on your behalf based on the choice of orchestrator. """ @@ -59,7 +58,7 @@ class ContainerServiceStorageProfileTypes(with_metaclass(CaseInsensitiveEnumMeta STORAGE_ACCOUNT = "StorageAccount" MANAGED_DISKS = "ManagedDisks" -class ContainerServiceVMSizeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Size of agent VMs. Note: This is no longer maintained. """ @@ -238,7 +237,7 @@ class ContainerServiceVMSizeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, E STANDARD_NV24 = "Standard_NV24" STANDARD_NV6 = "Standard_NV6" -class Count(with_metaclass(CaseInsensitiveEnumMeta, int, Enum)): +class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): """Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, and 5. The default value is 1. """ @@ -247,7 +246,7 @@ class Count(with_metaclass(CaseInsensitiveEnumMeta, int, Enum)): THREE = 3 FIVE = 5 -class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of identity that created the resource. """ @@ -256,7 +255,7 @@ class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class Expander(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class Expander(str, Enum, metaclass=CaseInsensitiveEnumMeta): """If not specified, the default is 'random'. See `expanders `_ for more information. @@ -279,13 +278,13 @@ class Expander(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Used when you don't have a particular need for the node groups to scale differently. RANDOM = "random" -class ExtendedLocationTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ExtendedLocationTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of extendedLocation. """ EDGE_ZONE = "EdgeZone" -class GPUInstanceProfile(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class GPUInstanceProfile(str, Enum, metaclass=CaseInsensitiveEnumMeta): """GPUInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU. """ @@ -295,7 +294,7 @@ class GPUInstanceProfile(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MIG4_G = "MIG4g" MIG7_G = "MIG7g" -class KubeletDiskType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class KubeletDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. """ @@ -305,7 +304,7 @@ class KubeletDiskType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Kubelet will use the temporary disk for its data. TEMPORARY = "Temporary" -class LicenseType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class LicenseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The license type to use for Windows VMs. See `Azure Hybrid User Benefits `_ for more details. """ @@ -315,7 +314,7 @@ class LicenseType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Enables Azure Hybrid User Benefits for Windows VMs. WINDOWS_SERVER = "Windows_Server" -class LoadBalancerSku(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class LoadBalancerSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the differences between load balancer SKUs. @@ -328,7 +327,7 @@ class LoadBalancerSku(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Use a basic Load Balancer with limited functionality. BASIC = "basic" -class ManagedClusterPodIdentityProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ManagedClusterPodIdentityProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The current provisioning state of the pod identity. """ @@ -337,13 +336,13 @@ class ManagedClusterPodIdentityProvisioningState(with_metaclass(CaseInsensitiveE DELETING = "Deleting" FAILED = "Failed" -class ManagedClusterSKUName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ManagedClusterSKUName(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The name of a managed cluster SKU. """ BASIC = "Basic" -class ManagedClusterSKUTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ManagedClusterSKUTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): """If not specified, the default is 'Free'. See `uptime SLA `_ for more details. """ @@ -354,7 +353,7 @@ class ManagedClusterSKUTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: No guaranteed SLA, no additional charges. Free tier clusters have an SLO of 99.5%. FREE = "Free" -class NetworkMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """This cannot be specified if networkPlugin is anything other than 'azure'. """ @@ -365,7 +364,7 @@ class NetworkMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: This is no longer supported. BRIDGE = "bridge" -class NetworkPlugin(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkPlugin(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Network plugin used for building the Kubernetes network. """ @@ -378,7 +377,7 @@ class NetworkPlugin(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: information. KUBENET = "kubenet" -class NetworkPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Network policy used for building the Kubernetes network. """ @@ -391,7 +390,7 @@ class NetworkPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: for more information. AZURE = "azure" -class OSDiskType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OSDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS @@ -407,14 +406,14 @@ class OSDiskType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: provides lower read/write latency, along with faster node scaling and cluster upgrades. EPHEMERAL = "Ephemeral" -class OSSKU(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OSSKU(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Specifies an OS SKU. This value must not be specified if OSType is Windows. """ UBUNTU = "Ubuntu" CBL_MARINER = "CBLMariner" -class OSType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The operating system type. The default is Linux. """ @@ -423,7 +422,7 @@ class OSType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Use Windows. WINDOWS = "Windows" -class OutboundType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OutboundType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type `_. """ @@ -443,7 +442,7 @@ class OutboundType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: advanced scenario and requires proper network configuration. USER_ASSIGNED_NAT_GATEWAY = "userAssignedNATGateway" -class PrivateEndpointConnectionProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class PrivateEndpointConnectionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The current provisioning state. """ @@ -452,7 +451,7 @@ class PrivateEndpointConnectionProvisioningState(with_metaclass(CaseInsensitiveE DELETING = "Deleting" FAILED = "Failed" -class PublicNetworkAccess(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class PublicNetworkAccess(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Default value is 'Enabled' (case insensitive). Could be set to 'Disabled' to enable private cluster """ @@ -460,7 +459,7 @@ class PublicNetworkAccess(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): ENABLED = "Enabled" DISABLED = "Disabled" -class ResourceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """For more information see `use managed identities in AKS `_. """ @@ -476,7 +475,7 @@ class ResourceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Do not use a managed identity for the Managed Cluster, service principal will be used instead. NONE = "None" -class ScaleDownMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ScaleDownMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Describes how VMs are added to or removed from Agent Pools. See `billing states `_. """ @@ -487,7 +486,7 @@ class ScaleDownMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: during scale down. DEALLOCATE = "Deallocate" -class ScaleSetEvictionPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The eviction policy specifies what to do with the VM when it is evicted. The default is Delete. For more information about eviction see `spot VMs `_ @@ -500,7 +499,7 @@ class ScaleSetEvictionPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)) #: cause issues with cluster scaling or upgrading. DEALLOCATE = "Deallocate" -class ScaleSetPriority(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ScaleSetPriority(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The Virtual Machine Scale Set priority. """ @@ -510,14 +509,14 @@ class ScaleSetPriority(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Regular VMs will be used. REGULAR = "Regular" -class SnapshotType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SnapshotType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of a snapshot. The default is NodePool. """ #: The snapshot is a snapshot of a node pool. NODE_POOL = "NodePool" -class UpgradeChannel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class UpgradeChannel(str, Enum, metaclass=CaseInsensitiveEnumMeta): """For more information see `setting the AKS cluster auto-upgrade channel `_. """ @@ -547,7 +546,7 @@ class UpgradeChannel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Disables auto-upgrades and keeps the cluster at its current version of Kubernetes. NONE = "none" -class WeekDay(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class WeekDay(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The weekday enum. """ @@ -559,7 +558,7 @@ class WeekDay(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): FRIDAY = "Friday" SATURDAY = "Saturday" -class WorkloadRuntime(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class WorkloadRuntime(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Determines the type of workload a node can run. """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/models/_models_py3.py index 01bacec5b522..91b6add02111 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/models/_models_py3.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/models/_models_py3.py @@ -7,11 +7,13 @@ # -------------------------------------------------------------------------- import datetime -from typing import Dict, List, Optional, Union +from typing import Dict, List, Optional, TYPE_CHECKING, Union import msrest.serialization -from ._container_service_client_enums import * +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + import __init__ as _models class SubResource(msrest.serialization.Model): @@ -79,15 +81,15 @@ class AgentPool(SubResource): :ivar os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS - `_. Possible values - include: "Managed", "Ephemeral". + `_. Known values are: + "Managed", "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2021_08_01.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Possible values include: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_08_01.models.KubeletDiskType - :ivar workload_runtime: Determines the type of workload a node can run. Possible values - include: "OCIContainer", "WasmWasi". + :ivar workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer", "WasmWasi". :vartype workload_runtime: str or ~azure.mgmt.containerservice.v2021_08_01.models.WorkloadRuntime :ivar vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and used. @@ -101,11 +103,11 @@ class AgentPool(SubResource): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2021_08_01.models.OSType - :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Possible values include: "Ubuntu", "CBLMariner". + :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known + values are: "Ubuntu", "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2021_08_01.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. :vartype max_count: int @@ -114,16 +116,15 @@ class AgentPool(SubResource): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it - defaults to Delete. Possible values include: "Delete", "Deallocate". + defaults to Delete. Known values are: "Delete", "Deallocate". :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2021_08_01.models.ScaleDownMode - :ivar type_properties_type: The type of Agent Pool. Possible values include: + :ivar type_properties_type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :vartype type_properties_type: str or ~azure.mgmt.containerservice.v2021_08_01.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Possible values include: "System", - "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". :vartype mode: str or ~azure.mgmt.containerservice.v2021_08_01.models.AgentPoolMode :ivar orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -155,12 +156,12 @@ class AgentPool(SubResource): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Possible values include: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_08_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Possible values include: "Delete", - "Deallocate". Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_08_01.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which @@ -192,7 +193,7 @@ class AgentPool(SubResource): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2021_08_01.models.GPUInstanceProfile :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool @@ -261,39 +262,39 @@ def __init__( count: Optional[int] = None, vm_size: Optional[str] = None, os_disk_size_gb: Optional[int] = None, - os_disk_type: Optional[Union[str, "OSDiskType"]] = None, - kubelet_disk_type: Optional[Union[str, "KubeletDiskType"]] = None, - workload_runtime: Optional[Union[str, "WorkloadRuntime"]] = None, + os_disk_type: Optional[Union[str, "_models.OSDiskType"]] = None, + kubelet_disk_type: Optional[Union[str, "_models.KubeletDiskType"]] = None, + workload_runtime: Optional[Union[str, "_models.WorkloadRuntime"]] = None, vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", - os_sku: Optional[Union[str, "OSSKU"]] = None, + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - scale_down_mode: Optional[Union[str, "ScaleDownMode"]] = None, - type_properties_type: Optional[Union[str, "AgentPoolType"]] = None, - mode: Optional[Union[str, "AgentPoolMode"]] = None, + scale_down_mode: Optional[Union[str, "_models.ScaleDownMode"]] = None, + type_properties_type: Optional[Union[str, "_models.AgentPoolType"]] = None, + mode: Optional[Union[str, "_models.AgentPoolMode"]] = None, orchestrator_version: Optional[str] = None, - upgrade_settings: Optional["AgentPoolUpgradeSettings"] = None, + upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", spot_max_price: Optional[float] = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, proximity_placement_group_id: Optional[str] = None, - kubelet_config: Optional["KubeletConfig"] = None, - linux_os_config: Optional["LinuxOSConfig"] = None, + kubelet_config: Optional["_models.KubeletConfig"] = None, + linux_os_config: Optional["_models.LinuxOSConfig"] = None, enable_encryption_at_host: Optional[bool] = None, enable_ultra_ssd: Optional[bool] = None, enable_fips: Optional[bool] = None, - gpu_instance_profile: Optional[Union[str, "GPUInstanceProfile"]] = None, - creation_data: Optional["CreationData"] = None, + gpu_instance_profile: Optional[Union[str, "_models.GPUInstanceProfile"]] = None, + creation_data: Optional["_models.CreationData"] = None, **kwargs ): """ @@ -312,15 +313,15 @@ def __init__( :keyword os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS - `_. Possible values - include: "Managed", "Ephemeral". + `_. Known values are: + "Managed", "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2021_08_01.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Possible values include: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_08_01.models.KubeletDiskType - :keyword workload_runtime: Determines the type of workload a node can run. Possible values - include: "OCIContainer", "WasmWasi". + :keyword workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer", "WasmWasi". :paramtype workload_runtime: str or ~azure.mgmt.containerservice.v2021_08_01.models.WorkloadRuntime :keyword vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and @@ -334,11 +335,11 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2021_08_01.models.OSType :keyword os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Possible values include: "Ubuntu", "CBLMariner". + Known values are: "Ubuntu", "CBLMariner". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2021_08_01.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -347,17 +348,16 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, - it defaults to Delete. Possible values include: "Delete", "Deallocate". + it defaults to Delete. Known values are: "Delete", "Deallocate". :paramtype scale_down_mode: str or ~azure.mgmt.containerservice.v2021_08_01.models.ScaleDownMode - :keyword type_properties_type: The type of Agent Pool. Possible values include: + :keyword type_properties_type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type_properties_type: str or ~azure.mgmt.containerservice.v2021_08_01.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Possible values include: "System", - "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2021_08_01.models.AgentPoolMode :keyword orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -383,12 +383,12 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Possible values include: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_08_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Possible values include: "Delete", - "Deallocate". Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_08_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which @@ -420,7 +420,7 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2021_08_01.models.GPUInstanceProfile @@ -502,7 +502,7 @@ class AgentPoolAvailableVersions(msrest.serialization.Model): def __init__( self, *, - agent_pool_versions: Optional[List["AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem"]] = None, + agent_pool_versions: Optional[List["_models.AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem"]] = None, **kwargs ): """ @@ -579,7 +579,7 @@ class AgentPoolListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["AgentPool"]] = None, + value: Optional[List["_models.AgentPool"]] = None, **kwargs ): """ @@ -606,8 +606,8 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): :vartype type: str :ivar kubernetes_version: Required. The Kubernetes version (major.minor.patch). :vartype kubernetes_version: str - :ivar os_type: Required. The operating system type. The default is Linux. Possible values - include: "Linux", "Windows". Default value: "Linux". + :ivar os_type: Required. The operating system type. The default is Linux. Known values are: + "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2021_08_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -638,16 +638,16 @@ def __init__( self, *, kubernetes_version: str, - os_type: Union[str, "OSType"] = "Linux", - upgrades: Optional[List["AgentPoolUpgradeProfilePropertiesUpgradesItem"]] = None, + os_type: Union[str, "_models.OSType"] = "Linux", + upgrades: Optional[List["_models.AgentPoolUpgradeProfilePropertiesUpgradesItem"]] = None, latest_node_image_version: Optional[str] = None, **kwargs ): """ :keyword kubernetes_version: Required. The Kubernetes version (major.minor.patch). :paramtype kubernetes_version: str - :keyword os_type: Required. The operating system type. The default is Linux. Possible values - include: "Linux", "Windows". Default value: "Linux". + :keyword os_type: Required. The operating system type. The default is Linux. Known values are: + "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2021_08_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: @@ -759,7 +759,7 @@ def __init__( code: Optional[str] = None, message: Optional[str] = None, target: Optional[str] = None, - details: Optional[List["CloudErrorBody"]] = None, + details: Optional[List["_models.CloudErrorBody"]] = None, **kwargs ): """ @@ -803,7 +803,7 @@ class ContainerServiceDiagnosticsProfile(msrest.serialization.Model): def __init__( self, *, - vm_diagnostics: "ContainerServiceVMDiagnostics", + vm_diagnostics: "_models.ContainerServiceVMDiagnostics", **kwargs ): """ @@ -840,7 +840,7 @@ def __init__( self, *, admin_username: str, - ssh: "ContainerServiceSshConfiguration", + ssh: "_models.ContainerServiceSshConfiguration", **kwargs ): """ @@ -863,17 +863,17 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar count: Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, - and 5. The default value is 1. Possible values include: 1, 3, 5. Default value: "1". + and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". :vartype count: int or ~azure.mgmt.containerservice.v2021_08_01.models.Count :ivar dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. :vartype dns_prefix: str - :ivar vm_size: Required. Size of agent VMs. Possible values include: "Standard_A1", - "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", - "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", - "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", - "Standard_A8m_v2", "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", - "Standard_B8ms", "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", - "Standard_D12", "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", + :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", + "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", + "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", + "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", "Standard_B8ms", + "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", "Standard_D12", + "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", "Standard_D13_v2_Promo", "Standard_D14", "Standard_D14_v2", "Standard_D14_v2_Promo", "Standard_D15_v2", "Standard_D16_v3", "Standard_D16s_v3", "Standard_D1_v2", "Standard_D2", "Standard_D2_v2", "Standard_D2_v2_Promo", "Standard_D2_v3", "Standard_D2s_v3", "Standard_D3", @@ -918,7 +918,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): :vartype first_consecutive_static_ip: str :ivar storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Possible values include: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". :vartype storage_profile: str or ~azure.mgmt.containerservice.v2021_08_01.models.ContainerServiceStorageProfileTypes :ivar fqdn: FQDN for the master pool. @@ -947,27 +947,27 @@ def __init__( self, *, dns_prefix: str, - vm_size: Union[str, "ContainerServiceVMSizeTypes"], - count: Optional[Union[int, "Count"]] = 1, + vm_size: Union[str, "_models.ContainerServiceVMSizeTypes"], + count: Optional[Union[int, "_models.Count"]] = 1, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, first_consecutive_static_ip: Optional[str] = "10.240.255.5", - storage_profile: Optional[Union[str, "ContainerServiceStorageProfileTypes"]] = None, + storage_profile: Optional[Union[str, "_models.ContainerServiceStorageProfileTypes"]] = None, **kwargs ): """ :keyword count: Number of masters (VMs) in the container service cluster. Allowed values are 1, - 3, and 5. The default value is 1. Possible values include: 1, 3, 5. Default value: "1". + 3, and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". :paramtype count: int or ~azure.mgmt.containerservice.v2021_08_01.models.Count :keyword dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. :paramtype dns_prefix: str - :keyword vm_size: Required. Size of agent VMs. Possible values include: "Standard_A1", - "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", - "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", - "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", - "Standard_A8m_v2", "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", - "Standard_B8ms", "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", - "Standard_D12", "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", + :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", + "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", + "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", + "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", "Standard_B8ms", + "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", "Standard_D12", + "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", "Standard_D13_v2_Promo", "Standard_D14", "Standard_D14_v2", "Standard_D14_v2_Promo", "Standard_D15_v2", "Standard_D16_v3", "Standard_D16s_v3", "Standard_D1_v2", "Standard_D2", "Standard_D2_v2", "Standard_D2_v2_Promo", "Standard_D2_v3", "Standard_D2s_v3", "Standard_D3", @@ -1012,7 +1012,7 @@ def __init__( :paramtype first_consecutive_static_ip: str :keyword storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Possible values include: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". :paramtype storage_profile: str or ~azure.mgmt.containerservice.v2021_08_01.models.ContainerServiceStorageProfileTypes """ @@ -1030,14 +1030,14 @@ def __init__( class ContainerServiceNetworkProfile(msrest.serialization.Model): """Profile of network configuration. - :ivar network_plugin: Network plugin used for building the Kubernetes network. Possible values - include: "azure", "kubenet". Default value: "kubenet". + :ivar network_plugin: Network plugin used for building the Kubernetes network. Known values + are: "azure", "kubenet". Default value: "kubenet". :vartype network_plugin: str or ~azure.mgmt.containerservice.v2021_08_01.models.NetworkPlugin - :ivar network_policy: Network policy used for building the Kubernetes network. Possible values - include: "calico", "azure". + :ivar network_policy: Network policy used for building the Kubernetes network. Known values + are: "calico", "azure". :vartype network_policy: str or ~azure.mgmt.containerservice.v2021_08_01.models.NetworkPolicy :ivar network_mode: This cannot be specified if networkPlugin is anything other than 'azure'. - Possible values include: "transparent", "bridge". + Known values are: "transparent", "bridge". :vartype network_mode: str or ~azure.mgmt.containerservice.v2021_08_01.models.NetworkMode :ivar pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :vartype pod_cidr: str @@ -1052,13 +1052,13 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): :vartype docker_bridge_cidr: str :ivar outbound_type: This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type - `_. Possible values include: - "loadBalancer", "userDefinedRouting", "managedNATGateway", "userAssignedNATGateway". Default - value: "loadBalancer". + `_. Known values are: "loadBalancer", + "userDefinedRouting", "managedNATGateway", "userAssignedNATGateway". Default value: + "loadBalancer". :vartype outbound_type: str or ~azure.mgmt.containerservice.v2021_08_01.models.OutboundType :ivar load_balancer_sku: The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the - differences between load balancer SKUs. Possible values include: "standard", "basic". + differences between load balancer SKUs. Known values are: "standard", "basic". :vartype load_balancer_sku: str or ~azure.mgmt.containerservice.v2021_08_01.models.LoadBalancerSku :ivar load_balancer_profile: Profile of the cluster load balancer. @@ -1093,28 +1093,28 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): def __init__( self, *, - network_plugin: Optional[Union[str, "NetworkPlugin"]] = "kubenet", - network_policy: Optional[Union[str, "NetworkPolicy"]] = None, - network_mode: Optional[Union[str, "NetworkMode"]] = None, + network_plugin: Optional[Union[str, "_models.NetworkPlugin"]] = "kubenet", + network_policy: Optional[Union[str, "_models.NetworkPolicy"]] = None, + network_mode: Optional[Union[str, "_models.NetworkMode"]] = None, pod_cidr: Optional[str] = "10.244.0.0/16", service_cidr: Optional[str] = "10.0.0.0/16", dns_service_ip: Optional[str] = "10.0.0.10", docker_bridge_cidr: Optional[str] = "172.17.0.1/16", - outbound_type: Optional[Union[str, "OutboundType"]] = "loadBalancer", - load_balancer_sku: Optional[Union[str, "LoadBalancerSku"]] = None, - load_balancer_profile: Optional["ManagedClusterLoadBalancerProfile"] = None, - nat_gateway_profile: Optional["ManagedClusterNATGatewayProfile"] = None, + outbound_type: Optional[Union[str, "_models.OutboundType"]] = "loadBalancer", + load_balancer_sku: Optional[Union[str, "_models.LoadBalancerSku"]] = None, + load_balancer_profile: Optional["_models.ManagedClusterLoadBalancerProfile"] = None, + nat_gateway_profile: Optional["_models.ManagedClusterNATGatewayProfile"] = None, **kwargs ): """ - :keyword network_plugin: Network plugin used for building the Kubernetes network. Possible - values include: "azure", "kubenet". Default value: "kubenet". + :keyword network_plugin: Network plugin used for building the Kubernetes network. Known values + are: "azure", "kubenet". Default value: "kubenet". :paramtype network_plugin: str or ~azure.mgmt.containerservice.v2021_08_01.models.NetworkPlugin - :keyword network_policy: Network policy used for building the Kubernetes network. Possible - values include: "calico", "azure". + :keyword network_policy: Network policy used for building the Kubernetes network. Known values + are: "calico", "azure". :paramtype network_policy: str or ~azure.mgmt.containerservice.v2021_08_01.models.NetworkPolicy :keyword network_mode: This cannot be specified if networkPlugin is anything other than - 'azure'. Possible values include: "transparent", "bridge". + 'azure'. Known values are: "transparent", "bridge". :paramtype network_mode: str or ~azure.mgmt.containerservice.v2021_08_01.models.NetworkMode :keyword pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :paramtype pod_cidr: str @@ -1129,13 +1129,13 @@ def __init__( :paramtype docker_bridge_cidr: str :keyword outbound_type: This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type - `_. Possible values include: - "loadBalancer", "userDefinedRouting", "managedNATGateway", "userAssignedNATGateway". Default - value: "loadBalancer". + `_. Known values are: "loadBalancer", + "userDefinedRouting", "managedNATGateway", "userAssignedNATGateway". Default value: + "loadBalancer". :paramtype outbound_type: str or ~azure.mgmt.containerservice.v2021_08_01.models.OutboundType :keyword load_balancer_sku: The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the - differences between load balancer SKUs. Possible values include: "standard", "basic". + differences between load balancer SKUs. Known values are: "standard", "basic". :paramtype load_balancer_sku: str or ~azure.mgmt.containerservice.v2021_08_01.models.LoadBalancerSku :keyword load_balancer_profile: Profile of the cluster load balancer. @@ -1181,7 +1181,7 @@ class ContainerServiceSshConfiguration(msrest.serialization.Model): def __init__( self, *, - public_keys: List["ContainerServiceSshPublicKey"], + public_keys: List["_models.ContainerServiceSshPublicKey"], **kwargs ): """ @@ -1369,7 +1369,7 @@ def __init__( self, *, domain_name: Optional[str] = None, - endpoint_details: Optional[List["EndpointDetail"]] = None, + endpoint_details: Optional[List["_models.EndpointDetail"]] = None, **kwargs ): """ @@ -1435,7 +1435,7 @@ class ExtendedLocation(msrest.serialization.Model): :ivar name: The name of the extended location. :vartype name: str - :ivar type: The type of the extended location. Possible values include: "EdgeZone". + :ivar type: The type of the extended location. Known values are: "EdgeZone". :vartype type: str or ~azure.mgmt.containerservice.v2021_08_01.models.ExtendedLocationTypes """ @@ -1448,13 +1448,13 @@ def __init__( self, *, name: Optional[str] = None, - type: Optional[Union[str, "ExtendedLocationTypes"]] = None, + type: Optional[Union[str, "_models.ExtendedLocationTypes"]] = None, **kwargs ): """ :keyword name: The name of the extended location. :paramtype name: str - :keyword type: The type of the extended location. Possible values include: "EdgeZone". + :keyword type: The type of the extended location. Known values are: "EdgeZone". :paramtype type: str or ~azure.mgmt.containerservice.v2021_08_01.models.ExtendedLocationTypes """ super(ExtendedLocation, self).__init__(**kwargs) @@ -1613,7 +1613,7 @@ class LinuxOSConfig(msrest.serialization.Model): def __init__( self, *, - sysctls: Optional["SysctlConfig"] = None, + sysctls: Optional["_models.SysctlConfig"] = None, transparent_huge_page_enabled: Optional[str] = None, transparent_huge_page_defrag: Optional[str] = None, swap_file_size_mb: Optional[int] = None, @@ -1681,8 +1681,8 @@ class MaintenanceConfiguration(SubResource): def __init__( self, *, - time_in_week: Optional[List["TimeInWeek"]] = None, - not_allowed_time: Optional[List["TimeSpan"]] = None, + time_in_week: Optional[List["_models.TimeInWeek"]] = None, + not_allowed_time: Optional[List["_models.TimeSpan"]] = None, **kwargs ): """ @@ -1721,7 +1721,7 @@ class MaintenanceConfigurationListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["MaintenanceConfiguration"]] = None, + value: Optional[List["_models.MaintenanceConfiguration"]] = None, **kwargs ): """ @@ -1900,7 +1900,7 @@ class ManagedCluster(Resource): :vartype security_profile: ~azure.mgmt.containerservice.v2021_08_01.models.ManagedClusterSecurityProfile :ivar public_network_access: Default value is 'Enabled' (case insensitive). Could be set to - 'Disabled' to enable private cluster. Possible values include: "Enabled", "Disabled". + 'Disabled' to enable private cluster. Known values are: "Enabled", "Disabled". :vartype public_network_access: str or ~azure.mgmt.containerservice.v2021_08_01.models.PublicNetworkAccess """ @@ -1964,33 +1964,33 @@ def __init__( *, location: str, tags: Optional[Dict[str, str]] = None, - sku: Optional["ManagedClusterSKU"] = None, - extended_location: Optional["ExtendedLocation"] = None, - identity: Optional["ManagedClusterIdentity"] = None, + sku: Optional["_models.ManagedClusterSKU"] = None, + extended_location: Optional["_models.ExtendedLocation"] = None, + identity: Optional["_models.ManagedClusterIdentity"] = None, kubernetes_version: Optional[str] = None, dns_prefix: Optional[str] = None, fqdn_subdomain: Optional[str] = None, - agent_pool_profiles: Optional[List["ManagedClusterAgentPoolProfile"]] = None, - linux_profile: Optional["ContainerServiceLinuxProfile"] = None, - windows_profile: Optional["ManagedClusterWindowsProfile"] = None, - service_principal_profile: Optional["ManagedClusterServicePrincipalProfile"] = None, - addon_profiles: Optional[Dict[str, "ManagedClusterAddonProfile"]] = None, - pod_identity_profile: Optional["ManagedClusterPodIdentityProfile"] = None, + agent_pool_profiles: Optional[List["_models.ManagedClusterAgentPoolProfile"]] = None, + linux_profile: Optional["_models.ContainerServiceLinuxProfile"] = None, + windows_profile: Optional["_models.ManagedClusterWindowsProfile"] = None, + service_principal_profile: Optional["_models.ManagedClusterServicePrincipalProfile"] = None, + addon_profiles: Optional[Dict[str, "_models.ManagedClusterAddonProfile"]] = None, + pod_identity_profile: Optional["_models.ManagedClusterPodIdentityProfile"] = None, node_resource_group: Optional[str] = None, enable_rbac: Optional[bool] = None, enable_pod_security_policy: Optional[bool] = None, - network_profile: Optional["ContainerServiceNetworkProfile"] = None, - aad_profile: Optional["ManagedClusterAADProfile"] = None, - auto_upgrade_profile: Optional["ManagedClusterAutoUpgradeProfile"] = None, - auto_scaler_profile: Optional["ManagedClusterPropertiesAutoScalerProfile"] = None, - api_server_access_profile: Optional["ManagedClusterAPIServerAccessProfile"] = None, + network_profile: Optional["_models.ContainerServiceNetworkProfile"] = None, + aad_profile: Optional["_models.ManagedClusterAADProfile"] = None, + auto_upgrade_profile: Optional["_models.ManagedClusterAutoUpgradeProfile"] = None, + auto_scaler_profile: Optional["_models.ManagedClusterPropertiesAutoScalerProfile"] = None, + api_server_access_profile: Optional["_models.ManagedClusterAPIServerAccessProfile"] = None, disk_encryption_set_id: Optional[str] = None, - identity_profile: Optional[Dict[str, "UserAssignedIdentity"]] = None, - private_link_resources: Optional[List["PrivateLinkResource"]] = None, + identity_profile: Optional[Dict[str, "_models.UserAssignedIdentity"]] = None, + private_link_resources: Optional[List["_models.PrivateLinkResource"]] = None, disable_local_accounts: Optional[bool] = None, - http_proxy_config: Optional["ManagedClusterHTTPProxyConfig"] = None, - security_profile: Optional["ManagedClusterSecurityProfile"] = None, - public_network_access: Optional[Union[str, "PublicNetworkAccess"]] = None, + http_proxy_config: Optional["_models.ManagedClusterHTTPProxyConfig"] = None, + security_profile: Optional["_models.ManagedClusterSecurityProfile"] = None, + public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None, **kwargs ): """ @@ -2080,7 +2080,7 @@ def __init__( :paramtype security_profile: ~azure.mgmt.containerservice.v2021_08_01.models.ManagedClusterSecurityProfile :keyword public_network_access: Default value is 'Enabled' (case insensitive). Could be set to - 'Disabled' to enable private cluster. Possible values include: "Enabled", "Disabled". + 'Disabled' to enable private cluster. Known values are: "Enabled", "Disabled". :paramtype public_network_access: str or ~azure.mgmt.containerservice.v2021_08_01.models.PublicNetworkAccess """ @@ -2389,15 +2389,15 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS - `_. Possible values - include: "Managed", "Ephemeral". + `_. Known values are: + "Managed", "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2021_08_01.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Possible values include: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_08_01.models.KubeletDiskType - :ivar workload_runtime: Determines the type of workload a node can run. Possible values - include: "OCIContainer", "WasmWasi". + :ivar workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer", "WasmWasi". :vartype workload_runtime: str or ~azure.mgmt.containerservice.v2021_08_01.models.WorkloadRuntime :ivar vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and used. @@ -2411,11 +2411,11 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2021_08_01.models.OSType - :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Possible values include: "Ubuntu", "CBLMariner". + :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known + values are: "Ubuntu", "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2021_08_01.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. :vartype max_count: int @@ -2424,15 +2424,14 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it - defaults to Delete. Possible values include: "Delete", "Deallocate". + defaults to Delete. Known values are: "Delete", "Deallocate". :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2021_08_01.models.ScaleDownMode - :ivar type: The type of Agent Pool. Possible values include: "VirtualMachineScaleSets", + :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2021_08_01.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Possible values include: "System", - "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". :vartype mode: str or ~azure.mgmt.containerservice.v2021_08_01.models.AgentPoolMode :ivar orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -2464,12 +2463,12 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Possible values include: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_08_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Possible values include: "Delete", - "Deallocate". Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_08_01.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which @@ -2501,7 +2500,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2021_08_01.models.GPUInstanceProfile :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool @@ -2564,39 +2563,39 @@ def __init__( count: Optional[int] = None, vm_size: Optional[str] = None, os_disk_size_gb: Optional[int] = None, - os_disk_type: Optional[Union[str, "OSDiskType"]] = None, - kubelet_disk_type: Optional[Union[str, "KubeletDiskType"]] = None, - workload_runtime: Optional[Union[str, "WorkloadRuntime"]] = None, + os_disk_type: Optional[Union[str, "_models.OSDiskType"]] = None, + kubelet_disk_type: Optional[Union[str, "_models.KubeletDiskType"]] = None, + workload_runtime: Optional[Union[str, "_models.WorkloadRuntime"]] = None, vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", - os_sku: Optional[Union[str, "OSSKU"]] = None, + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - scale_down_mode: Optional[Union[str, "ScaleDownMode"]] = None, - type: Optional[Union[str, "AgentPoolType"]] = None, - mode: Optional[Union[str, "AgentPoolMode"]] = None, + scale_down_mode: Optional[Union[str, "_models.ScaleDownMode"]] = None, + type: Optional[Union[str, "_models.AgentPoolType"]] = None, + mode: Optional[Union[str, "_models.AgentPoolMode"]] = None, orchestrator_version: Optional[str] = None, - upgrade_settings: Optional["AgentPoolUpgradeSettings"] = None, + upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", spot_max_price: Optional[float] = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, proximity_placement_group_id: Optional[str] = None, - kubelet_config: Optional["KubeletConfig"] = None, - linux_os_config: Optional["LinuxOSConfig"] = None, + kubelet_config: Optional["_models.KubeletConfig"] = None, + linux_os_config: Optional["_models.LinuxOSConfig"] = None, enable_encryption_at_host: Optional[bool] = None, enable_ultra_ssd: Optional[bool] = None, enable_fips: Optional[bool] = None, - gpu_instance_profile: Optional[Union[str, "GPUInstanceProfile"]] = None, - creation_data: Optional["CreationData"] = None, + gpu_instance_profile: Optional[Union[str, "_models.GPUInstanceProfile"]] = None, + creation_data: Optional["_models.CreationData"] = None, **kwargs ): """ @@ -2615,15 +2614,15 @@ def __init__( :keyword os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS - `_. Possible values - include: "Managed", "Ephemeral". + `_. Known values are: + "Managed", "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2021_08_01.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Possible values include: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_08_01.models.KubeletDiskType - :keyword workload_runtime: Determines the type of workload a node can run. Possible values - include: "OCIContainer", "WasmWasi". + :keyword workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer", "WasmWasi". :paramtype workload_runtime: str or ~azure.mgmt.containerservice.v2021_08_01.models.WorkloadRuntime :keyword vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and @@ -2637,11 +2636,11 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2021_08_01.models.OSType :keyword os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Possible values include: "Ubuntu", "CBLMariner". + Known values are: "Ubuntu", "CBLMariner". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2021_08_01.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -2650,16 +2649,15 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, - it defaults to Delete. Possible values include: "Delete", "Deallocate". + it defaults to Delete. Known values are: "Delete", "Deallocate". :paramtype scale_down_mode: str or ~azure.mgmt.containerservice.v2021_08_01.models.ScaleDownMode - :keyword type: The type of Agent Pool. Possible values include: "VirtualMachineScaleSets", + :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2021_08_01.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Possible values include: "System", - "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2021_08_01.models.AgentPoolMode :keyword orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -2685,12 +2683,12 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Possible values include: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_08_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Possible values include: "Delete", - "Deallocate". Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_08_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which @@ -2722,7 +2720,7 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2021_08_01.models.GPUInstanceProfile @@ -2794,15 +2792,15 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS - `_. Possible values - include: "Managed", "Ephemeral". + `_. Known values are: + "Managed", "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2021_08_01.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Possible values include: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_08_01.models.KubeletDiskType - :ivar workload_runtime: Determines the type of workload a node can run. Possible values - include: "OCIContainer", "WasmWasi". + :ivar workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer", "WasmWasi". :vartype workload_runtime: str or ~azure.mgmt.containerservice.v2021_08_01.models.WorkloadRuntime :ivar vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and used. @@ -2816,11 +2814,11 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2021_08_01.models.OSType - :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Possible values include: "Ubuntu", "CBLMariner". + :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known + values are: "Ubuntu", "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2021_08_01.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. :vartype max_count: int @@ -2829,15 +2827,14 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it - defaults to Delete. Possible values include: "Delete", "Deallocate". + defaults to Delete. Known values are: "Delete", "Deallocate". :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2021_08_01.models.ScaleDownMode - :ivar type: The type of Agent Pool. Possible values include: "VirtualMachineScaleSets", + :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2021_08_01.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Possible values include: "System", - "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". :vartype mode: str or ~azure.mgmt.containerservice.v2021_08_01.models.AgentPoolMode :ivar orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -2869,12 +2866,12 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Possible values include: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_08_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Possible values include: "Delete", - "Deallocate". Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_08_01.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which @@ -2906,7 +2903,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2021_08_01.models.GPUInstanceProfile :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool @@ -2974,39 +2971,39 @@ def __init__( count: Optional[int] = None, vm_size: Optional[str] = None, os_disk_size_gb: Optional[int] = None, - os_disk_type: Optional[Union[str, "OSDiskType"]] = None, - kubelet_disk_type: Optional[Union[str, "KubeletDiskType"]] = None, - workload_runtime: Optional[Union[str, "WorkloadRuntime"]] = None, + os_disk_type: Optional[Union[str, "_models.OSDiskType"]] = None, + kubelet_disk_type: Optional[Union[str, "_models.KubeletDiskType"]] = None, + workload_runtime: Optional[Union[str, "_models.WorkloadRuntime"]] = None, vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", - os_sku: Optional[Union[str, "OSSKU"]] = None, + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - scale_down_mode: Optional[Union[str, "ScaleDownMode"]] = None, - type: Optional[Union[str, "AgentPoolType"]] = None, - mode: Optional[Union[str, "AgentPoolMode"]] = None, + scale_down_mode: Optional[Union[str, "_models.ScaleDownMode"]] = None, + type: Optional[Union[str, "_models.AgentPoolType"]] = None, + mode: Optional[Union[str, "_models.AgentPoolMode"]] = None, orchestrator_version: Optional[str] = None, - upgrade_settings: Optional["AgentPoolUpgradeSettings"] = None, + upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", spot_max_price: Optional[float] = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, proximity_placement_group_id: Optional[str] = None, - kubelet_config: Optional["KubeletConfig"] = None, - linux_os_config: Optional["LinuxOSConfig"] = None, + kubelet_config: Optional["_models.KubeletConfig"] = None, + linux_os_config: Optional["_models.LinuxOSConfig"] = None, enable_encryption_at_host: Optional[bool] = None, enable_ultra_ssd: Optional[bool] = None, enable_fips: Optional[bool] = None, - gpu_instance_profile: Optional[Union[str, "GPUInstanceProfile"]] = None, - creation_data: Optional["CreationData"] = None, + gpu_instance_profile: Optional[Union[str, "_models.GPUInstanceProfile"]] = None, + creation_data: Optional["_models.CreationData"] = None, **kwargs ): """ @@ -3025,15 +3022,15 @@ def __init__( :keyword os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS - `_. Possible values - include: "Managed", "Ephemeral". + `_. Known values are: + "Managed", "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2021_08_01.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Possible values include: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_08_01.models.KubeletDiskType - :keyword workload_runtime: Determines the type of workload a node can run. Possible values - include: "OCIContainer", "WasmWasi". + :keyword workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer", "WasmWasi". :paramtype workload_runtime: str or ~azure.mgmt.containerservice.v2021_08_01.models.WorkloadRuntime :keyword vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and @@ -3047,11 +3044,11 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2021_08_01.models.OSType :keyword os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Possible values include: "Ubuntu", "CBLMariner". + Known values are: "Ubuntu", "CBLMariner". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2021_08_01.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -3060,16 +3057,15 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, - it defaults to Delete. Possible values include: "Delete", "Deallocate". + it defaults to Delete. Known values are: "Delete", "Deallocate". :paramtype scale_down_mode: str or ~azure.mgmt.containerservice.v2021_08_01.models.ScaleDownMode - :keyword type: The type of Agent Pool. Possible values include: "VirtualMachineScaleSets", + :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2021_08_01.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Possible values include: "System", - "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2021_08_01.models.AgentPoolMode :keyword orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -3095,12 +3091,12 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Possible values include: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_08_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Possible values include: "Delete", - "Deallocate". Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_08_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which @@ -3132,7 +3128,7 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2021_08_01.models.GPUInstanceProfile @@ -3217,8 +3213,8 @@ class ManagedClusterAutoUpgradeProfile(msrest.serialization.Model): """Auto upgrade profile for a managed cluster. :ivar upgrade_channel: For more information see `setting the AKS cluster auto-upgrade channel - `_. Possible - values include: "rapid", "stable", "patch", "node-image", "none". + `_. Known values + are: "rapid", "stable", "patch", "node-image", "none". :vartype upgrade_channel: str or ~azure.mgmt.containerservice.v2021_08_01.models.UpgradeChannel """ @@ -3229,13 +3225,13 @@ class ManagedClusterAutoUpgradeProfile(msrest.serialization.Model): def __init__( self, *, - upgrade_channel: Optional[Union[str, "UpgradeChannel"]] = None, + upgrade_channel: Optional[Union[str, "_models.UpgradeChannel"]] = None, **kwargs ): """ :keyword upgrade_channel: For more information see `setting the AKS cluster auto-upgrade channel `_. - Possible values include: "rapid", "stable", "patch", "node-image", "none". + Known values are: "rapid", "stable", "patch", "node-image", "none". :paramtype upgrade_channel: str or ~azure.mgmt.containerservice.v2021_08_01.models.UpgradeChannel """ @@ -3301,7 +3297,7 @@ class ManagedClusterIdentity(msrest.serialization.Model): components. :vartype tenant_id: str :ivar type: For more information see `use managed identities in AKS - `_. Possible values include: + `_. Known values are: "SystemAssigned", "UserAssigned", "None". :vartype type: str or ~azure.mgmt.containerservice.v2021_08_01.models.ResourceIdentityType :ivar user_assigned_identities: The keys must be ARM resource IDs in the form: @@ -3325,13 +3321,13 @@ class ManagedClusterIdentity(msrest.serialization.Model): def __init__( self, *, - type: Optional[Union[str, "ResourceIdentityType"]] = None, - user_assigned_identities: Optional[Dict[str, "ManagedServiceIdentityUserAssignedIdentitiesValue"]] = None, + type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, + user_assigned_identities: Optional[Dict[str, "_models.ManagedServiceIdentityUserAssignedIdentitiesValue"]] = None, **kwargs ): """ :keyword type: For more information see `use managed identities in AKS - `_. Possible values include: + `_. Known values are: "SystemAssigned", "UserAssigned", "None". :paramtype type: str or ~azure.mgmt.containerservice.v2021_08_01.models.ResourceIdentityType :keyword user_assigned_identities: The keys must be ARM resource IDs in the form: @@ -3369,7 +3365,7 @@ class ManagedClusterListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["ManagedCluster"]] = None, + value: Optional[List["_models.ManagedCluster"]] = None, **kwargs ): """ @@ -3427,10 +3423,10 @@ class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): def __init__( self, *, - managed_outbound_i_ps: Optional["ManagedClusterLoadBalancerProfileManagedOutboundIPs"] = None, - outbound_ip_prefixes: Optional["ManagedClusterLoadBalancerProfileOutboundIPPrefixes"] = None, - outbound_i_ps: Optional["ManagedClusterLoadBalancerProfileOutboundIPs"] = None, - effective_outbound_i_ps: Optional[List["ResourceReference"]] = None, + managed_outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileManagedOutboundIPs"] = None, + outbound_ip_prefixes: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPPrefixes"] = None, + outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPs"] = None, + effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, allocated_outbound_ports: Optional[int] = 0, idle_timeout_in_minutes: Optional[int] = 30, enable_multiple_standard_load_balancers: Optional[bool] = None, @@ -3519,7 +3515,7 @@ class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.M def __init__( self, *, - public_ip_prefixes: Optional[List["ResourceReference"]] = None, + public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, **kwargs ): """ @@ -3545,7 +3541,7 @@ class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): def __init__( self, *, - public_i_ps: Optional[List["ResourceReference"]] = None, + public_i_ps: Optional[List["_models.ResourceReference"]] = None, **kwargs ): """ @@ -3615,8 +3611,8 @@ class ManagedClusterNATGatewayProfile(msrest.serialization.Model): def __init__( self, *, - managed_outbound_ip_profile: Optional["ManagedClusterManagedOutboundIPProfile"] = None, - effective_outbound_i_ps: Optional[List["ResourceReference"]] = None, + managed_outbound_ip_profile: Optional["_models.ManagedClusterManagedOutboundIPProfile"] = None, + effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, idle_timeout_in_minutes: Optional[int] = 4, **kwargs ): @@ -3654,8 +3650,8 @@ class ManagedClusterPodIdentity(msrest.serialization.Model): :vartype binding_selector: str :ivar identity: Required. The user assigned identity details. :vartype identity: ~azure.mgmt.containerservice.v2021_08_01.models.UserAssignedIdentity - :ivar provisioning_state: The current provisioning state of the pod identity. Possible values - include: "Assigned", "Updating", "Deleting", "Failed". + :ivar provisioning_state: The current provisioning state of the pod identity. Known values are: + "Assigned", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2021_08_01.models.ManagedClusterPodIdentityProvisioningState :ivar provisioning_info: @@ -3685,7 +3681,7 @@ def __init__( *, name: str, namespace: str, - identity: "UserAssignedIdentity", + identity: "_models.UserAssignedIdentity", binding_selector: Optional[str] = None, **kwargs ): @@ -3786,8 +3782,8 @@ def __init__( *, enabled: Optional[bool] = None, allow_network_plugin_kubenet: Optional[bool] = None, - user_assigned_identities: Optional[List["ManagedClusterPodIdentity"]] = None, - user_assigned_identity_exceptions: Optional[List["ManagedClusterPodIdentityException"]] = None, + user_assigned_identities: Optional[List["_models.ManagedClusterPodIdentity"]] = None, + user_assigned_identity_exceptions: Optional[List["_models.ManagedClusterPodIdentityException"]] = None, **kwargs ): """ @@ -3828,7 +3824,7 @@ class ManagedClusterPodIdentityProvisioningError(msrest.serialization.Model): def __init__( self, *, - error: Optional["ManagedClusterPodIdentityProvisioningErrorBody"] = None, + error: Optional["_models.ManagedClusterPodIdentityProvisioningErrorBody"] = None, **kwargs ): """ @@ -3870,7 +3866,7 @@ def __init__( code: Optional[str] = None, message: Optional[str] = None, target: Optional[str] = None, - details: Optional[List["ManagedClusterPodIdentityProvisioningErrorBody"]] = None, + details: Optional[List["_models.ManagedClusterPodIdentityProvisioningErrorBody"]] = None, **kwargs ): """ @@ -3909,7 +3905,7 @@ class ManagedClusterPodIdentityProvisioningInfo(msrest.serialization.Model): def __init__( self, *, - error: Optional["ManagedClusterPodIdentityProvisioningError"] = None, + error: Optional["_models.ManagedClusterPodIdentityProvisioningError"] = None, **kwargs ): """ @@ -3930,8 +3926,8 @@ class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): :vartype kubernetes_version: str :ivar name: The Agent Pool name. :vartype name: str - :ivar os_type: Required. The operating system type. The default is Linux. Possible values - include: "Linux", "Windows". Default value: "Linux". + :ivar os_type: Required. The operating system type. The default is Linux. Known values are: + "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2021_08_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -3954,9 +3950,9 @@ def __init__( self, *, kubernetes_version: str, - os_type: Union[str, "OSType"] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", name: Optional[str] = None, - upgrades: Optional[List["ManagedClusterPoolUpgradeProfileUpgradesItem"]] = None, + upgrades: Optional[List["_models.ManagedClusterPoolUpgradeProfileUpgradesItem"]] = None, **kwargs ): """ @@ -3964,8 +3960,8 @@ def __init__( :paramtype kubernetes_version: str :keyword name: The Agent Pool name. :paramtype name: str - :keyword os_type: Required. The operating system type. The default is Linux. Possible values - include: "Linux", "Windows". Default value: "Linux". + :keyword os_type: Required. The operating system type. The default is Linux. Known values are: + "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2021_08_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: @@ -4017,8 +4013,7 @@ class ManagedClusterPropertiesAutoScalerProfile(msrest.serialization.Model): :vartype balance_similar_node_groups: str :ivar expander: If not specified, the default is 'random'. See `expanders `_ - for more information. Possible values include: "least-waste", "most-pods", "priority", - "random". + for more information. Known values are: "least-waste", "most-pods", "priority", "random". :vartype expander: str or ~azure.mgmt.containerservice.v2021_08_01.models.Expander :ivar max_empty_bulk_delete: The default is 10. :vartype max_empty_bulk_delete: str @@ -4085,7 +4080,7 @@ def __init__( self, *, balance_similar_node_groups: Optional[str] = None, - expander: Optional[Union[str, "Expander"]] = None, + expander: Optional[Union[str, "_models.Expander"]] = None, max_empty_bulk_delete: Optional[str] = None, max_graceful_termination_sec: Optional[str] = None, max_node_provision_time: Optional[str] = None, @@ -4108,8 +4103,7 @@ def __init__( :paramtype balance_similar_node_groups: str :keyword expander: If not specified, the default is 'random'. See `expanders `_ - for more information. Possible values include: "least-waste", "most-pods", "priority", - "random". + for more information. Known values are: "least-waste", "most-pods", "priority", "random". :paramtype expander: str or ~azure.mgmt.containerservice.v2021_08_01.models.Expander :keyword max_empty_bulk_delete: The default is 10. :paramtype max_empty_bulk_delete: str @@ -4187,7 +4181,7 @@ class ManagedClusterSecurityProfile(msrest.serialization.Model): def __init__( self, *, - azure_defender: Optional["ManagedClusterSecurityProfileAzureDefender"] = None, + azure_defender: Optional["_models.ManagedClusterSecurityProfileAzureDefender"] = None, **kwargs ): """ @@ -4278,11 +4272,11 @@ def __init__( class ManagedClusterSKU(msrest.serialization.Model): """The SKU of a Managed Cluster. - :ivar name: The name of a managed cluster SKU. Possible values include: "Basic". + :ivar name: The name of a managed cluster SKU. Known values are: "Basic". :vartype name: str or ~azure.mgmt.containerservice.v2021_08_01.models.ManagedClusterSKUName :ivar tier: If not specified, the default is 'Free'. See `uptime SLA - `_ for more details. Possible values include: - "Paid", "Free". + `_ for more details. Known values are: "Paid", + "Free". :vartype tier: str or ~azure.mgmt.containerservice.v2021_08_01.models.ManagedClusterSKUTier """ @@ -4294,16 +4288,16 @@ class ManagedClusterSKU(msrest.serialization.Model): def __init__( self, *, - name: Optional[Union[str, "ManagedClusterSKUName"]] = None, - tier: Optional[Union[str, "ManagedClusterSKUTier"]] = None, + name: Optional[Union[str, "_models.ManagedClusterSKUName"]] = None, + tier: Optional[Union[str, "_models.ManagedClusterSKUTier"]] = None, **kwargs ): """ - :keyword name: The name of a managed cluster SKU. Possible values include: "Basic". + :keyword name: The name of a managed cluster SKU. Known values are: "Basic". :paramtype name: str or ~azure.mgmt.containerservice.v2021_08_01.models.ManagedClusterSKUName :keyword tier: If not specified, the default is 'Free'. See `uptime SLA - `_ for more details. Possible values include: - "Paid", "Free". + `_ for more details. Known values are: "Paid", + "Free". :paramtype tier: str or ~azure.mgmt.containerservice.v2021_08_01.models.ManagedClusterSKUTier """ super(ManagedClusterSKU, self).__init__(**kwargs) @@ -4352,8 +4346,8 @@ class ManagedClusterUpgradeProfile(msrest.serialization.Model): def __init__( self, *, - control_plane_profile: "ManagedClusterPoolUpgradeProfile", - agent_pool_profiles: List["ManagedClusterPoolUpgradeProfile"], + control_plane_profile: "_models.ManagedClusterPoolUpgradeProfile", + agent_pool_profiles: List["_models.ManagedClusterPoolUpgradeProfile"], **kwargs ): """ @@ -4395,8 +4389,8 @@ class ManagedClusterWindowsProfile(msrest.serialization.Model): "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!". :vartype admin_password: str :ivar license_type: The license type to use for Windows VMs. See `Azure Hybrid User Benefits - `_ for more details. Possible values - include: "None", "Windows_Server". + `_ for more details. Known values are: + "None", "Windows_Server". :vartype license_type: str or ~azure.mgmt.containerservice.v2021_08_01.models.LicenseType :ivar enable_csi_proxy: For more details on CSI proxy, see the `CSI proxy GitHub repo `_. @@ -4419,7 +4413,7 @@ def __init__( *, admin_username: str, admin_password: Optional[str] = None, - license_type: Optional[Union[str, "LicenseType"]] = None, + license_type: Optional[Union[str, "_models.LicenseType"]] = None, enable_csi_proxy: Optional[bool] = None, **kwargs ): @@ -4441,8 +4435,8 @@ def __init__( "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!". :paramtype admin_password: str :keyword license_type: The license type to use for Windows VMs. See `Azure Hybrid User Benefits - `_ for more details. Possible values - include: "None", "Windows_Server". + `_ for more details. Known values are: + "None", "Windows_Server". :paramtype license_type: str or ~azure.mgmt.containerservice.v2021_08_01.models.LicenseType :keyword enable_csi_proxy: For more details on CSI proxy, see the `CSI proxy GitHub repo `_. @@ -4601,7 +4595,7 @@ class OSOptionProfile(msrest.serialization.Model): def __init__( self, *, - os_option_property_list: List["OSOptionProperty"], + os_option_property_list: List["_models.OSOptionProperty"], **kwargs ): """ @@ -4674,7 +4668,7 @@ def __init__( self, *, category: Optional[str] = None, - endpoints: Optional[List["EndpointDependency"]] = None, + endpoints: Optional[List["_models.EndpointDependency"]] = None, **kwargs ): """ @@ -4716,7 +4710,7 @@ class OutboundEnvironmentEndpointCollection(msrest.serialization.Model): def __init__( self, *, - value: List["OutboundEnvironmentEndpoint"], + value: List["_models.OutboundEnvironmentEndpoint"], **kwargs ): """ @@ -4732,8 +4726,8 @@ def __init__( class PowerState(msrest.serialization.Model): """Describes the Power State of the cluster. - :ivar code: Tells whether the cluster is Running or Stopped. Possible values include: - "Running", "Stopped". + :ivar code: Tells whether the cluster is Running or Stopped. Known values are: "Running", + "Stopped". :vartype code: str or ~azure.mgmt.containerservice.v2021_08_01.models.Code """ @@ -4744,12 +4738,12 @@ class PowerState(msrest.serialization.Model): def __init__( self, *, - code: Optional[Union[str, "Code"]] = None, + code: Optional[Union[str, "_models.Code"]] = None, **kwargs ): """ - :keyword code: Tells whether the cluster is Running or Stopped. Possible values include: - "Running", "Stopped". + :keyword code: Tells whether the cluster is Running or Stopped. Known values are: "Running", + "Stopped". :paramtype code: str or ~azure.mgmt.containerservice.v2021_08_01.models.Code """ super(PowerState, self).__init__(**kwargs) @@ -4792,7 +4786,7 @@ class PrivateEndpointConnection(msrest.serialization.Model): :vartype name: str :ivar type: The resource type. :vartype type: str - :ivar provisioning_state: The current provisioning state. Possible values include: "Succeeded", + :ivar provisioning_state: The current provisioning state. Known values are: "Succeeded", "Creating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2021_08_01.models.PrivateEndpointConnectionProvisioningState @@ -4823,8 +4817,8 @@ class PrivateEndpointConnection(msrest.serialization.Model): def __init__( self, *, - private_endpoint: Optional["PrivateEndpoint"] = None, - private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, + private_endpoint: Optional["_models.PrivateEndpoint"] = None, + private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionState"] = None, **kwargs ): """ @@ -4858,7 +4852,7 @@ class PrivateEndpointConnectionListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["PrivateEndpointConnection"]] = None, + value: Optional[List["_models.PrivateEndpointConnection"]] = None, **kwargs ): """ @@ -4948,7 +4942,7 @@ class PrivateLinkResourcesListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["PrivateLinkResource"]] = None, + value: Optional[List["_models.PrivateLinkResource"]] = None, **kwargs ): """ @@ -4962,7 +4956,7 @@ def __init__( class PrivateLinkServiceConnectionState(msrest.serialization.Model): """The state of a private link service connection. - :ivar status: The private link service connection status. Possible values include: "Pending", + :ivar status: The private link service connection status. Known values are: "Pending", "Approved", "Rejected", "Disconnected". :vartype status: str or ~azure.mgmt.containerservice.v2021_08_01.models.ConnectionStatus :ivar description: The private link service connection description. @@ -4977,13 +4971,13 @@ class PrivateLinkServiceConnectionState(msrest.serialization.Model): def __init__( self, *, - status: Optional[Union[str, "ConnectionStatus"]] = None, + status: Optional[Union[str, "_models.ConnectionStatus"]] = None, description: Optional[str] = None, **kwargs ): """ - :keyword status: The private link service connection status. Possible values include: - "Pending", "Approved", "Rejected", "Disconnected". + :keyword status: The private link service connection status. Known values are: "Pending", + "Approved", "Rejected", "Disconnected". :paramtype status: str or ~azure.mgmt.containerservice.v2021_08_01.models.ConnectionStatus :keyword description: The private link service connection description. :paramtype description: str @@ -5142,7 +5136,7 @@ class Snapshot(Resource): :ivar creation_data: CreationData to be used to specify the source agent pool resource ID to create this snapshot. :vartype creation_data: ~azure.mgmt.containerservice.v2021_08_01.models.CreationData - :ivar snapshot_type: The type of a snapshot. The default is NodePool. Possible values include: + :ivar snapshot_type: The type of a snapshot. The default is NodePool. Known values are: "NodePool". Default value: "NodePool". :vartype snapshot_type: str or ~azure.mgmt.containerservice.v2021_08_01.models.SnapshotType """ @@ -5171,8 +5165,8 @@ def __init__( *, location: str, tags: Optional[Dict[str, str]] = None, - creation_data: Optional["CreationData"] = None, - snapshot_type: Optional[Union[str, "SnapshotType"]] = "NodePool", + creation_data: Optional["_models.CreationData"] = None, + snapshot_type: Optional[Union[str, "_models.SnapshotType"]] = "NodePool", **kwargs ): """ @@ -5183,8 +5177,8 @@ def __init__( :keyword creation_data: CreationData to be used to specify the source agent pool resource ID to create this snapshot. :paramtype creation_data: ~azure.mgmt.containerservice.v2021_08_01.models.CreationData - :keyword snapshot_type: The type of a snapshot. The default is NodePool. Possible values - include: "NodePool". Default value: "NodePool". + :keyword snapshot_type: The type of a snapshot. The default is NodePool. Known values are: + "NodePool". Default value: "NodePool". :paramtype snapshot_type: str or ~azure.mgmt.containerservice.v2021_08_01.models.SnapshotType """ super(Snapshot, self).__init__(location=location, tags=tags, **kwargs) @@ -5216,7 +5210,7 @@ class SnapshotListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["Snapshot"]] = None, + value: Optional[List["_models.Snapshot"]] = None, **kwargs ): """ @@ -5447,15 +5441,15 @@ class SystemData(msrest.serialization.Model): :ivar created_by: The identity that created the resource. :vartype created_by: str - :ivar created_by_type: The type of identity that created the resource. Possible values include: + :ivar created_by_type: The type of identity that created the resource. Known values are: "User", "Application", "ManagedIdentity", "Key". :vartype created_by_type: str or ~azure.mgmt.containerservice.v2021_08_01.models.CreatedByType :ivar created_at: The UTC timestamp of resource creation. :vartype created_at: ~datetime.datetime :ivar last_modified_by: The identity that last modified the resource. :vartype last_modified_by: str - :ivar last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". + :ivar last_modified_by_type: The type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", "Key". :vartype last_modified_by_type: str or ~azure.mgmt.containerservice.v2021_08_01.models.CreatedByType :ivar last_modified_at: The type of identity that last modified the resource. @@ -5475,26 +5469,26 @@ def __init__( self, *, created_by: Optional[str] = None, - created_by_type: Optional[Union[str, "CreatedByType"]] = None, + created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, created_at: Optional[datetime.datetime] = None, last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[Union[str, "CreatedByType"]] = None, + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, last_modified_at: Optional[datetime.datetime] = None, **kwargs ): """ :keyword created_by: The identity that created the resource. :paramtype created_by: str - :keyword created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". + :keyword created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", "Key". :paramtype created_by_type: str or ~azure.mgmt.containerservice.v2021_08_01.models.CreatedByType :keyword created_at: The UTC timestamp of resource creation. :paramtype created_at: ~datetime.datetime :keyword last_modified_by: The identity that last modified the resource. :paramtype last_modified_by: str - :keyword last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". + :keyword last_modified_by_type: The type of identity that last modified the resource. Known + values are: "User", "Application", "ManagedIdentity", "Key". :paramtype last_modified_by_type: str or ~azure.mgmt.containerservice.v2021_08_01.models.CreatedByType :keyword last_modified_at: The type of identity that last modified the resource. @@ -5537,8 +5531,8 @@ def __init__( class TimeInWeek(msrest.serialization.Model): """Time in a week. - :ivar day: The day of the week. Possible values include: "Sunday", "Monday", "Tuesday", - "Wednesday", "Thursday", "Friday", "Saturday". + :ivar day: The day of the week. Known values are: "Sunday", "Monday", "Tuesday", "Wednesday", + "Thursday", "Friday", "Saturday". :vartype day: str or ~azure.mgmt.containerservice.v2021_08_01.models.WeekDay :ivar hour_slots: Each integer hour represents a time range beginning at 0m after the hour ending at the next hour (non-inclusive). 0 corresponds to 00:00 UTC, 23 corresponds to 23:00 @@ -5554,12 +5548,12 @@ class TimeInWeek(msrest.serialization.Model): def __init__( self, *, - day: Optional[Union[str, "WeekDay"]] = None, + day: Optional[Union[str, "_models.WeekDay"]] = None, hour_slots: Optional[List[int]] = None, **kwargs ): """ - :keyword day: The day of the week. Possible values include: "Sunday", "Monday", "Tuesday", + :keyword day: The day of the week. Known values are: "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday". :paramtype day: str or ~azure.mgmt.containerservice.v2021_08_01.models.WeekDay :keyword hour_slots: Each integer hour represents a time range beginning at 0m after the hour diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/models/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/models/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/operations/__init__.py index 5e1e5e72fa59..e0748876288c 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/operations/__init__.py @@ -15,6 +15,9 @@ from ._resolve_private_link_service_id_operations import ResolvePrivateLinkServiceIdOperations from ._snapshots_operations import SnapshotsOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'Operations', 'ManagedClustersOperations', @@ -25,3 +28,5 @@ 'ResolvePrivateLinkServiceIdOperations', 'SnapshotsOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/operations/_agent_pools_operations.py index 4680bb0788c2..1a95ffc16d08 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/operations/_agent_pools_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -35,9 +35,12 @@ def build_list_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools") # pylint: disable=line-too-long path_format_arguments = { @@ -49,18 +52,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -72,9 +73,12 @@ def build_get_request( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -87,18 +91,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -109,14 +111,17 @@ def build_create_or_update_request_initial( resource_name: str, agent_pool_name: str, *, - json: JSONType = None, + json: Optional[_models.AgentPool] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-08-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -129,20 +134,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -156,9 +159,12 @@ def build_delete_request_initial( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -171,18 +177,16 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -194,9 +198,12 @@ def build_get_upgrade_profile_request( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default") # pylint: disable=line-too-long path_format_arguments = { @@ -209,18 +216,16 @@ def build_get_upgrade_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -231,9 +236,12 @@ def build_get_available_agent_pool_versions_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions") # pylint: disable=line-too-long path_format_arguments = { @@ -245,18 +253,16 @@ def build_get_available_agent_pool_versions_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -268,9 +274,12 @@ def build_upgrade_node_image_version_request_initial( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion") # pylint: disable=line-too-long path_format_arguments = { @@ -283,42 +292,38 @@ def build_upgrade_node_image_version_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class AgentPoolsOperations(object): - """AgentPoolsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class AgentPoolsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_08_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_08_01.ContainerServiceClient`'s + :attr:`agent_pools` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -326,7 +331,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Iterable["_models.AgentPoolListResult"]: + ) -> Iterable[_models.AgentPoolListResult]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. @@ -341,13 +346,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_08_01.models.AgentPoolListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -357,9 +365,11 @@ def prepare_request(next_link=None): resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -369,9 +379,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -411,7 +423,7 @@ def get( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPool": + ) -> _models.AgentPool: """Gets the specified managed cluster agent pool. Gets the specified managed cluster agent pool. @@ -427,13 +439,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.AgentPool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] request = build_get_request( @@ -443,11 +458,13 @@ def get( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -473,17 +490,20 @@ def _create_or_update_initial( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> "_models.AgentPool": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] + ) -> _models.AgentPool: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-08-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] _json = self._serialize.body(parameters, 'AgentPool') @@ -496,11 +516,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -531,9 +553,9 @@ def begin_create_or_update( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> LROPoller["_models.AgentPool"]: + ) -> LROPoller[_models.AgentPool]: """Creates or updates an agent pool in the specified managed cluster. Creates or updates an agent pool in the specified managed cluster. @@ -559,17 +581,20 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_08_01.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-08-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, @@ -577,20 +602,27 @@ def begin_create_or_update( 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): - response = pipeline_response.http_response deserialized = self._deserialize('AgentPool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -610,13 +642,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements agent_pool_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -626,11 +661,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -677,21 +714,26 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-08-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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) @@ -701,8 +743,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -722,7 +770,7 @@ def get_upgrade_profile( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPoolUpgradeProfile": + ) -> _models.AgentPoolUpgradeProfile: """Gets the upgrade profile for an agent pool. Gets the upgrade profile for an agent pool. @@ -738,13 +786,16 @@ def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.AgentPoolUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] request = build_get_upgrade_profile_request( @@ -754,11 +805,13 @@ def get_upgrade_profile( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -785,7 +838,7 @@ def get_available_agent_pool_versions( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.AgentPoolAvailableVersions": + ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported Kubernetes versions for the specified agent pool. See `supported Kubernetes versions @@ -801,13 +854,16 @@ def get_available_agent_pool_versions( :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.AgentPoolAvailableVersions :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolAvailableVersions"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] request = build_get_available_agent_pool_versions_request( @@ -816,11 +872,13 @@ def get_available_agent_pool_versions( resource_name=resource_name, api_version=api_version, template_url=self.get_available_agent_pool_versions.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -847,14 +905,17 @@ def _upgrade_node_image_version_initial( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> Optional["_models.AgentPool"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.AgentPool"]] + ) -> Optional[_models.AgentPool]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] request = build_upgrade_node_image_version_request_initial( @@ -864,11 +925,13 @@ def _upgrade_node_image_version_initial( agent_pool_name=agent_pool_name, api_version=api_version, template_url=self._upgrade_node_image_version_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -898,7 +961,7 @@ def begin_upgrade_node_image_version( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> LROPoller["_models.AgentPool"]: + ) -> LROPoller[_models.AgentPool]: """Upgrades the node image version of an agent pool to the latest. Upgrading the node image version of an agent pool applies the newest OS and runtime updates to @@ -924,35 +987,45 @@ def begin_upgrade_node_image_version( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_08_01.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._upgrade_node_image_version_initial( + raw_result = self._upgrade_node_image_version_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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): - response = pipeline_response.http_response deserialized = self._deserialize('AgentPool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/operations/_maintenance_configurations_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/operations/_maintenance_configurations_operations.py index 3344decc9b58..cc5b8afdf7da 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/operations/_maintenance_configurations_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/operations/_maintenance_configurations_operations.py @@ -16,12 +16,12 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -33,9 +33,12 @@ def build_list_by_managed_cluster_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations") # pylint: disable=line-too-long path_format_arguments = { @@ -47,18 +50,16 @@ def build_list_by_managed_cluster_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -70,9 +71,12 @@ def build_get_request( config_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long path_format_arguments = { @@ -85,18 +89,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -107,14 +109,17 @@ def build_create_or_update_request( resource_name: str, config_name: str, *, - json: JSONType = None, + json: Optional[_models.MaintenanceConfiguration] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-08-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long path_format_arguments = { @@ -127,20 +132,18 @@ def build_create_or_update_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -154,9 +157,12 @@ def build_delete_request( config_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long path_format_arguments = { @@ -169,42 +175,38 @@ def build_delete_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class MaintenanceConfigurationsOperations(object): - """MaintenanceConfigurationsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class MaintenanceConfigurationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_08_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_08_01.ContainerServiceClient`'s + :attr:`maintenance_configurations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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_by_managed_cluster( @@ -212,7 +214,7 @@ def list_by_managed_cluster( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Iterable["_models.MaintenanceConfigurationListResult"]: + ) -> Iterable[_models.MaintenanceConfigurationListResult]: """Gets a list of maintenance configurations in the specified managed cluster. Gets a list of maintenance configurations in the specified managed cluster. @@ -228,13 +230,16 @@ def list_by_managed_cluster( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_08_01.models.MaintenanceConfigurationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfigurationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfigurationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -244,9 +249,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=self.list_by_managed_cluster.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -256,9 +263,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -298,7 +307,7 @@ def get( resource_name: str, config_name: str, **kwargs: Any - ) -> "_models.MaintenanceConfiguration": + ) -> _models.MaintenanceConfiguration: """Gets the specified maintenance configuration of a managed cluster. Gets the specified maintenance configuration of a managed cluster. @@ -314,13 +323,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.MaintenanceConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfiguration"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] request = build_get_request( @@ -330,11 +342,13 @@ def get( config_name=config_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -361,9 +375,9 @@ def create_or_update( resource_group_name: str, resource_name: str, config_name: str, - parameters: "_models.MaintenanceConfiguration", + parameters: _models.MaintenanceConfiguration, **kwargs: Any - ) -> "_models.MaintenanceConfiguration": + ) -> _models.MaintenanceConfiguration: """Creates or updates a maintenance configuration in the specified managed cluster. Creates or updates a maintenance configuration in the specified managed cluster. @@ -381,14 +395,17 @@ def create_or_update( :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.MaintenanceConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfiguration"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-08-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] _json = self._serialize.body(parameters, 'MaintenanceConfiguration') @@ -401,11 +418,13 @@ def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -449,13 +468,16 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -465,11 +487,13 @@ def delete( # pylint: disable=inconsistent-return-statements config_name=config_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/operations/_managed_clusters_operations.py index 033ce74d7ba2..ac037a8d73f9 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/operations/_managed_clusters_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -36,9 +36,12 @@ def build_get_os_options_request( resource_type: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default") # pylint: disable=line-too-long path_format_arguments = { @@ -49,20 +52,18 @@ def build_get_os_options_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if resource_type is not None: - _query_parameters['resource-type'] = _SERIALIZER.query("resource_type", resource_type, 'str') + _params['resource-type'] = _SERIALIZER.query("resource_type", resource_type, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -71,9 +72,12 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters") path_format_arguments = { @@ -83,18 +87,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -104,9 +106,12 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters") # pylint: disable=line-too-long path_format_arguments = { @@ -117,18 +122,16 @@ def build_list_by_resource_group_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -139,9 +142,12 @@ def build_get_upgrade_profile_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default") # pylint: disable=line-too-long path_format_arguments = { @@ -153,18 +159,16 @@ def build_get_upgrade_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -176,9 +180,12 @@ def build_get_access_profile_request( role_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -191,18 +198,16 @@ def build_get_access_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -215,9 +220,12 @@ def build_list_cluster_admin_credentials_request( server_fqdn: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -229,20 +237,18 @@ def build_list_cluster_admin_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if server_fqdn is not None: - _query_parameters['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -255,9 +261,12 @@ def build_list_cluster_user_credentials_request( server_fqdn: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -269,20 +278,18 @@ def build_list_cluster_user_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if server_fqdn is not None: - _query_parameters['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -295,9 +302,12 @@ def build_list_cluster_monitoring_user_credentials_request( server_fqdn: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -309,20 +319,18 @@ def build_list_cluster_monitoring_user_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if server_fqdn is not None: - _query_parameters['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -333,9 +341,12 @@ def build_get_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -347,18 +358,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -368,14 +377,17 @@ def build_create_or_update_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedCluster] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-08-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -387,20 +399,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -412,14 +422,17 @@ def build_update_tags_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.TagsObject] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-08-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -431,20 +444,18 @@ def build_update_tags_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -457,9 +468,12 @@ def build_delete_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -471,18 +485,16 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -492,14 +504,17 @@ def build_reset_service_principal_profile_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedClusterServicePrincipalProfile] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-08-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile") # pylint: disable=line-too-long path_format_arguments = { @@ -511,20 +526,18 @@ def build_reset_service_principal_profile_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -536,14 +549,17 @@ def build_reset_aad_profile_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedClusterAADProfile] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-08-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile") # pylint: disable=line-too-long path_format_arguments = { @@ -555,20 +571,18 @@ def build_reset_aad_profile_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -581,9 +595,12 @@ def build_rotate_cluster_certificates_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates") # pylint: disable=line-too-long path_format_arguments = { @@ -595,18 +612,16 @@ def build_rotate_cluster_certificates_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -617,9 +632,12 @@ def build_stop_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop") # pylint: disable=line-too-long path_format_arguments = { @@ -631,18 +649,16 @@ def build_stop_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -653,9 +669,12 @@ def build_start_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start") # pylint: disable=line-too-long path_format_arguments = { @@ -667,18 +686,16 @@ def build_start_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -688,14 +705,17 @@ def build_run_command_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.RunCommandRequest] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-08-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand") # pylint: disable=line-too-long path_format_arguments = { @@ -707,20 +727,18 @@ def build_run_command_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -734,9 +752,12 @@ def build_get_command_result_request( command_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}") # pylint: disable=line-too-long path_format_arguments = { @@ -749,18 +770,16 @@ def build_get_command_result_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -771,9 +790,12 @@ def build_list_outbound_network_dependencies_endpoints_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints") # pylint: disable=line-too-long path_format_arguments = { @@ -785,42 +807,38 @@ def build_list_outbound_network_dependencies_endpoints_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class ManagedClustersOperations(object): # pylint: disable=too-many-public-methods - """ManagedClustersOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ManagedClustersOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_08_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_08_01.ContainerServiceClient`'s + :attr:`managed_clusters` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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_os_options( @@ -828,7 +846,7 @@ def get_os_options( location: str, resource_type: Optional[str] = None, **kwargs: Any - ) -> "_models.OSOptionProfile": + ) -> _models.OSOptionProfile: """Gets supported OS options in the specified subscription. Gets supported OS options in the specified subscription. @@ -843,13 +861,16 @@ def get_os_options( :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.OSOptionProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OSOptionProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OSOptionProfile] request = build_get_os_options_request( @@ -858,11 +879,13 @@ def get_os_options( api_version=api_version, resource_type=resource_type, template_url=self.get_os_options.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -887,7 +910,7 @@ def get_os_options( def list( self, **kwargs: Any - ) -> Iterable["_models.ManagedClusterListResult"]: + ) -> Iterable[_models.ManagedClusterListResult]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. @@ -899,13 +922,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_08_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -913,9 +939,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -923,9 +951,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -963,7 +993,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.ManagedClusterListResult"]: + ) -> Iterable[_models.ManagedClusterListResult]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. @@ -977,13 +1007,16 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_08_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -992,9 +1025,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -1003,9 +1038,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -1044,7 +1081,7 @@ def get_upgrade_profile( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedClusterUpgradeProfile": + ) -> _models.ManagedClusterUpgradeProfile: """Gets the upgrade profile of a managed cluster. Gets the upgrade profile of a managed cluster. @@ -1058,13 +1095,16 @@ def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.ManagedClusterUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] request = build_get_upgrade_profile_request( @@ -1073,11 +1113,13 @@ def get_upgrade_profile( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1105,7 +1147,7 @@ def get_access_profile( resource_name: str, role_name: str, **kwargs: Any - ) -> "_models.ManagedClusterAccessProfile": + ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. **WARNING**\ : This API will be deprecated. Instead use `ListClusterUserCredentials @@ -1124,13 +1166,16 @@ def get_access_profile( :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.ManagedClusterAccessProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterAccessProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] request = build_get_access_profile_request( @@ -1140,11 +1185,13 @@ def get_access_profile( role_name=role_name, api_version=api_version, template_url=self.get_access_profile.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1172,7 +1219,7 @@ def list_cluster_admin_credentials( resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Lists the admin credentials of a managed cluster. Lists the admin credentials of a managed cluster. @@ -1188,13 +1235,16 @@ def list_cluster_admin_credentials( :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_admin_credentials_request( @@ -1204,11 +1254,13 @@ def list_cluster_admin_credentials( api_version=api_version, server_fqdn=server_fqdn, template_url=self.list_cluster_admin_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1236,7 +1288,7 @@ def list_cluster_user_credentials( resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Lists the user credentials of a managed cluster. Lists the user credentials of a managed cluster. @@ -1252,13 +1304,16 @@ def list_cluster_user_credentials( :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_user_credentials_request( @@ -1268,11 +1323,13 @@ def list_cluster_user_credentials( api_version=api_version, server_fqdn=server_fqdn, template_url=self.list_cluster_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1300,7 +1357,7 @@ def list_cluster_monitoring_user_credentials( resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Lists the cluster monitoring user credentials of a managed cluster. Lists the cluster monitoring user credentials of a managed cluster. @@ -1316,13 +1373,16 @@ def list_cluster_monitoring_user_credentials( :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_monitoring_user_credentials_request( @@ -1332,11 +1392,13 @@ def list_cluster_monitoring_user_credentials( api_version=api_version, server_fqdn=server_fqdn, template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1363,7 +1425,7 @@ def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedCluster": + ) -> _models.ManagedCluster: """Gets a managed cluster. Gets a managed cluster. @@ -1377,13 +1439,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.ManagedCluster :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] request = build_get_request( @@ -1392,11 +1457,13 @@ def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1421,17 +1488,20 @@ def _create_or_update_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-08-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'ManagedCluster') @@ -1443,11 +1513,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1477,9 +1549,9 @@ def begin_create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> LROPoller["_models.ManagedCluster"]: + ) -> LROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. Creates or updates a managed cluster. @@ -1504,37 +1576,47 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_08_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-08-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1551,17 +1633,20 @@ def _update_tags_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-08-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'TagsObject') @@ -1573,11 +1658,13 @@ def _update_tags_initial( content_type=content_type, json=_json, template_url=self._update_tags_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1603,9 +1690,9 @@ def begin_update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> LROPoller["_models.ManagedCluster"]: + ) -> LROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates tags on a managed cluster. @@ -1630,37 +1717,47 @@ def begin_update_tags( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_08_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-08-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._update_tags_initial( + raw_result = self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1679,13 +1776,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -1694,11 +1794,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1742,20 +1844,25 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-08-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_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) @@ -1765,8 +1872,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1783,17 +1896,20 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-08-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') @@ -1805,11 +1921,13 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re content_type=content_type, json=_json, template_url=self._reset_service_principal_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1831,7 +1949,7 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> LROPoller[None]: """Reset the Service Principal Profile of a managed cluster. @@ -1857,23 +1975,28 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-08-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._reset_service_principal_profile_initial( + raw_result = self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1883,8 +2006,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1901,17 +2030,20 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-08-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') @@ -1923,11 +2055,13 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement content_type=content_type, json=_json, template_url=self._reset_aad_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1949,7 +2083,7 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> LROPoller[None]: """Reset the AAD Profile of a managed cluster. @@ -1974,23 +2108,28 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-08-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._reset_aad_profile_initial( + raw_result = self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -2000,8 +2139,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2020,13 +2165,16 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_rotate_cluster_certificates_request_initial( @@ -2035,11 +2183,13 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return resource_name=resource_name, api_version=api_version, template_url=self._rotate_cluster_certificates_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2084,20 +2234,25 @@ def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-st :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-08-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._rotate_cluster_certificates_initial( + raw_result = self._rotate_cluster_certificates_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) @@ -2107,8 +2262,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2127,13 +2288,16 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_stop_request_initial( @@ -2142,11 +2306,13 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_name, api_version=api_version, template_url=self._stop_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2194,20 +2360,25 @@ def begin_stop( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-08-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._stop_initial( + raw_result = self._stop_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) @@ -2217,8 +2388,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2237,13 +2414,16 @@ def _start_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_start_request_initial( @@ -2252,11 +2432,13 @@ def _start_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_name, api_version=api_version, template_url=self._start_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2301,20 +2483,25 @@ def begin_start( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-08-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._start_initial( + raw_result = self._start_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) @@ -2324,8 +2511,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2342,17 +2535,20 @@ def _run_command_initial( self, resource_group_name: str, resource_name: str, - request_payload: "_models.RunCommandRequest", + request_payload: _models.RunCommandRequest, **kwargs: Any - ) -> Optional["_models.RunCommandResult"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RunCommandResult"]] + ) -> Optional[_models.RunCommandResult]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-08-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] _json = self._serialize.body(request_payload, 'RunCommandRequest') @@ -2364,11 +2560,13 @@ def _run_command_initial( content_type=content_type, json=_json, template_url=self._run_command_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2396,9 +2594,9 @@ def begin_run_command( self, resource_group_name: str, resource_name: str, - request_payload: "_models.RunCommandRequest", + request_payload: _models.RunCommandRequest, **kwargs: Any - ) -> LROPoller["_models.RunCommandResult"]: + ) -> LROPoller[_models.RunCommandResult]: """Submits a command to run against the Managed Cluster. AKS will create a pod to run the command. This is primarily useful for private clusters. For @@ -2425,37 +2623,47 @@ def begin_run_command( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_08_01.models.RunCommandResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-08-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.RunCommandResult] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._run_command_initial( + raw_result = self._run_command_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, request_payload=request_payload, 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): - response = pipeline_response.http_response deserialized = self._deserialize('RunCommandResult', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2475,7 +2683,7 @@ def get_command_result( resource_name: str, command_id: str, **kwargs: Any - ) -> Optional["_models.RunCommandResult"]: + ) -> Optional[_models.RunCommandResult]: """Gets the results of a command which has been run on the Managed Cluster. Gets the results of a command which has been run on the Managed Cluster. @@ -2491,13 +2699,16 @@ def get_command_result( :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.RunCommandResult or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RunCommandResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] request = build_get_command_result_request( @@ -2507,11 +2718,13 @@ def get_command_result( command_id=command_id, api_version=api_version, template_url=self.get_command_result.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2540,7 +2753,7 @@ def list_outbound_network_dependencies_endpoints( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Iterable["_models.OutboundEnvironmentEndpointCollection"]: + ) -> Iterable[_models.OutboundEnvironmentEndpointCollection]: """Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. @@ -2558,13 +2771,16 @@ def list_outbound_network_dependencies_endpoints( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_08_01.models.OutboundEnvironmentEndpointCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OutboundEnvironmentEndpointCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -2574,9 +2790,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=self.list_outbound_network_dependencies_endpoints.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -2586,9 +2804,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/operations/_operations.py index 9ded176c1347..c4b2bd11ec2c 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/operations/_operations.py @@ -16,6 +16,7 @@ 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 @@ -29,55 +30,54 @@ def build_list_request( **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.ContainerService/operations") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class Operations(object): - """Operations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_08_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_08_01.ContainerServiceClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> Iterable["_models.OperationListResult"]: + ) -> Iterable[_models.OperationListResult]: """Gets a list of operations. Gets a list of operations. @@ -88,31 +88,38 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_08_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/operations/_private_endpoint_connections_operations.py index 52d12bfd5ecd..fe0a196e3d2b 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/operations/_private_endpoint_connections_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast from msrest import Serializer @@ -16,13 +16,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -34,9 +34,12 @@ def build_list_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections") # pylint: disable=line-too-long path_format_arguments = { @@ -48,18 +51,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -71,9 +72,12 @@ def build_get_request( private_endpoint_connection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -86,18 +90,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -108,14 +110,17 @@ def build_update_request( resource_name: str, private_endpoint_connection_name: str, *, - json: JSONType = None, + json: Optional[_models.PrivateEndpointConnection] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-08-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -128,20 +133,18 @@ def build_update_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -155,9 +158,12 @@ def build_delete_request_initial( private_endpoint_connection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -170,42 +176,38 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class PrivateEndpointConnectionsOperations(object): - """PrivateEndpointConnectionsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class PrivateEndpointConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_08_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_08_01.ContainerServiceClient`'s + :attr:`private_endpoint_connections` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -213,7 +215,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnectionListResult": + ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. To learn more about private clusters, see: @@ -228,13 +230,16 @@ def list( :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.PrivateEndpointConnectionListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] request = build_list_request( @@ -243,11 +248,13 @@ def list( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -275,7 +282,7 @@ def get( resource_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Gets the specified private endpoint connection. To learn more about private clusters, see: @@ -292,13 +299,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] request = build_get_request( @@ -308,11 +318,13 @@ def get( private_endpoint_connection_name=private_endpoint_connection_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -339,9 +351,9 @@ def update( resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - parameters: "_models.PrivateEndpointConnection", + parameters: _models.PrivateEndpointConnection, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. Updates a private endpoint connection. @@ -359,14 +371,17 @@ def update( :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-08-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] _json = self._serialize.body(parameters, 'PrivateEndpointConnection') @@ -379,11 +394,13 @@ def update( content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -411,13 +428,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -427,11 +447,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name=private_endpoint_connection_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -478,21 +500,26 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-08-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -502,8 +529,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/operations/_private_link_resources_operations.py index 16293540827a..4a007d8ee85e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/operations/_private_link_resources_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/operations/_private_link_resources_operations.py @@ -15,6 +15,7 @@ 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 @@ -31,9 +32,12 @@ def build_list_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources") # pylint: disable=line-too-long path_format_arguments = { @@ -45,42 +49,38 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class PrivateLinkResourcesOperations(object): - """PrivateLinkResourcesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class PrivateLinkResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_08_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_08_01.ContainerServiceClient`'s + :attr:`private_link_resources` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -88,7 +88,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.PrivateLinkResourcesListResult": + ) -> _models.PrivateLinkResourcesListResult: """Gets a list of private link resources in the specified managed cluster. To learn more about private clusters, see: @@ -103,13 +103,16 @@ def list( :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.PrivateLinkResourcesListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourcesListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] request = build_list_request( @@ -118,11 +121,13 @@ def list( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/operations/_resolve_private_link_service_id_operations.py index f01ca741e9ac..43970231f11f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/operations/_resolve_private_link_service_id_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/operations/_resolve_private_link_service_id_operations.py @@ -15,12 +15,12 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -31,14 +31,17 @@ def build_post_request( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.PrivateLinkResource] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-08-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId") # pylint: disable=line-too-long path_format_arguments = { @@ -50,55 +53,51 @@ def build_post_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs ) -class ResolvePrivateLinkServiceIdOperations(object): - """ResolvePrivateLinkServiceIdOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ResolvePrivateLinkServiceIdOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_08_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_08_01.ContainerServiceClient`'s + :attr:`resolve_private_link_service_id` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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 post( self, resource_group_name: str, resource_name: str, - parameters: "_models.PrivateLinkResource", + parameters: _models.PrivateLinkResource, **kwargs: Any - ) -> "_models.PrivateLinkResource": + ) -> _models.PrivateLinkResource: """Gets the private link service ID for the specified managed cluster. Gets the private link service ID for the specified managed cluster. @@ -114,14 +113,17 @@ def post( :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.PrivateLinkResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-08-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] _json = self._serialize.body(parameters, 'PrivateLinkResource') @@ -133,11 +135,13 @@ def post( content_type=content_type, json=_json, template_url=self.post.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/operations/_snapshots_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/operations/_snapshots_operations.py index 97b0948a837f..f43d362a5095 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/operations/_snapshots_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_08_01/operations/_snapshots_operations.py @@ -16,12 +16,12 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -31,9 +31,12 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots") path_format_arguments = { @@ -43,18 +46,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -64,9 +65,12 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots") # pylint: disable=line-too-long path_format_arguments = { @@ -77,18 +81,16 @@ def build_list_by_resource_group_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -99,9 +101,12 @@ def build_get_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -113,18 +118,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -134,14 +137,17 @@ def build_create_or_update_request( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.Snapshot] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-08-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -153,20 +159,18 @@ def build_create_or_update_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -178,14 +182,17 @@ def build_update_tags_request( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.TagsObject] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-08-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -197,20 +204,18 @@ def build_update_tags_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -223,9 +228,12 @@ def build_delete_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -237,48 +245,44 @@ def build_delete_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class SnapshotsOperations(object): - """SnapshotsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class SnapshotsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_08_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_08_01.ContainerServiceClient`'s + :attr:`snapshots` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> Iterable["_models.SnapshotListResult"]: + ) -> Iterable[_models.SnapshotListResult]: """Gets a list of snapshots in the specified subscription. Gets a list of snapshots in the specified subscription. @@ -289,13 +293,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_08_01.models.SnapshotListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -303,9 +310,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -313,9 +322,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -353,7 +364,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.SnapshotListResult"]: + ) -> Iterable[_models.SnapshotListResult]: """Lists snapshots in the specified subscription and resource group. Lists snapshots in the specified subscription and resource group. @@ -366,13 +377,16 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_08_01.models.SnapshotListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -381,9 +395,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -392,9 +408,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -433,7 +451,7 @@ def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.Snapshot": + ) -> _models.Snapshot: """Gets a snapshot. Gets a snapshot. @@ -447,13 +465,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.Snapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] request = build_get_request( @@ -462,11 +483,13 @@ def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -492,9 +515,9 @@ def create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.Snapshot", + parameters: _models.Snapshot, **kwargs: Any - ) -> "_models.Snapshot": + ) -> _models.Snapshot: """Creates or updates a snapshot. Creates or updates a snapshot. @@ -510,14 +533,17 @@ def create_or_update( :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.Snapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-08-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] _json = self._serialize.body(parameters, 'Snapshot') @@ -529,11 +555,13 @@ def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -563,9 +591,9 @@ def update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.Snapshot": + ) -> _models.Snapshot: """Updates tags on a snapshot. Updates tags on a snapshot. @@ -581,14 +609,17 @@ def update_tags( :rtype: ~azure.mgmt.containerservice.v2021_08_01.models.Snapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-08-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] _json = self._serialize.body(parameters, 'TagsObject') @@ -600,11 +631,13 @@ def update_tags( content_type=content_type, json=_json, template_url=self.update_tags.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -645,13 +678,16 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-08-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-08-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -660,11 +696,13 @@ def delete( # pylint: disable=inconsistent-return-statements resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/__init__.py index 53c675bd95e2..37a5f9e02e6f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._container_service_client import ContainerServiceClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['ContainerServiceClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/_container_service_client.py index 52f287830dad..43c1504691b8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/_container_service_client.py @@ -74,14 +74,30 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.managed_clusters = ManagedClustersOperations(self._client, self._config, self._serialize, self._deserialize) - self.maintenance_configurations = MaintenanceConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) - self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) - self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations(self._client, self._config, self._serialize, self._deserialize) - self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_clusters = ManagedClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.maintenance_configurations = MaintenanceConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.agent_pools = AgentPoolsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.snapshots = SnapshotsOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/__init__.py index 53c675bd95e2..37a5f9e02e6f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._container_service_client import ContainerServiceClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['ContainerServiceClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/_container_service_client.py index e5093b9aca0a..97f6400f0688 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/_container_service_client.py @@ -75,14 +75,30 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.managed_clusters = ManagedClustersOperations(self._client, self._config, self._serialize, self._deserialize) - self.maintenance_configurations = MaintenanceConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) - self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) - self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations(self._client, self._config, self._serialize, self._deserialize) - self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_clusters = ManagedClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.maintenance_configurations = MaintenanceConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.agent_pools = AgentPoolsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.snapshots = SnapshotsOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/operations/__init__.py index 5e1e5e72fa59..e0748876288c 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/operations/__init__.py @@ -15,6 +15,9 @@ from ._resolve_private_link_service_id_operations import ResolvePrivateLinkServiceIdOperations from ._snapshots_operations import SnapshotsOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'Operations', 'ManagedClustersOperations', @@ -25,3 +28,5 @@ 'ResolvePrivateLinkServiceIdOperations', 'SnapshotsOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/operations/_agent_pools_operations.py index 9eda401c9a44..cfdcdb425447 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/operations/_agent_pools_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. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ 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 @@ -26,26 +27,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class AgentPoolsOperations: - """AgentPoolsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_09_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_09_01.aio.ContainerServiceClient`'s + :attr:`agent_pools` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -53,7 +52,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> AsyncIterable["_models.AgentPoolListResult"]: + ) -> AsyncIterable[_models.AgentPoolListResult]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. @@ -68,13 +67,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_09_01.models.AgentPoolListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -84,9 +86,11 @@ def prepare_request(next_link=None): resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -96,9 +100,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -138,7 +144,7 @@ async def get( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPool": + ) -> _models.AgentPool: """Gets the specified managed cluster agent pool. Gets the specified managed cluster agent pool. @@ -154,13 +160,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.AgentPool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] request = build_get_request( @@ -170,11 +179,13 @@ async def get( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -200,17 +211,20 @@ async def _create_or_update_initial( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> "_models.AgentPool": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] + ) -> _models.AgentPool: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-09-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] _json = self._serialize.body(parameters, 'AgentPool') @@ -223,11 +237,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -258,9 +274,9 @@ async def begin_create_or_update( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> AsyncLROPoller["_models.AgentPool"]: + ) -> AsyncLROPoller[_models.AgentPool]: """Creates or updates an agent pool in the specified managed cluster. Creates or updates an agent pool in the specified managed cluster. @@ -287,17 +303,20 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_09_01.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, @@ -305,20 +324,27 @@ async def begin_create_or_update( 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): - response = pipeline_response.http_response deserialized = self._deserialize('AgentPool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -338,13 +364,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements agent_pool_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -354,11 +383,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -405,21 +436,26 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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) @@ -429,8 +465,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -450,7 +492,7 @@ async def get_upgrade_profile( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPoolUpgradeProfile": + ) -> _models.AgentPoolUpgradeProfile: """Gets the upgrade profile for an agent pool. Gets the upgrade profile for an agent pool. @@ -466,13 +508,16 @@ async def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.AgentPoolUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] request = build_get_upgrade_profile_request( @@ -482,11 +527,13 @@ async def get_upgrade_profile( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -513,7 +560,7 @@ async def get_available_agent_pool_versions( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.AgentPoolAvailableVersions": + ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported Kubernetes versions for the specified agent pool. See `supported Kubernetes versions @@ -529,13 +576,16 @@ async def get_available_agent_pool_versions( :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.AgentPoolAvailableVersions :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolAvailableVersions"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] request = build_get_available_agent_pool_versions_request( @@ -544,11 +594,13 @@ async def get_available_agent_pool_versions( resource_name=resource_name, api_version=api_version, template_url=self.get_available_agent_pool_versions.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -575,14 +627,17 @@ async def _upgrade_node_image_version_initial( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> Optional["_models.AgentPool"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.AgentPool"]] + ) -> Optional[_models.AgentPool]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] request = build_upgrade_node_image_version_request_initial( @@ -592,11 +647,13 @@ async def _upgrade_node_image_version_initial( agent_pool_name=agent_pool_name, api_version=api_version, template_url=self._upgrade_node_image_version_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -626,7 +683,7 @@ async def begin_upgrade_node_image_version( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> AsyncLROPoller["_models.AgentPool"]: + ) -> AsyncLROPoller[_models.AgentPool]: """Upgrades the node image version of an agent pool to the latest. Upgrading the node image version of an agent pool applies the newest OS and runtime updates to @@ -653,35 +710,45 @@ async def begin_upgrade_node_image_version( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_09_01.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._upgrade_node_image_version_initial( + raw_result = await self._upgrade_node_image_version_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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): - response = pipeline_response.http_response deserialized = self._deserialize('AgentPool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/operations/_maintenance_configurations_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/operations/_maintenance_configurations_operations.py index 1fa9bc47c899..402d7c501a2b 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/operations/_maintenance_configurations_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/operations/_maintenance_configurations_operations.py @@ -15,6 +15,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -24,26 +25,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class MaintenanceConfigurationsOperations: - """MaintenanceConfigurationsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_09_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_09_01.aio.ContainerServiceClient`'s + :attr:`maintenance_configurations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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_by_managed_cluster( @@ -51,7 +50,7 @@ def list_by_managed_cluster( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> AsyncIterable["_models.MaintenanceConfigurationListResult"]: + ) -> AsyncIterable[_models.MaintenanceConfigurationListResult]: """Gets a list of maintenance configurations in the specified managed cluster. Gets a list of maintenance configurations in the specified managed cluster. @@ -67,13 +66,16 @@ def list_by_managed_cluster( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_09_01.models.MaintenanceConfigurationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfigurationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfigurationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -83,9 +85,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=self.list_by_managed_cluster.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -95,9 +99,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -137,7 +143,7 @@ async def get( resource_name: str, config_name: str, **kwargs: Any - ) -> "_models.MaintenanceConfiguration": + ) -> _models.MaintenanceConfiguration: """Gets the specified maintenance configuration of a managed cluster. Gets the specified maintenance configuration of a managed cluster. @@ -153,13 +159,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.MaintenanceConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfiguration"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] request = build_get_request( @@ -169,11 +178,13 @@ async def get( config_name=config_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -200,9 +211,9 @@ async def create_or_update( resource_group_name: str, resource_name: str, config_name: str, - parameters: "_models.MaintenanceConfiguration", + parameters: _models.MaintenanceConfiguration, **kwargs: Any - ) -> "_models.MaintenanceConfiguration": + ) -> _models.MaintenanceConfiguration: """Creates or updates a maintenance configuration in the specified managed cluster. Creates or updates a maintenance configuration in the specified managed cluster. @@ -220,14 +231,17 @@ async def create_or_update( :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.MaintenanceConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfiguration"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-09-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] _json = self._serialize.body(parameters, 'MaintenanceConfiguration') @@ -240,11 +254,13 @@ async def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -288,13 +304,16 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -304,11 +323,13 @@ async def delete( # pylint: disable=inconsistent-return-statements config_name=config_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/operations/_managed_clusters_operations.py index 4051a7069889..b65314b3786e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/operations/_managed_clusters_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. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ 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 @@ -26,26 +27,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ManagedClustersOperations: # pylint: disable=too-many-public-methods - """ManagedClustersOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_09_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_09_01.aio.ContainerServiceClient`'s + :attr:`managed_clusters` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace_async async def get_os_options( @@ -53,7 +52,7 @@ async def get_os_options( location: str, resource_type: Optional[str] = None, **kwargs: Any - ) -> "_models.OSOptionProfile": + ) -> _models.OSOptionProfile: """Gets supported OS options in the specified subscription. Gets supported OS options in the specified subscription. @@ -68,13 +67,16 @@ async def get_os_options( :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.OSOptionProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OSOptionProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OSOptionProfile] request = build_get_os_options_request( @@ -83,11 +85,13 @@ async def get_os_options( api_version=api_version, resource_type=resource_type, template_url=self.get_os_options.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -112,7 +116,7 @@ async def get_os_options( def list( self, **kwargs: Any - ) -> AsyncIterable["_models.ManagedClusterListResult"]: + ) -> AsyncIterable[_models.ManagedClusterListResult]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. @@ -124,13 +128,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_09_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -138,9 +145,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -148,9 +157,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -188,7 +199,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ManagedClusterListResult"]: + ) -> AsyncIterable[_models.ManagedClusterListResult]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. @@ -202,13 +213,16 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_09_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -217,9 +231,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -228,9 +244,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -269,7 +287,7 @@ async def get_upgrade_profile( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedClusterUpgradeProfile": + ) -> _models.ManagedClusterUpgradeProfile: """Gets the upgrade profile of a managed cluster. Gets the upgrade profile of a managed cluster. @@ -283,13 +301,16 @@ async def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.ManagedClusterUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] request = build_get_upgrade_profile_request( @@ -298,11 +319,13 @@ async def get_upgrade_profile( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -330,7 +353,7 @@ async def get_access_profile( resource_name: str, role_name: str, **kwargs: Any - ) -> "_models.ManagedClusterAccessProfile": + ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. **WARNING**\ : This API will be deprecated. Instead use `ListClusterUserCredentials @@ -349,13 +372,16 @@ async def get_access_profile( :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.ManagedClusterAccessProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterAccessProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] request = build_get_access_profile_request( @@ -365,11 +391,13 @@ async def get_access_profile( role_name=role_name, api_version=api_version, template_url=self.get_access_profile.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -397,7 +425,7 @@ async def list_cluster_admin_credentials( resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Lists the admin credentials of a managed cluster. Lists the admin credentials of a managed cluster. @@ -413,13 +441,16 @@ async def list_cluster_admin_credentials( :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_admin_credentials_request( @@ -429,11 +460,13 @@ async def list_cluster_admin_credentials( api_version=api_version, server_fqdn=server_fqdn, template_url=self.list_cluster_admin_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -461,7 +494,7 @@ async def list_cluster_user_credentials( resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Lists the user credentials of a managed cluster. Lists the user credentials of a managed cluster. @@ -477,13 +510,16 @@ async def list_cluster_user_credentials( :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_user_credentials_request( @@ -493,11 +529,13 @@ async def list_cluster_user_credentials( api_version=api_version, server_fqdn=server_fqdn, template_url=self.list_cluster_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -525,7 +563,7 @@ async def list_cluster_monitoring_user_credentials( resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Lists the cluster monitoring user credentials of a managed cluster. Lists the cluster monitoring user credentials of a managed cluster. @@ -541,13 +579,16 @@ async def list_cluster_monitoring_user_credentials( :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_monitoring_user_credentials_request( @@ -557,11 +598,13 @@ async def list_cluster_monitoring_user_credentials( api_version=api_version, server_fqdn=server_fqdn, template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -588,7 +631,7 @@ async def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedCluster": + ) -> _models.ManagedCluster: """Gets a managed cluster. Gets a managed cluster. @@ -602,13 +645,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.ManagedCluster :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] request = build_get_request( @@ -617,11 +663,13 @@ async def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -646,17 +694,20 @@ async def _create_or_update_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-09-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'ManagedCluster') @@ -668,11 +719,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -702,9 +755,9 @@ async def begin_create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> AsyncLROPoller["_models.ManagedCluster"]: + ) -> AsyncLROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. Creates or updates a managed cluster. @@ -729,37 +782,47 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_09_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -776,17 +839,20 @@ async def _update_tags_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-09-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'TagsObject') @@ -798,11 +864,13 @@ async def _update_tags_initial( content_type=content_type, json=_json, template_url=self._update_tags_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -828,9 +896,9 @@ async def begin_update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> AsyncLROPoller["_models.ManagedCluster"]: + ) -> AsyncLROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates tags on a managed cluster. @@ -855,37 +923,47 @@ async def begin_update_tags( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_09_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._update_tags_initial( + raw_result = await self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -904,13 +982,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -919,11 +1000,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -967,20 +1050,25 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_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) @@ -990,8 +1078,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1008,17 +1102,20 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-09-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') @@ -1030,11 +1127,13 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist content_type=content_type, json=_json, template_url=self._reset_service_principal_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1056,7 +1155,7 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> AsyncLROPoller[None]: """Reset the Service Principal Profile of a managed cluster. @@ -1082,23 +1181,28 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._reset_service_principal_profile_initial( + raw_result = await self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1108,8 +1212,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1126,17 +1236,20 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-09-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') @@ -1148,11 +1261,13 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta content_type=content_type, json=_json, template_url=self._reset_aad_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1174,7 +1289,7 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> AsyncLROPoller[None]: """Reset the AAD Profile of a managed cluster. @@ -1199,23 +1314,28 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._reset_aad_profile_initial( + raw_result = await self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1225,8 +1345,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1245,13 +1371,16 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_rotate_cluster_certificates_request_initial( @@ -1260,11 +1389,13 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- resource_name=resource_name, api_version=api_version, template_url=self._rotate_cluster_certificates_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1309,20 +1440,25 @@ async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-ret :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._rotate_cluster_certificates_initial( + raw_result = await self._rotate_cluster_certificates_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) @@ -1332,8 +1468,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1352,13 +1494,16 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_stop_request_initial( @@ -1367,11 +1512,13 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_name, api_version=api_version, template_url=self._stop_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1419,20 +1566,25 @@ async def begin_stop( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._stop_initial( + raw_result = await self._stop_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) @@ -1442,8 +1594,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1462,13 +1620,16 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_start_request_initial( @@ -1477,11 +1638,13 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_name, api_version=api_version, template_url=self._start_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1526,20 +1689,25 @@ async def begin_start( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._start_initial( + raw_result = await self._start_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) @@ -1549,8 +1717,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1567,17 +1741,20 @@ async def _run_command_initial( self, resource_group_name: str, resource_name: str, - request_payload: "_models.RunCommandRequest", + request_payload: _models.RunCommandRequest, **kwargs: Any - ) -> Optional["_models.RunCommandResult"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RunCommandResult"]] + ) -> Optional[_models.RunCommandResult]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-09-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] _json = self._serialize.body(request_payload, 'RunCommandRequest') @@ -1589,11 +1766,13 @@ async def _run_command_initial( content_type=content_type, json=_json, template_url=self._run_command_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1621,9 +1800,9 @@ async def begin_run_command( self, resource_group_name: str, resource_name: str, - request_payload: "_models.RunCommandRequest", + request_payload: _models.RunCommandRequest, **kwargs: Any - ) -> AsyncLROPoller["_models.RunCommandResult"]: + ) -> AsyncLROPoller[_models.RunCommandResult]: """Submits a command to run against the Managed Cluster. AKS will create a pod to run the command. This is primarily useful for private clusters. For @@ -1650,37 +1829,47 @@ async def begin_run_command( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_09_01.models.RunCommandResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.RunCommandResult] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._run_command_initial( + raw_result = await self._run_command_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, request_payload=request_payload, 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): - response = pipeline_response.http_response deserialized = self._deserialize('RunCommandResult', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1700,7 +1889,7 @@ async def get_command_result( resource_name: str, command_id: str, **kwargs: Any - ) -> Optional["_models.RunCommandResult"]: + ) -> Optional[_models.RunCommandResult]: """Gets the results of a command which has been run on the Managed Cluster. Gets the results of a command which has been run on the Managed Cluster. @@ -1716,13 +1905,16 @@ async def get_command_result( :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.RunCommandResult or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RunCommandResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] request = build_get_command_result_request( @@ -1732,11 +1924,13 @@ async def get_command_result( command_id=command_id, api_version=api_version, template_url=self.get_command_result.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1765,7 +1959,7 @@ def list_outbound_network_dependencies_endpoints( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> AsyncIterable["_models.OutboundEnvironmentEndpointCollection"]: + ) -> AsyncIterable[_models.OutboundEnvironmentEndpointCollection]: """Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. @@ -1783,13 +1977,16 @@ def list_outbound_network_dependencies_endpoints( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_09_01.models.OutboundEnvironmentEndpointCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OutboundEnvironmentEndpointCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -1799,9 +1996,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=self.list_outbound_network_dependencies_endpoints.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -1811,9 +2010,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/operations/_operations.py index a9545fe29aab..8a491c2c8513 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/operations/_operations.py @@ -14,6 +14,7 @@ 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 @@ -23,32 +24,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class Operations: - """Operations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_09_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_09_01.aio.ContainerServiceClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.OperationListResult"]: + ) -> AsyncIterable[_models.OperationListResult]: """Gets a list of operations. Gets a list of operations. @@ -59,31 +58,38 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_09_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/operations/_private_endpoint_connections_operations.py index b91ce6387d51..d8ebc73c6f1c 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/operations/_private_endpoint_connections_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -14,6 +14,7 @@ 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 @@ -24,26 +25,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class PrivateEndpointConnectionsOperations: - """PrivateEndpointConnectionsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_09_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_09_01.aio.ContainerServiceClient`'s + :attr:`private_endpoint_connections` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -51,7 +50,7 @@ async def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnectionListResult": + ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. To learn more about private clusters, see: @@ -66,13 +65,16 @@ async def list( :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.PrivateEndpointConnectionListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] request = build_list_request( @@ -81,11 +83,13 @@ async def list( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -113,7 +117,7 @@ async def get( resource_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Gets the specified private endpoint connection. To learn more about private clusters, see: @@ -130,13 +134,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] request = build_get_request( @@ -146,11 +153,13 @@ async def get( private_endpoint_connection_name=private_endpoint_connection_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -177,9 +186,9 @@ async def update( resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - parameters: "_models.PrivateEndpointConnection", + parameters: _models.PrivateEndpointConnection, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. Updates a private endpoint connection. @@ -197,14 +206,17 @@ async def update( :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-09-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] _json = self._serialize.body(parameters, 'PrivateEndpointConnection') @@ -217,11 +229,13 @@ async def update( content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -249,13 +263,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -265,11 +282,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name=private_endpoint_connection_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -316,21 +335,26 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -340,8 +364,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/operations/_private_link_resources_operations.py index 4f2f2075365a..9d376ffb96dd 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/operations/_private_link_resources_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/operations/_private_link_resources_operations.py @@ -13,6 +13,7 @@ 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 @@ -22,26 +23,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class PrivateLinkResourcesOperations: - """PrivateLinkResourcesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_09_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_09_01.aio.ContainerServiceClient`'s + :attr:`private_link_resources` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -49,7 +48,7 @@ async def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.PrivateLinkResourcesListResult": + ) -> _models.PrivateLinkResourcesListResult: """Gets a list of private link resources in the specified managed cluster. To learn more about private clusters, see: @@ -64,13 +63,16 @@ async def list( :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.PrivateLinkResourcesListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourcesListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] request = build_list_request( @@ -79,11 +81,13 @@ async def list( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/operations/_resolve_private_link_service_id_operations.py index 82e286f0ec96..fa46de6674f2 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/operations/_resolve_private_link_service_id_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/operations/_resolve_private_link_service_id_operations.py @@ -13,6 +13,7 @@ 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 @@ -22,35 +23,33 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ResolvePrivateLinkServiceIdOperations: - """ResolvePrivateLinkServiceIdOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_09_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_09_01.aio.ContainerServiceClient`'s + :attr:`resolve_private_link_service_id` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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 post( self, resource_group_name: str, resource_name: str, - parameters: "_models.PrivateLinkResource", + parameters: _models.PrivateLinkResource, **kwargs: Any - ) -> "_models.PrivateLinkResource": + ) -> _models.PrivateLinkResource: """Gets the private link service ID for the specified managed cluster. Gets the private link service ID for the specified managed cluster. @@ -66,14 +65,17 @@ async def post( :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.PrivateLinkResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-09-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] _json = self._serialize.body(parameters, 'PrivateLinkResource') @@ -85,11 +87,13 @@ async def post( content_type=content_type, json=_json, template_url=self.post.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/operations/_snapshots_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/operations/_snapshots_operations.py index 68054db92a65..f12eb8ca4259 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/operations/_snapshots_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/aio/operations/_snapshots_operations.py @@ -15,6 +15,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -24,32 +25,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class SnapshotsOperations: - """SnapshotsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_09_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_09_01.aio.ContainerServiceClient`'s + :attr:`snapshots` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.SnapshotListResult"]: + ) -> AsyncIterable[_models.SnapshotListResult]: """Gets a list of snapshots in the specified subscription. Gets a list of snapshots in the specified subscription. @@ -60,13 +59,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_09_01.models.SnapshotListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -74,9 +76,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -84,9 +88,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -124,7 +130,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.SnapshotListResult"]: + ) -> AsyncIterable[_models.SnapshotListResult]: """Lists snapshots in the specified subscription and resource group. Lists snapshots in the specified subscription and resource group. @@ -137,13 +143,16 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_09_01.models.SnapshotListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -152,9 +161,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -163,9 +174,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -204,7 +217,7 @@ async def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.Snapshot": + ) -> _models.Snapshot: """Gets a snapshot. Gets a snapshot. @@ -218,13 +231,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.Snapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] request = build_get_request( @@ -233,11 +249,13 @@ async def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -263,9 +281,9 @@ async def create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.Snapshot", + parameters: _models.Snapshot, **kwargs: Any - ) -> "_models.Snapshot": + ) -> _models.Snapshot: """Creates or updates a snapshot. Creates or updates a snapshot. @@ -281,14 +299,17 @@ async def create_or_update( :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.Snapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-09-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] _json = self._serialize.body(parameters, 'Snapshot') @@ -300,11 +321,13 @@ async def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -334,9 +357,9 @@ async def update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.Snapshot": + ) -> _models.Snapshot: """Updates tags on a snapshot. Updates tags on a snapshot. @@ -352,14 +375,17 @@ async def update_tags( :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.Snapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-09-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] _json = self._serialize.body(parameters, 'TagsObject') @@ -371,11 +397,13 @@ async def update_tags( content_type=content_type, json=_json, template_url=self.update_tags.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -416,13 +444,16 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -431,11 +462,13 @@ async def delete( # pylint: disable=inconsistent-return-statements resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/models/__init__.py index 7efcc102cc76..a55c620d2804 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/models/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/models/__init__.py @@ -130,7 +130,9 @@ WeekDay, WorkloadRuntime, ) - +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'AgentPool', 'AgentPoolAvailableVersions', @@ -253,3 +255,5 @@ 'WeekDay', 'WorkloadRuntime', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/models/_container_service_client_enums.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/models/_container_service_client_enums.py index 54490bab6467..ca3b2ccab3e1 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/models/_container_service_client_enums.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/models/_container_service_client_enums.py @@ -7,11 +7,10 @@ # -------------------------------------------------------------------------- from enum import Enum -from six import with_metaclass from azure.core import CaseInsensitiveEnumMeta -class AgentPoolMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class AgentPoolMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: https://docs.microsoft.com/azure/aks/use-system-pools @@ -24,7 +23,7 @@ class AgentPoolMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: User agent pools are primarily for hosting your application pods. USER = "User" -class AgentPoolType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class AgentPoolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of Agent Pool. """ @@ -33,7 +32,7 @@ class AgentPoolType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Use of this is strongly discouraged. AVAILABILITY_SET = "AvailabilitySet" -class Code(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class Code(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Tells whether the cluster is Running or Stopped """ @@ -42,7 +41,7 @@ class Code(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: The cluster is stopped. STOPPED = "Stopped" -class ConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The private link service connection status. """ @@ -51,7 +50,7 @@ class ConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): REJECTED = "Rejected" DISCONNECTED = "Disconnected" -class ContainerServiceStorageProfileTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Specifies what kind of storage to use. If omitted, the default will be chosen on your behalf based on the choice of orchestrator. """ @@ -59,7 +58,7 @@ class ContainerServiceStorageProfileTypes(with_metaclass(CaseInsensitiveEnumMeta STORAGE_ACCOUNT = "StorageAccount" MANAGED_DISKS = "ManagedDisks" -class ContainerServiceVMSizeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Size of agent VMs. Note: This is no longer maintained. """ @@ -238,7 +237,7 @@ class ContainerServiceVMSizeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, E STANDARD_NV24 = "Standard_NV24" STANDARD_NV6 = "Standard_NV6" -class Count(with_metaclass(CaseInsensitiveEnumMeta, int, Enum)): +class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): """Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, and 5. The default value is 1. """ @@ -247,7 +246,7 @@ class Count(with_metaclass(CaseInsensitiveEnumMeta, int, Enum)): THREE = 3 FIVE = 5 -class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of identity that created the resource. """ @@ -256,7 +255,7 @@ class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class Expander(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class Expander(str, Enum, metaclass=CaseInsensitiveEnumMeta): """If not specified, the default is 'random'. See `expanders `_ for more information. @@ -279,13 +278,13 @@ class Expander(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Used when you don't have a particular need for the node groups to scale differently. RANDOM = "random" -class ExtendedLocationTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ExtendedLocationTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of extendedLocation. """ EDGE_ZONE = "EdgeZone" -class GPUInstanceProfile(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class GPUInstanceProfile(str, Enum, metaclass=CaseInsensitiveEnumMeta): """GPUInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU. """ @@ -295,7 +294,7 @@ class GPUInstanceProfile(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MIG4_G = "MIG4g" MIG7_G = "MIG7g" -class KubeletDiskType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class KubeletDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. """ @@ -305,7 +304,7 @@ class KubeletDiskType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Kubelet will use the temporary disk for its data. TEMPORARY = "Temporary" -class LicenseType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class LicenseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The license type to use for Windows VMs. See `Azure Hybrid User Benefits `_ for more details. """ @@ -315,7 +314,7 @@ class LicenseType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Enables Azure Hybrid User Benefits for Windows VMs. WINDOWS_SERVER = "Windows_Server" -class LoadBalancerSku(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class LoadBalancerSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the differences between load balancer SKUs. @@ -328,7 +327,7 @@ class LoadBalancerSku(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Use a basic Load Balancer with limited functionality. BASIC = "basic" -class ManagedClusterPodIdentityProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ManagedClusterPodIdentityProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The current provisioning state of the pod identity. """ @@ -337,13 +336,13 @@ class ManagedClusterPodIdentityProvisioningState(with_metaclass(CaseInsensitiveE DELETING = "Deleting" FAILED = "Failed" -class ManagedClusterSKUName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ManagedClusterSKUName(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The name of a managed cluster SKU. """ BASIC = "Basic" -class ManagedClusterSKUTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ManagedClusterSKUTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): """If not specified, the default is 'Free'. See `uptime SLA `_ for more details. """ @@ -354,7 +353,7 @@ class ManagedClusterSKUTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: No guaranteed SLA, no additional charges. Free tier clusters have an SLO of 99.5%. FREE = "Free" -class NetworkMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """This cannot be specified if networkPlugin is anything other than 'azure'. """ @@ -365,7 +364,7 @@ class NetworkMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: This is no longer supported. BRIDGE = "bridge" -class NetworkPlugin(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkPlugin(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Network plugin used for building the Kubernetes network. """ @@ -378,7 +377,7 @@ class NetworkPlugin(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: information. KUBENET = "kubenet" -class NetworkPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Network policy used for building the Kubernetes network. """ @@ -391,7 +390,7 @@ class NetworkPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: for more information. AZURE = "azure" -class OSDiskType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OSDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS @@ -407,14 +406,14 @@ class OSDiskType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: provides lower read/write latency, along with faster node scaling and cluster upgrades. EPHEMERAL = "Ephemeral" -class OSSKU(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OSSKU(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Specifies an OS SKU. This value must not be specified if OSType is Windows. """ UBUNTU = "Ubuntu" CBL_MARINER = "CBLMariner" -class OSType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The operating system type. The default is Linux. """ @@ -423,7 +422,7 @@ class OSType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Use Windows. WINDOWS = "Windows" -class OutboundType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OutboundType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type `_. """ @@ -443,7 +442,7 @@ class OutboundType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: advanced scenario and requires proper network configuration. USER_ASSIGNED_NAT_GATEWAY = "userAssignedNATGateway" -class PrivateEndpointConnectionProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class PrivateEndpointConnectionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The current provisioning state. """ @@ -452,7 +451,7 @@ class PrivateEndpointConnectionProvisioningState(with_metaclass(CaseInsensitiveE DELETING = "Deleting" FAILED = "Failed" -class PublicNetworkAccess(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class PublicNetworkAccess(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Default value is 'Enabled' (case insensitive). Could be set to 'Disabled' to enable private cluster """ @@ -460,7 +459,7 @@ class PublicNetworkAccess(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): ENABLED = "Enabled" DISABLED = "Disabled" -class ResourceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """For more information see `use managed identities in AKS `_. """ @@ -476,7 +475,7 @@ class ResourceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Do not use a managed identity for the Managed Cluster, service principal will be used instead. NONE = "None" -class ScaleDownMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ScaleDownMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Describes how VMs are added to or removed from Agent Pools. See `billing states `_. """ @@ -487,7 +486,7 @@ class ScaleDownMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: during scale down. DEALLOCATE = "Deallocate" -class ScaleSetEvictionPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The eviction policy specifies what to do with the VM when it is evicted. The default is Delete. For more information about eviction see `spot VMs `_ @@ -500,7 +499,7 @@ class ScaleSetEvictionPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)) #: cause issues with cluster scaling or upgrading. DEALLOCATE = "Deallocate" -class ScaleSetPriority(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ScaleSetPriority(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The Virtual Machine Scale Set priority. """ @@ -510,14 +509,14 @@ class ScaleSetPriority(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Regular VMs will be used. REGULAR = "Regular" -class SnapshotType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SnapshotType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of a snapshot. The default is NodePool. """ #: The snapshot is a snapshot of a node pool. NODE_POOL = "NodePool" -class UpgradeChannel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class UpgradeChannel(str, Enum, metaclass=CaseInsensitiveEnumMeta): """For more information see `setting the AKS cluster auto-upgrade channel `_. """ @@ -547,7 +546,7 @@ class UpgradeChannel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Disables auto-upgrades and keeps the cluster at its current version of Kubernetes. NONE = "none" -class WeekDay(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class WeekDay(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The weekday enum. """ @@ -559,7 +558,7 @@ class WeekDay(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): FRIDAY = "Friday" SATURDAY = "Saturday" -class WorkloadRuntime(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class WorkloadRuntime(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Determines the type of workload a node can run. """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/models/_models_py3.py index f255a3015473..ca71353911dc 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/models/_models_py3.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/models/_models_py3.py @@ -7,11 +7,13 @@ # -------------------------------------------------------------------------- import datetime -from typing import Dict, List, Optional, Union +from typing import Dict, List, Optional, TYPE_CHECKING, Union import msrest.serialization -from ._container_service_client_enums import * +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + import __init__ as _models class SubResource(msrest.serialization.Model): @@ -79,15 +81,15 @@ class AgentPool(SubResource): :ivar os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS - `_. Possible values - include: "Managed", "Ephemeral". + `_. Known values are: + "Managed", "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2021_09_01.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Possible values include: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_09_01.models.KubeletDiskType - :ivar workload_runtime: Determines the type of workload a node can run. Possible values - include: "OCIContainer", "WasmWasi". + :ivar workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer", "WasmWasi". :vartype workload_runtime: str or ~azure.mgmt.containerservice.v2021_09_01.models.WorkloadRuntime :ivar vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and used. @@ -101,11 +103,11 @@ class AgentPool(SubResource): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2021_09_01.models.OSType - :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Possible values include: "Ubuntu", "CBLMariner". + :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known + values are: "Ubuntu", "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2021_09_01.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. :vartype max_count: int @@ -114,16 +116,15 @@ class AgentPool(SubResource): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it - defaults to Delete. Possible values include: "Delete", "Deallocate". + defaults to Delete. Known values are: "Delete", "Deallocate". :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2021_09_01.models.ScaleDownMode - :ivar type_properties_type: The type of Agent Pool. Possible values include: + :ivar type_properties_type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :vartype type_properties_type: str or ~azure.mgmt.containerservice.v2021_09_01.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Possible values include: "System", - "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". :vartype mode: str or ~azure.mgmt.containerservice.v2021_09_01.models.AgentPoolMode :ivar orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -158,12 +159,12 @@ class AgentPool(SubResource): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Possible values include: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_09_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Possible values include: "Delete", - "Deallocate". Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_09_01.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which @@ -195,7 +196,7 @@ class AgentPool(SubResource): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2021_09_01.models.GPUInstanceProfile :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool @@ -263,40 +264,40 @@ def __init__( count: Optional[int] = None, vm_size: Optional[str] = None, os_disk_size_gb: Optional[int] = None, - os_disk_type: Optional[Union[str, "OSDiskType"]] = None, - kubelet_disk_type: Optional[Union[str, "KubeletDiskType"]] = None, - workload_runtime: Optional[Union[str, "WorkloadRuntime"]] = None, + os_disk_type: Optional[Union[str, "_models.OSDiskType"]] = None, + kubelet_disk_type: Optional[Union[str, "_models.KubeletDiskType"]] = None, + workload_runtime: Optional[Union[str, "_models.WorkloadRuntime"]] = None, vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", - os_sku: Optional[Union[str, "OSSKU"]] = None, + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - scale_down_mode: Optional[Union[str, "ScaleDownMode"]] = None, - type_properties_type: Optional[Union[str, "AgentPoolType"]] = None, - mode: Optional[Union[str, "AgentPoolMode"]] = None, + scale_down_mode: Optional[Union[str, "_models.ScaleDownMode"]] = None, + type_properties_type: Optional[Union[str, "_models.AgentPoolType"]] = None, + mode: Optional[Union[str, "_models.AgentPoolMode"]] = None, orchestrator_version: Optional[str] = None, - upgrade_settings: Optional["AgentPoolUpgradeSettings"] = None, - power_state: Optional["PowerState"] = None, + upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, + power_state: Optional["_models.PowerState"] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", spot_max_price: Optional[float] = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, proximity_placement_group_id: Optional[str] = None, - kubelet_config: Optional["KubeletConfig"] = None, - linux_os_config: Optional["LinuxOSConfig"] = None, + kubelet_config: Optional["_models.KubeletConfig"] = None, + linux_os_config: Optional["_models.LinuxOSConfig"] = None, enable_encryption_at_host: Optional[bool] = None, enable_ultra_ssd: Optional[bool] = None, enable_fips: Optional[bool] = None, - gpu_instance_profile: Optional[Union[str, "GPUInstanceProfile"]] = None, - creation_data: Optional["CreationData"] = None, + gpu_instance_profile: Optional[Union[str, "_models.GPUInstanceProfile"]] = None, + creation_data: Optional["_models.CreationData"] = None, **kwargs ): """ @@ -315,15 +316,15 @@ def __init__( :keyword os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS - `_. Possible values - include: "Managed", "Ephemeral". + `_. Known values are: + "Managed", "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2021_09_01.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Possible values include: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_09_01.models.KubeletDiskType - :keyword workload_runtime: Determines the type of workload a node can run. Possible values - include: "OCIContainer", "WasmWasi". + :keyword workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer", "WasmWasi". :paramtype workload_runtime: str or ~azure.mgmt.containerservice.v2021_09_01.models.WorkloadRuntime :keyword vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and @@ -337,11 +338,11 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2021_09_01.models.OSType :keyword os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Possible values include: "Ubuntu", "CBLMariner". + Known values are: "Ubuntu", "CBLMariner". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2021_09_01.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -350,17 +351,16 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, - it defaults to Delete. Possible values include: "Delete", "Deallocate". + it defaults to Delete. Known values are: "Delete", "Deallocate". :paramtype scale_down_mode: str or ~azure.mgmt.containerservice.v2021_09_01.models.ScaleDownMode - :keyword type_properties_type: The type of Agent Pool. Possible values include: + :keyword type_properties_type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type_properties_type: str or ~azure.mgmt.containerservice.v2021_09_01.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Possible values include: "System", - "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2021_09_01.models.AgentPoolMode :keyword orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -391,12 +391,12 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Possible values include: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_09_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Possible values include: "Delete", - "Deallocate". Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_09_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which @@ -428,7 +428,7 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2021_09_01.models.GPUInstanceProfile @@ -510,7 +510,7 @@ class AgentPoolAvailableVersions(msrest.serialization.Model): def __init__( self, *, - agent_pool_versions: Optional[List["AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem"]] = None, + agent_pool_versions: Optional[List["_models.AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem"]] = None, **kwargs ): """ @@ -587,7 +587,7 @@ class AgentPoolListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["AgentPool"]] = None, + value: Optional[List["_models.AgentPool"]] = None, **kwargs ): """ @@ -614,8 +614,8 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): :vartype type: str :ivar kubernetes_version: Required. The Kubernetes version (major.minor.patch). :vartype kubernetes_version: str - :ivar os_type: Required. The operating system type. The default is Linux. Possible values - include: "Linux", "Windows". Default value: "Linux". + :ivar os_type: Required. The operating system type. The default is Linux. Known values are: + "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2021_09_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -646,16 +646,16 @@ def __init__( self, *, kubernetes_version: str, - os_type: Union[str, "OSType"] = "Linux", - upgrades: Optional[List["AgentPoolUpgradeProfilePropertiesUpgradesItem"]] = None, + os_type: Union[str, "_models.OSType"] = "Linux", + upgrades: Optional[List["_models.AgentPoolUpgradeProfilePropertiesUpgradesItem"]] = None, latest_node_image_version: Optional[str] = None, **kwargs ): """ :keyword kubernetes_version: Required. The Kubernetes version (major.minor.patch). :paramtype kubernetes_version: str - :keyword os_type: Required. The operating system type. The default is Linux. Possible values - include: "Linux", "Windows". Default value: "Linux". + :keyword os_type: Required. The operating system type. The default is Linux. Known values are: + "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2021_09_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: @@ -767,7 +767,7 @@ def __init__( code: Optional[str] = None, message: Optional[str] = None, target: Optional[str] = None, - details: Optional[List["CloudErrorBody"]] = None, + details: Optional[List["_models.CloudErrorBody"]] = None, **kwargs ): """ @@ -811,7 +811,7 @@ class ContainerServiceDiagnosticsProfile(msrest.serialization.Model): def __init__( self, *, - vm_diagnostics: "ContainerServiceVMDiagnostics", + vm_diagnostics: "_models.ContainerServiceVMDiagnostics", **kwargs ): """ @@ -848,7 +848,7 @@ def __init__( self, *, admin_username: str, - ssh: "ContainerServiceSshConfiguration", + ssh: "_models.ContainerServiceSshConfiguration", **kwargs ): """ @@ -871,17 +871,17 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar count: Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, - and 5. The default value is 1. Possible values include: 1, 3, 5. Default value: "1". + and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". :vartype count: int or ~azure.mgmt.containerservice.v2021_09_01.models.Count :ivar dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. :vartype dns_prefix: str - :ivar vm_size: Required. Size of agent VMs. Possible values include: "Standard_A1", - "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", - "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", - "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", - "Standard_A8m_v2", "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", - "Standard_B8ms", "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", - "Standard_D12", "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", + :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", + "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", + "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", + "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", "Standard_B8ms", + "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", "Standard_D12", + "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", "Standard_D13_v2_Promo", "Standard_D14", "Standard_D14_v2", "Standard_D14_v2_Promo", "Standard_D15_v2", "Standard_D16_v3", "Standard_D16s_v3", "Standard_D1_v2", "Standard_D2", "Standard_D2_v2", "Standard_D2_v2_Promo", "Standard_D2_v3", "Standard_D2s_v3", "Standard_D3", @@ -926,7 +926,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): :vartype first_consecutive_static_ip: str :ivar storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Possible values include: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". :vartype storage_profile: str or ~azure.mgmt.containerservice.v2021_09_01.models.ContainerServiceStorageProfileTypes :ivar fqdn: FQDN for the master pool. @@ -955,27 +955,27 @@ def __init__( self, *, dns_prefix: str, - vm_size: Union[str, "ContainerServiceVMSizeTypes"], - count: Optional[Union[int, "Count"]] = 1, + vm_size: Union[str, "_models.ContainerServiceVMSizeTypes"], + count: Optional[Union[int, "_models.Count"]] = 1, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, first_consecutive_static_ip: Optional[str] = "10.240.255.5", - storage_profile: Optional[Union[str, "ContainerServiceStorageProfileTypes"]] = None, + storage_profile: Optional[Union[str, "_models.ContainerServiceStorageProfileTypes"]] = None, **kwargs ): """ :keyword count: Number of masters (VMs) in the container service cluster. Allowed values are 1, - 3, and 5. The default value is 1. Possible values include: 1, 3, 5. Default value: "1". + 3, and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". :paramtype count: int or ~azure.mgmt.containerservice.v2021_09_01.models.Count :keyword dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. :paramtype dns_prefix: str - :keyword vm_size: Required. Size of agent VMs. Possible values include: "Standard_A1", - "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", - "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", - "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", - "Standard_A8m_v2", "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", - "Standard_B8ms", "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", - "Standard_D12", "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", + :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", + "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", + "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", + "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", "Standard_B8ms", + "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", "Standard_D12", + "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", "Standard_D13_v2_Promo", "Standard_D14", "Standard_D14_v2", "Standard_D14_v2_Promo", "Standard_D15_v2", "Standard_D16_v3", "Standard_D16s_v3", "Standard_D1_v2", "Standard_D2", "Standard_D2_v2", "Standard_D2_v2_Promo", "Standard_D2_v3", "Standard_D2s_v3", "Standard_D3", @@ -1020,7 +1020,7 @@ def __init__( :paramtype first_consecutive_static_ip: str :keyword storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Possible values include: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". :paramtype storage_profile: str or ~azure.mgmt.containerservice.v2021_09_01.models.ContainerServiceStorageProfileTypes """ @@ -1038,14 +1038,14 @@ def __init__( class ContainerServiceNetworkProfile(msrest.serialization.Model): """Profile of network configuration. - :ivar network_plugin: Network plugin used for building the Kubernetes network. Possible values - include: "azure", "kubenet". Default value: "kubenet". + :ivar network_plugin: Network plugin used for building the Kubernetes network. Known values + are: "azure", "kubenet". Default value: "kubenet". :vartype network_plugin: str or ~azure.mgmt.containerservice.v2021_09_01.models.NetworkPlugin - :ivar network_policy: Network policy used for building the Kubernetes network. Possible values - include: "calico", "azure". + :ivar network_policy: Network policy used for building the Kubernetes network. Known values + are: "calico", "azure". :vartype network_policy: str or ~azure.mgmt.containerservice.v2021_09_01.models.NetworkPolicy :ivar network_mode: This cannot be specified if networkPlugin is anything other than 'azure'. - Possible values include: "transparent", "bridge". + Known values are: "transparent", "bridge". :vartype network_mode: str or ~azure.mgmt.containerservice.v2021_09_01.models.NetworkMode :ivar pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :vartype pod_cidr: str @@ -1060,13 +1060,13 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): :vartype docker_bridge_cidr: str :ivar outbound_type: This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type - `_. Possible values include: - "loadBalancer", "userDefinedRouting", "managedNATGateway", "userAssignedNATGateway". Default - value: "loadBalancer". + `_. Known values are: "loadBalancer", + "userDefinedRouting", "managedNATGateway", "userAssignedNATGateway". Default value: + "loadBalancer". :vartype outbound_type: str or ~azure.mgmt.containerservice.v2021_09_01.models.OutboundType :ivar load_balancer_sku: The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the - differences between load balancer SKUs. Possible values include: "standard", "basic". + differences between load balancer SKUs. Known values are: "standard", "basic". :vartype load_balancer_sku: str or ~azure.mgmt.containerservice.v2021_09_01.models.LoadBalancerSku :ivar load_balancer_profile: Profile of the cluster load balancer. @@ -1101,28 +1101,28 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): def __init__( self, *, - network_plugin: Optional[Union[str, "NetworkPlugin"]] = "kubenet", - network_policy: Optional[Union[str, "NetworkPolicy"]] = None, - network_mode: Optional[Union[str, "NetworkMode"]] = None, + network_plugin: Optional[Union[str, "_models.NetworkPlugin"]] = "kubenet", + network_policy: Optional[Union[str, "_models.NetworkPolicy"]] = None, + network_mode: Optional[Union[str, "_models.NetworkMode"]] = None, pod_cidr: Optional[str] = "10.244.0.0/16", service_cidr: Optional[str] = "10.0.0.0/16", dns_service_ip: Optional[str] = "10.0.0.10", docker_bridge_cidr: Optional[str] = "172.17.0.1/16", - outbound_type: Optional[Union[str, "OutboundType"]] = "loadBalancer", - load_balancer_sku: Optional[Union[str, "LoadBalancerSku"]] = None, - load_balancer_profile: Optional["ManagedClusterLoadBalancerProfile"] = None, - nat_gateway_profile: Optional["ManagedClusterNATGatewayProfile"] = None, + outbound_type: Optional[Union[str, "_models.OutboundType"]] = "loadBalancer", + load_balancer_sku: Optional[Union[str, "_models.LoadBalancerSku"]] = None, + load_balancer_profile: Optional["_models.ManagedClusterLoadBalancerProfile"] = None, + nat_gateway_profile: Optional["_models.ManagedClusterNATGatewayProfile"] = None, **kwargs ): """ - :keyword network_plugin: Network plugin used for building the Kubernetes network. Possible - values include: "azure", "kubenet". Default value: "kubenet". + :keyword network_plugin: Network plugin used for building the Kubernetes network. Known values + are: "azure", "kubenet". Default value: "kubenet". :paramtype network_plugin: str or ~azure.mgmt.containerservice.v2021_09_01.models.NetworkPlugin - :keyword network_policy: Network policy used for building the Kubernetes network. Possible - values include: "calico", "azure". + :keyword network_policy: Network policy used for building the Kubernetes network. Known values + are: "calico", "azure". :paramtype network_policy: str or ~azure.mgmt.containerservice.v2021_09_01.models.NetworkPolicy :keyword network_mode: This cannot be specified if networkPlugin is anything other than - 'azure'. Possible values include: "transparent", "bridge". + 'azure'. Known values are: "transparent", "bridge". :paramtype network_mode: str or ~azure.mgmt.containerservice.v2021_09_01.models.NetworkMode :keyword pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :paramtype pod_cidr: str @@ -1137,13 +1137,13 @@ def __init__( :paramtype docker_bridge_cidr: str :keyword outbound_type: This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type - `_. Possible values include: - "loadBalancer", "userDefinedRouting", "managedNATGateway", "userAssignedNATGateway". Default - value: "loadBalancer". + `_. Known values are: "loadBalancer", + "userDefinedRouting", "managedNATGateway", "userAssignedNATGateway". Default value: + "loadBalancer". :paramtype outbound_type: str or ~azure.mgmt.containerservice.v2021_09_01.models.OutboundType :keyword load_balancer_sku: The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the - differences between load balancer SKUs. Possible values include: "standard", "basic". + differences between load balancer SKUs. Known values are: "standard", "basic". :paramtype load_balancer_sku: str or ~azure.mgmt.containerservice.v2021_09_01.models.LoadBalancerSku :keyword load_balancer_profile: Profile of the cluster load balancer. @@ -1189,7 +1189,7 @@ class ContainerServiceSshConfiguration(msrest.serialization.Model): def __init__( self, *, - public_keys: List["ContainerServiceSshPublicKey"], + public_keys: List["_models.ContainerServiceSshPublicKey"], **kwargs ): """ @@ -1377,7 +1377,7 @@ def __init__( self, *, domain_name: Optional[str] = None, - endpoint_details: Optional[List["EndpointDetail"]] = None, + endpoint_details: Optional[List["_models.EndpointDetail"]] = None, **kwargs ): """ @@ -1443,7 +1443,7 @@ class ExtendedLocation(msrest.serialization.Model): :ivar name: The name of the extended location. :vartype name: str - :ivar type: The type of the extended location. Possible values include: "EdgeZone". + :ivar type: The type of the extended location. Known values are: "EdgeZone". :vartype type: str or ~azure.mgmt.containerservice.v2021_09_01.models.ExtendedLocationTypes """ @@ -1456,13 +1456,13 @@ def __init__( self, *, name: Optional[str] = None, - type: Optional[Union[str, "ExtendedLocationTypes"]] = None, + type: Optional[Union[str, "_models.ExtendedLocationTypes"]] = None, **kwargs ): """ :keyword name: The name of the extended location. :paramtype name: str - :keyword type: The type of the extended location. Possible values include: "EdgeZone". + :keyword type: The type of the extended location. Known values are: "EdgeZone". :paramtype type: str or ~azure.mgmt.containerservice.v2021_09_01.models.ExtendedLocationTypes """ super(ExtendedLocation, self).__init__(**kwargs) @@ -1621,7 +1621,7 @@ class LinuxOSConfig(msrest.serialization.Model): def __init__( self, *, - sysctls: Optional["SysctlConfig"] = None, + sysctls: Optional["_models.SysctlConfig"] = None, transparent_huge_page_enabled: Optional[str] = None, transparent_huge_page_defrag: Optional[str] = None, swap_file_size_mb: Optional[int] = None, @@ -1689,8 +1689,8 @@ class MaintenanceConfiguration(SubResource): def __init__( self, *, - time_in_week: Optional[List["TimeInWeek"]] = None, - not_allowed_time: Optional[List["TimeSpan"]] = None, + time_in_week: Optional[List["_models.TimeInWeek"]] = None, + not_allowed_time: Optional[List["_models.TimeSpan"]] = None, **kwargs ): """ @@ -1729,7 +1729,7 @@ class MaintenanceConfigurationListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["MaintenanceConfiguration"]] = None, + value: Optional[List["_models.MaintenanceConfiguration"]] = None, **kwargs ): """ @@ -1908,7 +1908,7 @@ class ManagedCluster(Resource): :vartype security_profile: ~azure.mgmt.containerservice.v2021_09_01.models.ManagedClusterSecurityProfile :ivar public_network_access: Default value is 'Enabled' (case insensitive). Could be set to - 'Disabled' to enable private cluster. Possible values include: "Enabled", "Disabled". + 'Disabled' to enable private cluster. Known values are: "Enabled", "Disabled". :vartype public_network_access: str or ~azure.mgmt.containerservice.v2021_09_01.models.PublicNetworkAccess """ @@ -1972,33 +1972,33 @@ def __init__( *, location: str, tags: Optional[Dict[str, str]] = None, - sku: Optional["ManagedClusterSKU"] = None, - extended_location: Optional["ExtendedLocation"] = None, - identity: Optional["ManagedClusterIdentity"] = None, + sku: Optional["_models.ManagedClusterSKU"] = None, + extended_location: Optional["_models.ExtendedLocation"] = None, + identity: Optional["_models.ManagedClusterIdentity"] = None, kubernetes_version: Optional[str] = None, dns_prefix: Optional[str] = None, fqdn_subdomain: Optional[str] = None, - agent_pool_profiles: Optional[List["ManagedClusterAgentPoolProfile"]] = None, - linux_profile: Optional["ContainerServiceLinuxProfile"] = None, - windows_profile: Optional["ManagedClusterWindowsProfile"] = None, - service_principal_profile: Optional["ManagedClusterServicePrincipalProfile"] = None, - addon_profiles: Optional[Dict[str, "ManagedClusterAddonProfile"]] = None, - pod_identity_profile: Optional["ManagedClusterPodIdentityProfile"] = None, + agent_pool_profiles: Optional[List["_models.ManagedClusterAgentPoolProfile"]] = None, + linux_profile: Optional["_models.ContainerServiceLinuxProfile"] = None, + windows_profile: Optional["_models.ManagedClusterWindowsProfile"] = None, + service_principal_profile: Optional["_models.ManagedClusterServicePrincipalProfile"] = None, + addon_profiles: Optional[Dict[str, "_models.ManagedClusterAddonProfile"]] = None, + pod_identity_profile: Optional["_models.ManagedClusterPodIdentityProfile"] = None, node_resource_group: Optional[str] = None, enable_rbac: Optional[bool] = None, enable_pod_security_policy: Optional[bool] = None, - network_profile: Optional["ContainerServiceNetworkProfile"] = None, - aad_profile: Optional["ManagedClusterAADProfile"] = None, - auto_upgrade_profile: Optional["ManagedClusterAutoUpgradeProfile"] = None, - auto_scaler_profile: Optional["ManagedClusterPropertiesAutoScalerProfile"] = None, - api_server_access_profile: Optional["ManagedClusterAPIServerAccessProfile"] = None, + network_profile: Optional["_models.ContainerServiceNetworkProfile"] = None, + aad_profile: Optional["_models.ManagedClusterAADProfile"] = None, + auto_upgrade_profile: Optional["_models.ManagedClusterAutoUpgradeProfile"] = None, + auto_scaler_profile: Optional["_models.ManagedClusterPropertiesAutoScalerProfile"] = None, + api_server_access_profile: Optional["_models.ManagedClusterAPIServerAccessProfile"] = None, disk_encryption_set_id: Optional[str] = None, - identity_profile: Optional[Dict[str, "UserAssignedIdentity"]] = None, - private_link_resources: Optional[List["PrivateLinkResource"]] = None, + identity_profile: Optional[Dict[str, "_models.UserAssignedIdentity"]] = None, + private_link_resources: Optional[List["_models.PrivateLinkResource"]] = None, disable_local_accounts: Optional[bool] = None, - http_proxy_config: Optional["ManagedClusterHTTPProxyConfig"] = None, - security_profile: Optional["ManagedClusterSecurityProfile"] = None, - public_network_access: Optional[Union[str, "PublicNetworkAccess"]] = None, + http_proxy_config: Optional["_models.ManagedClusterHTTPProxyConfig"] = None, + security_profile: Optional["_models.ManagedClusterSecurityProfile"] = None, + public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None, **kwargs ): """ @@ -2088,7 +2088,7 @@ def __init__( :paramtype security_profile: ~azure.mgmt.containerservice.v2021_09_01.models.ManagedClusterSecurityProfile :keyword public_network_access: Default value is 'Enabled' (case insensitive). Could be set to - 'Disabled' to enable private cluster. Possible values include: "Enabled", "Disabled". + 'Disabled' to enable private cluster. Known values are: "Enabled", "Disabled". :paramtype public_network_access: str or ~azure.mgmt.containerservice.v2021_09_01.models.PublicNetworkAccess """ @@ -2397,15 +2397,15 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS - `_. Possible values - include: "Managed", "Ephemeral". + `_. Known values are: + "Managed", "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2021_09_01.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Possible values include: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_09_01.models.KubeletDiskType - :ivar workload_runtime: Determines the type of workload a node can run. Possible values - include: "OCIContainer", "WasmWasi". + :ivar workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer", "WasmWasi". :vartype workload_runtime: str or ~azure.mgmt.containerservice.v2021_09_01.models.WorkloadRuntime :ivar vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and used. @@ -2419,11 +2419,11 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2021_09_01.models.OSType - :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Possible values include: "Ubuntu", "CBLMariner". + :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known + values are: "Ubuntu", "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2021_09_01.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. :vartype max_count: int @@ -2432,15 +2432,14 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it - defaults to Delete. Possible values include: "Delete", "Deallocate". + defaults to Delete. Known values are: "Delete", "Deallocate". :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2021_09_01.models.ScaleDownMode - :ivar type: The type of Agent Pool. Possible values include: "VirtualMachineScaleSets", + :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2021_09_01.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Possible values include: "System", - "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". :vartype mode: str or ~azure.mgmt.containerservice.v2021_09_01.models.AgentPoolMode :ivar orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -2475,12 +2474,12 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Possible values include: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_09_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Possible values include: "Delete", - "Deallocate". Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_09_01.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which @@ -2512,7 +2511,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2021_09_01.models.GPUInstanceProfile :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool @@ -2574,40 +2573,40 @@ def __init__( count: Optional[int] = None, vm_size: Optional[str] = None, os_disk_size_gb: Optional[int] = None, - os_disk_type: Optional[Union[str, "OSDiskType"]] = None, - kubelet_disk_type: Optional[Union[str, "KubeletDiskType"]] = None, - workload_runtime: Optional[Union[str, "WorkloadRuntime"]] = None, + os_disk_type: Optional[Union[str, "_models.OSDiskType"]] = None, + kubelet_disk_type: Optional[Union[str, "_models.KubeletDiskType"]] = None, + workload_runtime: Optional[Union[str, "_models.WorkloadRuntime"]] = None, vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", - os_sku: Optional[Union[str, "OSSKU"]] = None, + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - scale_down_mode: Optional[Union[str, "ScaleDownMode"]] = None, - type: Optional[Union[str, "AgentPoolType"]] = None, - mode: Optional[Union[str, "AgentPoolMode"]] = None, + scale_down_mode: Optional[Union[str, "_models.ScaleDownMode"]] = None, + type: Optional[Union[str, "_models.AgentPoolType"]] = None, + mode: Optional[Union[str, "_models.AgentPoolMode"]] = None, orchestrator_version: Optional[str] = None, - upgrade_settings: Optional["AgentPoolUpgradeSettings"] = None, - power_state: Optional["PowerState"] = None, + upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, + power_state: Optional["_models.PowerState"] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", spot_max_price: Optional[float] = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, proximity_placement_group_id: Optional[str] = None, - kubelet_config: Optional["KubeletConfig"] = None, - linux_os_config: Optional["LinuxOSConfig"] = None, + kubelet_config: Optional["_models.KubeletConfig"] = None, + linux_os_config: Optional["_models.LinuxOSConfig"] = None, enable_encryption_at_host: Optional[bool] = None, enable_ultra_ssd: Optional[bool] = None, enable_fips: Optional[bool] = None, - gpu_instance_profile: Optional[Union[str, "GPUInstanceProfile"]] = None, - creation_data: Optional["CreationData"] = None, + gpu_instance_profile: Optional[Union[str, "_models.GPUInstanceProfile"]] = None, + creation_data: Optional["_models.CreationData"] = None, **kwargs ): """ @@ -2626,15 +2625,15 @@ def __init__( :keyword os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS - `_. Possible values - include: "Managed", "Ephemeral". + `_. Known values are: + "Managed", "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2021_09_01.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Possible values include: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_09_01.models.KubeletDiskType - :keyword workload_runtime: Determines the type of workload a node can run. Possible values - include: "OCIContainer", "WasmWasi". + :keyword workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer", "WasmWasi". :paramtype workload_runtime: str or ~azure.mgmt.containerservice.v2021_09_01.models.WorkloadRuntime :keyword vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and @@ -2648,11 +2647,11 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2021_09_01.models.OSType :keyword os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Possible values include: "Ubuntu", "CBLMariner". + Known values are: "Ubuntu", "CBLMariner". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2021_09_01.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -2661,16 +2660,15 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, - it defaults to Delete. Possible values include: "Delete", "Deallocate". + it defaults to Delete. Known values are: "Delete", "Deallocate". :paramtype scale_down_mode: str or ~azure.mgmt.containerservice.v2021_09_01.models.ScaleDownMode - :keyword type: The type of Agent Pool. Possible values include: "VirtualMachineScaleSets", + :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2021_09_01.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Possible values include: "System", - "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2021_09_01.models.AgentPoolMode :keyword orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -2701,12 +2699,12 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Possible values include: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_09_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Possible values include: "Delete", - "Deallocate". Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_09_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which @@ -2738,7 +2736,7 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2021_09_01.models.GPUInstanceProfile @@ -2810,15 +2808,15 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS - `_. Possible values - include: "Managed", "Ephemeral". + `_. Known values are: + "Managed", "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2021_09_01.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Possible values include: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_09_01.models.KubeletDiskType - :ivar workload_runtime: Determines the type of workload a node can run. Possible values - include: "OCIContainer", "WasmWasi". + :ivar workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer", "WasmWasi". :vartype workload_runtime: str or ~azure.mgmt.containerservice.v2021_09_01.models.WorkloadRuntime :ivar vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and used. @@ -2832,11 +2830,11 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2021_09_01.models.OSType - :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Possible values include: "Ubuntu", "CBLMariner". + :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known + values are: "Ubuntu", "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2021_09_01.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. :vartype max_count: int @@ -2845,15 +2843,14 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it - defaults to Delete. Possible values include: "Delete", "Deallocate". + defaults to Delete. Known values are: "Delete", "Deallocate". :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2021_09_01.models.ScaleDownMode - :ivar type: The type of Agent Pool. Possible values include: "VirtualMachineScaleSets", + :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2021_09_01.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Possible values include: "System", - "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". :vartype mode: str or ~azure.mgmt.containerservice.v2021_09_01.models.AgentPoolMode :ivar orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -2888,12 +2885,12 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Possible values include: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_09_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Possible values include: "Delete", - "Deallocate". Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_09_01.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which @@ -2925,7 +2922,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2021_09_01.models.GPUInstanceProfile :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool @@ -2992,40 +2989,40 @@ def __init__( count: Optional[int] = None, vm_size: Optional[str] = None, os_disk_size_gb: Optional[int] = None, - os_disk_type: Optional[Union[str, "OSDiskType"]] = None, - kubelet_disk_type: Optional[Union[str, "KubeletDiskType"]] = None, - workload_runtime: Optional[Union[str, "WorkloadRuntime"]] = None, + os_disk_type: Optional[Union[str, "_models.OSDiskType"]] = None, + kubelet_disk_type: Optional[Union[str, "_models.KubeletDiskType"]] = None, + workload_runtime: Optional[Union[str, "_models.WorkloadRuntime"]] = None, vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", - os_sku: Optional[Union[str, "OSSKU"]] = None, + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - scale_down_mode: Optional[Union[str, "ScaleDownMode"]] = None, - type: Optional[Union[str, "AgentPoolType"]] = None, - mode: Optional[Union[str, "AgentPoolMode"]] = None, + scale_down_mode: Optional[Union[str, "_models.ScaleDownMode"]] = None, + type: Optional[Union[str, "_models.AgentPoolType"]] = None, + mode: Optional[Union[str, "_models.AgentPoolMode"]] = None, orchestrator_version: Optional[str] = None, - upgrade_settings: Optional["AgentPoolUpgradeSettings"] = None, - power_state: Optional["PowerState"] = None, + upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, + power_state: Optional["_models.PowerState"] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", spot_max_price: Optional[float] = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, proximity_placement_group_id: Optional[str] = None, - kubelet_config: Optional["KubeletConfig"] = None, - linux_os_config: Optional["LinuxOSConfig"] = None, + kubelet_config: Optional["_models.KubeletConfig"] = None, + linux_os_config: Optional["_models.LinuxOSConfig"] = None, enable_encryption_at_host: Optional[bool] = None, enable_ultra_ssd: Optional[bool] = None, enable_fips: Optional[bool] = None, - gpu_instance_profile: Optional[Union[str, "GPUInstanceProfile"]] = None, - creation_data: Optional["CreationData"] = None, + gpu_instance_profile: Optional[Union[str, "_models.GPUInstanceProfile"]] = None, + creation_data: Optional["_models.CreationData"] = None, **kwargs ): """ @@ -3044,15 +3041,15 @@ def __init__( :keyword os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS - `_. Possible values - include: "Managed", "Ephemeral". + `_. Known values are: + "Managed", "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2021_09_01.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Possible values include: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_09_01.models.KubeletDiskType - :keyword workload_runtime: Determines the type of workload a node can run. Possible values - include: "OCIContainer", "WasmWasi". + :keyword workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer", "WasmWasi". :paramtype workload_runtime: str or ~azure.mgmt.containerservice.v2021_09_01.models.WorkloadRuntime :keyword vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and @@ -3066,11 +3063,11 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2021_09_01.models.OSType :keyword os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Possible values include: "Ubuntu", "CBLMariner". + Known values are: "Ubuntu", "CBLMariner". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2021_09_01.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -3079,16 +3076,15 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, - it defaults to Delete. Possible values include: "Delete", "Deallocate". + it defaults to Delete. Known values are: "Delete", "Deallocate". :paramtype scale_down_mode: str or ~azure.mgmt.containerservice.v2021_09_01.models.ScaleDownMode - :keyword type: The type of Agent Pool. Possible values include: "VirtualMachineScaleSets", + :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2021_09_01.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Possible values include: "System", - "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2021_09_01.models.AgentPoolMode :keyword orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -3119,12 +3115,12 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Possible values include: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_09_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Possible values include: "Delete", - "Deallocate". Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_09_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which @@ -3156,7 +3152,7 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2021_09_01.models.GPUInstanceProfile @@ -3241,8 +3237,8 @@ class ManagedClusterAutoUpgradeProfile(msrest.serialization.Model): """Auto upgrade profile for a managed cluster. :ivar upgrade_channel: For more information see `setting the AKS cluster auto-upgrade channel - `_. Possible - values include: "rapid", "stable", "patch", "node-image", "none". + `_. Known values + are: "rapid", "stable", "patch", "node-image", "none". :vartype upgrade_channel: str or ~azure.mgmt.containerservice.v2021_09_01.models.UpgradeChannel """ @@ -3253,13 +3249,13 @@ class ManagedClusterAutoUpgradeProfile(msrest.serialization.Model): def __init__( self, *, - upgrade_channel: Optional[Union[str, "UpgradeChannel"]] = None, + upgrade_channel: Optional[Union[str, "_models.UpgradeChannel"]] = None, **kwargs ): """ :keyword upgrade_channel: For more information see `setting the AKS cluster auto-upgrade channel `_. - Possible values include: "rapid", "stable", "patch", "node-image", "none". + Known values are: "rapid", "stable", "patch", "node-image", "none". :paramtype upgrade_channel: str or ~azure.mgmt.containerservice.v2021_09_01.models.UpgradeChannel """ @@ -3325,7 +3321,7 @@ class ManagedClusterIdentity(msrest.serialization.Model): components. :vartype tenant_id: str :ivar type: For more information see `use managed identities in AKS - `_. Possible values include: + `_. Known values are: "SystemAssigned", "UserAssigned", "None". :vartype type: str or ~azure.mgmt.containerservice.v2021_09_01.models.ResourceIdentityType :ivar user_assigned_identities: The keys must be ARM resource IDs in the form: @@ -3349,13 +3345,13 @@ class ManagedClusterIdentity(msrest.serialization.Model): def __init__( self, *, - type: Optional[Union[str, "ResourceIdentityType"]] = None, - user_assigned_identities: Optional[Dict[str, "ManagedServiceIdentityUserAssignedIdentitiesValue"]] = None, + type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, + user_assigned_identities: Optional[Dict[str, "_models.ManagedServiceIdentityUserAssignedIdentitiesValue"]] = None, **kwargs ): """ :keyword type: For more information see `use managed identities in AKS - `_. Possible values include: + `_. Known values are: "SystemAssigned", "UserAssigned", "None". :paramtype type: str or ~azure.mgmt.containerservice.v2021_09_01.models.ResourceIdentityType :keyword user_assigned_identities: The keys must be ARM resource IDs in the form: @@ -3393,7 +3389,7 @@ class ManagedClusterListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["ManagedCluster"]] = None, + value: Optional[List["_models.ManagedCluster"]] = None, **kwargs ): """ @@ -3451,10 +3447,10 @@ class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): def __init__( self, *, - managed_outbound_i_ps: Optional["ManagedClusterLoadBalancerProfileManagedOutboundIPs"] = None, - outbound_ip_prefixes: Optional["ManagedClusterLoadBalancerProfileOutboundIPPrefixes"] = None, - outbound_i_ps: Optional["ManagedClusterLoadBalancerProfileOutboundIPs"] = None, - effective_outbound_i_ps: Optional[List["ResourceReference"]] = None, + managed_outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileManagedOutboundIPs"] = None, + outbound_ip_prefixes: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPPrefixes"] = None, + outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPs"] = None, + effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, allocated_outbound_ports: Optional[int] = 0, idle_timeout_in_minutes: Optional[int] = 30, enable_multiple_standard_load_balancers: Optional[bool] = None, @@ -3543,7 +3539,7 @@ class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.M def __init__( self, *, - public_ip_prefixes: Optional[List["ResourceReference"]] = None, + public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, **kwargs ): """ @@ -3569,7 +3565,7 @@ class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): def __init__( self, *, - public_i_ps: Optional[List["ResourceReference"]] = None, + public_i_ps: Optional[List["_models.ResourceReference"]] = None, **kwargs ): """ @@ -3639,8 +3635,8 @@ class ManagedClusterNATGatewayProfile(msrest.serialization.Model): def __init__( self, *, - managed_outbound_ip_profile: Optional["ManagedClusterManagedOutboundIPProfile"] = None, - effective_outbound_i_ps: Optional[List["ResourceReference"]] = None, + managed_outbound_ip_profile: Optional["_models.ManagedClusterManagedOutboundIPProfile"] = None, + effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, idle_timeout_in_minutes: Optional[int] = 4, **kwargs ): @@ -3678,8 +3674,8 @@ class ManagedClusterPodIdentity(msrest.serialization.Model): :vartype binding_selector: str :ivar identity: Required. The user assigned identity details. :vartype identity: ~azure.mgmt.containerservice.v2021_09_01.models.UserAssignedIdentity - :ivar provisioning_state: The current provisioning state of the pod identity. Possible values - include: "Assigned", "Updating", "Deleting", "Failed". + :ivar provisioning_state: The current provisioning state of the pod identity. Known values are: + "Assigned", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2021_09_01.models.ManagedClusterPodIdentityProvisioningState :ivar provisioning_info: @@ -3709,7 +3705,7 @@ def __init__( *, name: str, namespace: str, - identity: "UserAssignedIdentity", + identity: "_models.UserAssignedIdentity", binding_selector: Optional[str] = None, **kwargs ): @@ -3810,8 +3806,8 @@ def __init__( *, enabled: Optional[bool] = None, allow_network_plugin_kubenet: Optional[bool] = None, - user_assigned_identities: Optional[List["ManagedClusterPodIdentity"]] = None, - user_assigned_identity_exceptions: Optional[List["ManagedClusterPodIdentityException"]] = None, + user_assigned_identities: Optional[List["_models.ManagedClusterPodIdentity"]] = None, + user_assigned_identity_exceptions: Optional[List["_models.ManagedClusterPodIdentityException"]] = None, **kwargs ): """ @@ -3852,7 +3848,7 @@ class ManagedClusterPodIdentityProvisioningError(msrest.serialization.Model): def __init__( self, *, - error: Optional["ManagedClusterPodIdentityProvisioningErrorBody"] = None, + error: Optional["_models.ManagedClusterPodIdentityProvisioningErrorBody"] = None, **kwargs ): """ @@ -3894,7 +3890,7 @@ def __init__( code: Optional[str] = None, message: Optional[str] = None, target: Optional[str] = None, - details: Optional[List["ManagedClusterPodIdentityProvisioningErrorBody"]] = None, + details: Optional[List["_models.ManagedClusterPodIdentityProvisioningErrorBody"]] = None, **kwargs ): """ @@ -3933,7 +3929,7 @@ class ManagedClusterPodIdentityProvisioningInfo(msrest.serialization.Model): def __init__( self, *, - error: Optional["ManagedClusterPodIdentityProvisioningError"] = None, + error: Optional["_models.ManagedClusterPodIdentityProvisioningError"] = None, **kwargs ): """ @@ -3954,8 +3950,8 @@ class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): :vartype kubernetes_version: str :ivar name: The Agent Pool name. :vartype name: str - :ivar os_type: Required. The operating system type. The default is Linux. Possible values - include: "Linux", "Windows". Default value: "Linux". + :ivar os_type: Required. The operating system type. The default is Linux. Known values are: + "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2021_09_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -3978,9 +3974,9 @@ def __init__( self, *, kubernetes_version: str, - os_type: Union[str, "OSType"] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", name: Optional[str] = None, - upgrades: Optional[List["ManagedClusterPoolUpgradeProfileUpgradesItem"]] = None, + upgrades: Optional[List["_models.ManagedClusterPoolUpgradeProfileUpgradesItem"]] = None, **kwargs ): """ @@ -3988,8 +3984,8 @@ def __init__( :paramtype kubernetes_version: str :keyword name: The Agent Pool name. :paramtype name: str - :keyword os_type: Required. The operating system type. The default is Linux. Possible values - include: "Linux", "Windows". Default value: "Linux". + :keyword os_type: Required. The operating system type. The default is Linux. Known values are: + "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2021_09_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: @@ -4041,8 +4037,7 @@ class ManagedClusterPropertiesAutoScalerProfile(msrest.serialization.Model): :vartype balance_similar_node_groups: str :ivar expander: If not specified, the default is 'random'. See `expanders `_ - for more information. Possible values include: "least-waste", "most-pods", "priority", - "random". + for more information. Known values are: "least-waste", "most-pods", "priority", "random". :vartype expander: str or ~azure.mgmt.containerservice.v2021_09_01.models.Expander :ivar max_empty_bulk_delete: The default is 10. :vartype max_empty_bulk_delete: str @@ -4109,7 +4104,7 @@ def __init__( self, *, balance_similar_node_groups: Optional[str] = None, - expander: Optional[Union[str, "Expander"]] = None, + expander: Optional[Union[str, "_models.Expander"]] = None, max_empty_bulk_delete: Optional[str] = None, max_graceful_termination_sec: Optional[str] = None, max_node_provision_time: Optional[str] = None, @@ -4132,8 +4127,7 @@ def __init__( :paramtype balance_similar_node_groups: str :keyword expander: If not specified, the default is 'random'. See `expanders `_ - for more information. Possible values include: "least-waste", "most-pods", "priority", - "random". + for more information. Known values are: "least-waste", "most-pods", "priority", "random". :paramtype expander: str or ~azure.mgmt.containerservice.v2021_09_01.models.Expander :keyword max_empty_bulk_delete: The default is 10. :paramtype max_empty_bulk_delete: str @@ -4211,7 +4205,7 @@ class ManagedClusterSecurityProfile(msrest.serialization.Model): def __init__( self, *, - azure_defender: Optional["ManagedClusterSecurityProfileAzureDefender"] = None, + azure_defender: Optional["_models.ManagedClusterSecurityProfileAzureDefender"] = None, **kwargs ): """ @@ -4302,11 +4296,11 @@ def __init__( class ManagedClusterSKU(msrest.serialization.Model): """The SKU of a Managed Cluster. - :ivar name: The name of a managed cluster SKU. Possible values include: "Basic". + :ivar name: The name of a managed cluster SKU. Known values are: "Basic". :vartype name: str or ~azure.mgmt.containerservice.v2021_09_01.models.ManagedClusterSKUName :ivar tier: If not specified, the default is 'Free'. See `uptime SLA - `_ for more details. Possible values include: - "Paid", "Free". + `_ for more details. Known values are: "Paid", + "Free". :vartype tier: str or ~azure.mgmt.containerservice.v2021_09_01.models.ManagedClusterSKUTier """ @@ -4318,16 +4312,16 @@ class ManagedClusterSKU(msrest.serialization.Model): def __init__( self, *, - name: Optional[Union[str, "ManagedClusterSKUName"]] = None, - tier: Optional[Union[str, "ManagedClusterSKUTier"]] = None, + name: Optional[Union[str, "_models.ManagedClusterSKUName"]] = None, + tier: Optional[Union[str, "_models.ManagedClusterSKUTier"]] = None, **kwargs ): """ - :keyword name: The name of a managed cluster SKU. Possible values include: "Basic". + :keyword name: The name of a managed cluster SKU. Known values are: "Basic". :paramtype name: str or ~azure.mgmt.containerservice.v2021_09_01.models.ManagedClusterSKUName :keyword tier: If not specified, the default is 'Free'. See `uptime SLA - `_ for more details. Possible values include: - "Paid", "Free". + `_ for more details. Known values are: "Paid", + "Free". :paramtype tier: str or ~azure.mgmt.containerservice.v2021_09_01.models.ManagedClusterSKUTier """ super(ManagedClusterSKU, self).__init__(**kwargs) @@ -4376,8 +4370,8 @@ class ManagedClusterUpgradeProfile(msrest.serialization.Model): def __init__( self, *, - control_plane_profile: "ManagedClusterPoolUpgradeProfile", - agent_pool_profiles: List["ManagedClusterPoolUpgradeProfile"], + control_plane_profile: "_models.ManagedClusterPoolUpgradeProfile", + agent_pool_profiles: List["_models.ManagedClusterPoolUpgradeProfile"], **kwargs ): """ @@ -4419,8 +4413,8 @@ class ManagedClusterWindowsProfile(msrest.serialization.Model): "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!". :vartype admin_password: str :ivar license_type: The license type to use for Windows VMs. See `Azure Hybrid User Benefits - `_ for more details. Possible values - include: "None", "Windows_Server". + `_ for more details. Known values are: + "None", "Windows_Server". :vartype license_type: str or ~azure.mgmt.containerservice.v2021_09_01.models.LicenseType :ivar enable_csi_proxy: For more details on CSI proxy, see the `CSI proxy GitHub repo `_. @@ -4446,9 +4440,9 @@ def __init__( *, admin_username: str, admin_password: Optional[str] = None, - license_type: Optional[Union[str, "LicenseType"]] = None, + license_type: Optional[Union[str, "_models.LicenseType"]] = None, enable_csi_proxy: Optional[bool] = None, - gmsa_profile: Optional["WindowsGmsaProfile"] = None, + gmsa_profile: Optional["_models.WindowsGmsaProfile"] = None, **kwargs ): """ @@ -4469,8 +4463,8 @@ def __init__( "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!". :paramtype admin_password: str :keyword license_type: The license type to use for Windows VMs. See `Azure Hybrid User Benefits - `_ for more details. Possible values - include: "None", "Windows_Server". + `_ for more details. Known values are: + "None", "Windows_Server". :paramtype license_type: str or ~azure.mgmt.containerservice.v2021_09_01.models.LicenseType :keyword enable_csi_proxy: For more details on CSI proxy, see the `CSI proxy GitHub repo `_. @@ -4632,7 +4626,7 @@ class OSOptionProfile(msrest.serialization.Model): def __init__( self, *, - os_option_property_list: List["OSOptionProperty"], + os_option_property_list: List["_models.OSOptionProperty"], **kwargs ): """ @@ -4705,7 +4699,7 @@ def __init__( self, *, category: Optional[str] = None, - endpoints: Optional[List["EndpointDependency"]] = None, + endpoints: Optional[List["_models.EndpointDependency"]] = None, **kwargs ): """ @@ -4747,7 +4741,7 @@ class OutboundEnvironmentEndpointCollection(msrest.serialization.Model): def __init__( self, *, - value: List["OutboundEnvironmentEndpoint"], + value: List["_models.OutboundEnvironmentEndpoint"], **kwargs ): """ @@ -4763,8 +4757,8 @@ def __init__( class PowerState(msrest.serialization.Model): """Describes the Power State of the cluster. - :ivar code: Tells whether the cluster is Running or Stopped. Possible values include: - "Running", "Stopped". + :ivar code: Tells whether the cluster is Running or Stopped. Known values are: "Running", + "Stopped". :vartype code: str or ~azure.mgmt.containerservice.v2021_09_01.models.Code """ @@ -4775,12 +4769,12 @@ class PowerState(msrest.serialization.Model): def __init__( self, *, - code: Optional[Union[str, "Code"]] = None, + code: Optional[Union[str, "_models.Code"]] = None, **kwargs ): """ - :keyword code: Tells whether the cluster is Running or Stopped. Possible values include: - "Running", "Stopped". + :keyword code: Tells whether the cluster is Running or Stopped. Known values are: "Running", + "Stopped". :paramtype code: str or ~azure.mgmt.containerservice.v2021_09_01.models.Code """ super(PowerState, self).__init__(**kwargs) @@ -4823,7 +4817,7 @@ class PrivateEndpointConnection(msrest.serialization.Model): :vartype name: str :ivar type: The resource type. :vartype type: str - :ivar provisioning_state: The current provisioning state. Possible values include: "Succeeded", + :ivar provisioning_state: The current provisioning state. Known values are: "Succeeded", "Creating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2021_09_01.models.PrivateEndpointConnectionProvisioningState @@ -4854,8 +4848,8 @@ class PrivateEndpointConnection(msrest.serialization.Model): def __init__( self, *, - private_endpoint: Optional["PrivateEndpoint"] = None, - private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, + private_endpoint: Optional["_models.PrivateEndpoint"] = None, + private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionState"] = None, **kwargs ): """ @@ -4889,7 +4883,7 @@ class PrivateEndpointConnectionListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["PrivateEndpointConnection"]] = None, + value: Optional[List["_models.PrivateEndpointConnection"]] = None, **kwargs ): """ @@ -4979,7 +4973,7 @@ class PrivateLinkResourcesListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["PrivateLinkResource"]] = None, + value: Optional[List["_models.PrivateLinkResource"]] = None, **kwargs ): """ @@ -4993,7 +4987,7 @@ def __init__( class PrivateLinkServiceConnectionState(msrest.serialization.Model): """The state of a private link service connection. - :ivar status: The private link service connection status. Possible values include: "Pending", + :ivar status: The private link service connection status. Known values are: "Pending", "Approved", "Rejected", "Disconnected". :vartype status: str or ~azure.mgmt.containerservice.v2021_09_01.models.ConnectionStatus :ivar description: The private link service connection description. @@ -5008,13 +5002,13 @@ class PrivateLinkServiceConnectionState(msrest.serialization.Model): def __init__( self, *, - status: Optional[Union[str, "ConnectionStatus"]] = None, + status: Optional[Union[str, "_models.ConnectionStatus"]] = None, description: Optional[str] = None, **kwargs ): """ - :keyword status: The private link service connection status. Possible values include: - "Pending", "Approved", "Rejected", "Disconnected". + :keyword status: The private link service connection status. Known values are: "Pending", + "Approved", "Rejected", "Disconnected". :paramtype status: str or ~azure.mgmt.containerservice.v2021_09_01.models.ConnectionStatus :keyword description: The private link service connection description. :paramtype description: str @@ -5173,18 +5167,18 @@ class Snapshot(Resource): :ivar creation_data: CreationData to be used to specify the source agent pool resource ID to create this snapshot. :vartype creation_data: ~azure.mgmt.containerservice.v2021_09_01.models.CreationData - :ivar snapshot_type: The type of a snapshot. The default is NodePool. Possible values include: + :ivar snapshot_type: The type of a snapshot. The default is NodePool. Known values are: "NodePool". Default value: "NodePool". :vartype snapshot_type: str or ~azure.mgmt.containerservice.v2021_09_01.models.SnapshotType :ivar kubernetes_version: The version of Kubernetes. :vartype kubernetes_version: str :ivar node_image_version: The version of node image. :vartype node_image_version: str - :ivar os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2021_09_01.models.OSType - :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Possible values include: "Ubuntu", "CBLMariner". + :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known + values are: "Ubuntu", "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2021_09_01.models.OSSKU :ivar vm_size: The size of the VM. :vartype vm_size: str @@ -5228,8 +5222,8 @@ def __init__( *, location: str, tags: Optional[Dict[str, str]] = None, - creation_data: Optional["CreationData"] = None, - snapshot_type: Optional[Union[str, "SnapshotType"]] = "NodePool", + creation_data: Optional["_models.CreationData"] = None, + snapshot_type: Optional[Union[str, "_models.SnapshotType"]] = "NodePool", **kwargs ): """ @@ -5240,8 +5234,8 @@ def __init__( :keyword creation_data: CreationData to be used to specify the source agent pool resource ID to create this snapshot. :paramtype creation_data: ~azure.mgmt.containerservice.v2021_09_01.models.CreationData - :keyword snapshot_type: The type of a snapshot. The default is NodePool. Possible values - include: "NodePool". Default value: "NodePool". + :keyword snapshot_type: The type of a snapshot. The default is NodePool. Known values are: + "NodePool". Default value: "NodePool". :paramtype snapshot_type: str or ~azure.mgmt.containerservice.v2021_09_01.models.SnapshotType """ super(Snapshot, self).__init__(location=location, tags=tags, **kwargs) @@ -5279,7 +5273,7 @@ class SnapshotListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["Snapshot"]] = None, + value: Optional[List["_models.Snapshot"]] = None, **kwargs ): """ @@ -5510,15 +5504,15 @@ class SystemData(msrest.serialization.Model): :ivar created_by: The identity that created the resource. :vartype created_by: str - :ivar created_by_type: The type of identity that created the resource. Possible values include: + :ivar created_by_type: The type of identity that created the resource. Known values are: "User", "Application", "ManagedIdentity", "Key". :vartype created_by_type: str or ~azure.mgmt.containerservice.v2021_09_01.models.CreatedByType :ivar created_at: The UTC timestamp of resource creation. :vartype created_at: ~datetime.datetime :ivar last_modified_by: The identity that last modified the resource. :vartype last_modified_by: str - :ivar last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". + :ivar last_modified_by_type: The type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", "Key". :vartype last_modified_by_type: str or ~azure.mgmt.containerservice.v2021_09_01.models.CreatedByType :ivar last_modified_at: The type of identity that last modified the resource. @@ -5538,26 +5532,26 @@ def __init__( self, *, created_by: Optional[str] = None, - created_by_type: Optional[Union[str, "CreatedByType"]] = None, + created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, created_at: Optional[datetime.datetime] = None, last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[Union[str, "CreatedByType"]] = None, + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, last_modified_at: Optional[datetime.datetime] = None, **kwargs ): """ :keyword created_by: The identity that created the resource. :paramtype created_by: str - :keyword created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". + :keyword created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", "Key". :paramtype created_by_type: str or ~azure.mgmt.containerservice.v2021_09_01.models.CreatedByType :keyword created_at: The UTC timestamp of resource creation. :paramtype created_at: ~datetime.datetime :keyword last_modified_by: The identity that last modified the resource. :paramtype last_modified_by: str - :keyword last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". + :keyword last_modified_by_type: The type of identity that last modified the resource. Known + values are: "User", "Application", "ManagedIdentity", "Key". :paramtype last_modified_by_type: str or ~azure.mgmt.containerservice.v2021_09_01.models.CreatedByType :keyword last_modified_at: The type of identity that last modified the resource. @@ -5600,8 +5594,8 @@ def __init__( class TimeInWeek(msrest.serialization.Model): """Time in a week. - :ivar day: The day of the week. Possible values include: "Sunday", "Monday", "Tuesday", - "Wednesday", "Thursday", "Friday", "Saturday". + :ivar day: The day of the week. Known values are: "Sunday", "Monday", "Tuesday", "Wednesday", + "Thursday", "Friday", "Saturday". :vartype day: str or ~azure.mgmt.containerservice.v2021_09_01.models.WeekDay :ivar hour_slots: Each integer hour represents a time range beginning at 0m after the hour ending at the next hour (non-inclusive). 0 corresponds to 00:00 UTC, 23 corresponds to 23:00 @@ -5617,12 +5611,12 @@ class TimeInWeek(msrest.serialization.Model): def __init__( self, *, - day: Optional[Union[str, "WeekDay"]] = None, + day: Optional[Union[str, "_models.WeekDay"]] = None, hour_slots: Optional[List[int]] = None, **kwargs ): """ - :keyword day: The day of the week. Possible values include: "Sunday", "Monday", "Tuesday", + :keyword day: The day of the week. Known values are: "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday". :paramtype day: str or ~azure.mgmt.containerservice.v2021_09_01.models.WeekDay :keyword hour_slots: Each integer hour represents a time range beginning at 0m after the hour diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/models/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/models/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/operations/__init__.py index 5e1e5e72fa59..e0748876288c 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/operations/__init__.py @@ -15,6 +15,9 @@ from ._resolve_private_link_service_id_operations import ResolvePrivateLinkServiceIdOperations from ._snapshots_operations import SnapshotsOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'Operations', 'ManagedClustersOperations', @@ -25,3 +28,5 @@ 'ResolvePrivateLinkServiceIdOperations', 'SnapshotsOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/operations/_agent_pools_operations.py index e0996cddbe62..8560b3444a52 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/operations/_agent_pools_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -35,9 +35,12 @@ def build_list_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools") # pylint: disable=line-too-long path_format_arguments = { @@ -49,18 +52,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -72,9 +73,12 @@ def build_get_request( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -87,18 +91,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -109,14 +111,17 @@ def build_create_or_update_request_initial( resource_name: str, agent_pool_name: str, *, - json: JSONType = None, + json: Optional[_models.AgentPool] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -129,20 +134,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -156,9 +159,12 @@ def build_delete_request_initial( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -171,18 +177,16 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -194,9 +198,12 @@ def build_get_upgrade_profile_request( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default") # pylint: disable=line-too-long path_format_arguments = { @@ -209,18 +216,16 @@ def build_get_upgrade_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -231,9 +236,12 @@ def build_get_available_agent_pool_versions_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions") # pylint: disable=line-too-long path_format_arguments = { @@ -245,18 +253,16 @@ def build_get_available_agent_pool_versions_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -268,9 +274,12 @@ def build_upgrade_node_image_version_request_initial( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion") # pylint: disable=line-too-long path_format_arguments = { @@ -283,42 +292,38 @@ def build_upgrade_node_image_version_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class AgentPoolsOperations(object): - """AgentPoolsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class AgentPoolsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_09_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_09_01.ContainerServiceClient`'s + :attr:`agent_pools` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -326,7 +331,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Iterable["_models.AgentPoolListResult"]: + ) -> Iterable[_models.AgentPoolListResult]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. @@ -341,13 +346,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_09_01.models.AgentPoolListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -357,9 +365,11 @@ def prepare_request(next_link=None): resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -369,9 +379,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -411,7 +423,7 @@ def get( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPool": + ) -> _models.AgentPool: """Gets the specified managed cluster agent pool. Gets the specified managed cluster agent pool. @@ -427,13 +439,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.AgentPool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] request = build_get_request( @@ -443,11 +458,13 @@ def get( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -473,17 +490,20 @@ def _create_or_update_initial( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> "_models.AgentPool": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] + ) -> _models.AgentPool: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-09-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] _json = self._serialize.body(parameters, 'AgentPool') @@ -496,11 +516,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -531,9 +553,9 @@ def begin_create_or_update( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> LROPoller["_models.AgentPool"]: + ) -> LROPoller[_models.AgentPool]: """Creates or updates an agent pool in the specified managed cluster. Creates or updates an agent pool in the specified managed cluster. @@ -559,17 +581,20 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_09_01.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, @@ -577,20 +602,27 @@ def begin_create_or_update( 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): - response = pipeline_response.http_response deserialized = self._deserialize('AgentPool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -610,13 +642,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements agent_pool_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -626,11 +661,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -677,21 +714,26 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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) @@ -701,8 +743,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -722,7 +770,7 @@ def get_upgrade_profile( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPoolUpgradeProfile": + ) -> _models.AgentPoolUpgradeProfile: """Gets the upgrade profile for an agent pool. Gets the upgrade profile for an agent pool. @@ -738,13 +786,16 @@ def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.AgentPoolUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] request = build_get_upgrade_profile_request( @@ -754,11 +805,13 @@ def get_upgrade_profile( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -785,7 +838,7 @@ def get_available_agent_pool_versions( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.AgentPoolAvailableVersions": + ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported Kubernetes versions for the specified agent pool. See `supported Kubernetes versions @@ -801,13 +854,16 @@ def get_available_agent_pool_versions( :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.AgentPoolAvailableVersions :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolAvailableVersions"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] request = build_get_available_agent_pool_versions_request( @@ -816,11 +872,13 @@ def get_available_agent_pool_versions( resource_name=resource_name, api_version=api_version, template_url=self.get_available_agent_pool_versions.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -847,14 +905,17 @@ def _upgrade_node_image_version_initial( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> Optional["_models.AgentPool"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.AgentPool"]] + ) -> Optional[_models.AgentPool]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] request = build_upgrade_node_image_version_request_initial( @@ -864,11 +925,13 @@ def _upgrade_node_image_version_initial( agent_pool_name=agent_pool_name, api_version=api_version, template_url=self._upgrade_node_image_version_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -898,7 +961,7 @@ def begin_upgrade_node_image_version( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> LROPoller["_models.AgentPool"]: + ) -> LROPoller[_models.AgentPool]: """Upgrades the node image version of an agent pool to the latest. Upgrading the node image version of an agent pool applies the newest OS and runtime updates to @@ -924,35 +987,45 @@ def begin_upgrade_node_image_version( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_09_01.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._upgrade_node_image_version_initial( + raw_result = self._upgrade_node_image_version_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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): - response = pipeline_response.http_response deserialized = self._deserialize('AgentPool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/operations/_maintenance_configurations_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/operations/_maintenance_configurations_operations.py index 963a5f22c36f..b5260990fe12 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/operations/_maintenance_configurations_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/operations/_maintenance_configurations_operations.py @@ -16,12 +16,12 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -33,9 +33,12 @@ def build_list_by_managed_cluster_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations") # pylint: disable=line-too-long path_format_arguments = { @@ -47,18 +50,16 @@ def build_list_by_managed_cluster_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -70,9 +71,12 @@ def build_get_request( config_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long path_format_arguments = { @@ -85,18 +89,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -107,14 +109,17 @@ def build_create_or_update_request( resource_name: str, config_name: str, *, - json: JSONType = None, + json: Optional[_models.MaintenanceConfiguration] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long path_format_arguments = { @@ -127,20 +132,18 @@ def build_create_or_update_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -154,9 +157,12 @@ def build_delete_request( config_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long path_format_arguments = { @@ -169,42 +175,38 @@ def build_delete_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class MaintenanceConfigurationsOperations(object): - """MaintenanceConfigurationsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class MaintenanceConfigurationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_09_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_09_01.ContainerServiceClient`'s + :attr:`maintenance_configurations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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_by_managed_cluster( @@ -212,7 +214,7 @@ def list_by_managed_cluster( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Iterable["_models.MaintenanceConfigurationListResult"]: + ) -> Iterable[_models.MaintenanceConfigurationListResult]: """Gets a list of maintenance configurations in the specified managed cluster. Gets a list of maintenance configurations in the specified managed cluster. @@ -228,13 +230,16 @@ def list_by_managed_cluster( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_09_01.models.MaintenanceConfigurationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfigurationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfigurationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -244,9 +249,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=self.list_by_managed_cluster.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -256,9 +263,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -298,7 +307,7 @@ def get( resource_name: str, config_name: str, **kwargs: Any - ) -> "_models.MaintenanceConfiguration": + ) -> _models.MaintenanceConfiguration: """Gets the specified maintenance configuration of a managed cluster. Gets the specified maintenance configuration of a managed cluster. @@ -314,13 +323,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.MaintenanceConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfiguration"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] request = build_get_request( @@ -330,11 +342,13 @@ def get( config_name=config_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -361,9 +375,9 @@ def create_or_update( resource_group_name: str, resource_name: str, config_name: str, - parameters: "_models.MaintenanceConfiguration", + parameters: _models.MaintenanceConfiguration, **kwargs: Any - ) -> "_models.MaintenanceConfiguration": + ) -> _models.MaintenanceConfiguration: """Creates or updates a maintenance configuration in the specified managed cluster. Creates or updates a maintenance configuration in the specified managed cluster. @@ -381,14 +395,17 @@ def create_or_update( :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.MaintenanceConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfiguration"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-09-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] _json = self._serialize.body(parameters, 'MaintenanceConfiguration') @@ -401,11 +418,13 @@ def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -449,13 +468,16 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -465,11 +487,13 @@ def delete( # pylint: disable=inconsistent-return-statements config_name=config_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/operations/_managed_clusters_operations.py index 9098c3490150..55a1ad3df217 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/operations/_managed_clusters_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -36,9 +36,12 @@ def build_get_os_options_request( resource_type: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default") # pylint: disable=line-too-long path_format_arguments = { @@ -49,20 +52,18 @@ def build_get_os_options_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if resource_type is not None: - _query_parameters['resource-type'] = _SERIALIZER.query("resource_type", resource_type, 'str') + _params['resource-type'] = _SERIALIZER.query("resource_type", resource_type, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -71,9 +72,12 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters") path_format_arguments = { @@ -83,18 +87,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -104,9 +106,12 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters") # pylint: disable=line-too-long path_format_arguments = { @@ -117,18 +122,16 @@ def build_list_by_resource_group_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -139,9 +142,12 @@ def build_get_upgrade_profile_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default") # pylint: disable=line-too-long path_format_arguments = { @@ -153,18 +159,16 @@ def build_get_upgrade_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -176,9 +180,12 @@ def build_get_access_profile_request( role_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -191,18 +198,16 @@ def build_get_access_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -215,9 +220,12 @@ def build_list_cluster_admin_credentials_request( server_fqdn: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -229,20 +237,18 @@ def build_list_cluster_admin_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if server_fqdn is not None: - _query_parameters['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -255,9 +261,12 @@ def build_list_cluster_user_credentials_request( server_fqdn: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -269,20 +278,18 @@ def build_list_cluster_user_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if server_fqdn is not None: - _query_parameters['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -295,9 +302,12 @@ def build_list_cluster_monitoring_user_credentials_request( server_fqdn: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -309,20 +319,18 @@ def build_list_cluster_monitoring_user_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if server_fqdn is not None: - _query_parameters['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -333,9 +341,12 @@ def build_get_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -347,18 +358,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -368,14 +377,17 @@ def build_create_or_update_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedCluster] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -387,20 +399,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -412,14 +422,17 @@ def build_update_tags_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.TagsObject] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -431,20 +444,18 @@ def build_update_tags_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -457,9 +468,12 @@ def build_delete_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -471,18 +485,16 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -492,14 +504,17 @@ def build_reset_service_principal_profile_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedClusterServicePrincipalProfile] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile") # pylint: disable=line-too-long path_format_arguments = { @@ -511,20 +526,18 @@ def build_reset_service_principal_profile_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -536,14 +549,17 @@ def build_reset_aad_profile_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedClusterAADProfile] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile") # pylint: disable=line-too-long path_format_arguments = { @@ -555,20 +571,18 @@ def build_reset_aad_profile_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -581,9 +595,12 @@ def build_rotate_cluster_certificates_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates") # pylint: disable=line-too-long path_format_arguments = { @@ -595,18 +612,16 @@ def build_rotate_cluster_certificates_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -617,9 +632,12 @@ def build_stop_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop") # pylint: disable=line-too-long path_format_arguments = { @@ -631,18 +649,16 @@ def build_stop_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -653,9 +669,12 @@ def build_start_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start") # pylint: disable=line-too-long path_format_arguments = { @@ -667,18 +686,16 @@ def build_start_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -688,14 +705,17 @@ def build_run_command_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.RunCommandRequest] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand") # pylint: disable=line-too-long path_format_arguments = { @@ -707,20 +727,18 @@ def build_run_command_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -734,9 +752,12 @@ def build_get_command_result_request( command_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}") # pylint: disable=line-too-long path_format_arguments = { @@ -749,18 +770,16 @@ def build_get_command_result_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -771,9 +790,12 @@ def build_list_outbound_network_dependencies_endpoints_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints") # pylint: disable=line-too-long path_format_arguments = { @@ -785,42 +807,38 @@ def build_list_outbound_network_dependencies_endpoints_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class ManagedClustersOperations(object): # pylint: disable=too-many-public-methods - """ManagedClustersOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ManagedClustersOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_09_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_09_01.ContainerServiceClient`'s + :attr:`managed_clusters` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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_os_options( @@ -828,7 +846,7 @@ def get_os_options( location: str, resource_type: Optional[str] = None, **kwargs: Any - ) -> "_models.OSOptionProfile": + ) -> _models.OSOptionProfile: """Gets supported OS options in the specified subscription. Gets supported OS options in the specified subscription. @@ -843,13 +861,16 @@ def get_os_options( :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.OSOptionProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OSOptionProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OSOptionProfile] request = build_get_os_options_request( @@ -858,11 +879,13 @@ def get_os_options( api_version=api_version, resource_type=resource_type, template_url=self.get_os_options.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -887,7 +910,7 @@ def get_os_options( def list( self, **kwargs: Any - ) -> Iterable["_models.ManagedClusterListResult"]: + ) -> Iterable[_models.ManagedClusterListResult]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. @@ -899,13 +922,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_09_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -913,9 +939,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -923,9 +951,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -963,7 +993,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.ManagedClusterListResult"]: + ) -> Iterable[_models.ManagedClusterListResult]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. @@ -977,13 +1007,16 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_09_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -992,9 +1025,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -1003,9 +1038,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -1044,7 +1081,7 @@ def get_upgrade_profile( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedClusterUpgradeProfile": + ) -> _models.ManagedClusterUpgradeProfile: """Gets the upgrade profile of a managed cluster. Gets the upgrade profile of a managed cluster. @@ -1058,13 +1095,16 @@ def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.ManagedClusterUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] request = build_get_upgrade_profile_request( @@ -1073,11 +1113,13 @@ def get_upgrade_profile( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1105,7 +1147,7 @@ def get_access_profile( resource_name: str, role_name: str, **kwargs: Any - ) -> "_models.ManagedClusterAccessProfile": + ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. **WARNING**\ : This API will be deprecated. Instead use `ListClusterUserCredentials @@ -1124,13 +1166,16 @@ def get_access_profile( :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.ManagedClusterAccessProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterAccessProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] request = build_get_access_profile_request( @@ -1140,11 +1185,13 @@ def get_access_profile( role_name=role_name, api_version=api_version, template_url=self.get_access_profile.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1172,7 +1219,7 @@ def list_cluster_admin_credentials( resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Lists the admin credentials of a managed cluster. Lists the admin credentials of a managed cluster. @@ -1188,13 +1235,16 @@ def list_cluster_admin_credentials( :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_admin_credentials_request( @@ -1204,11 +1254,13 @@ def list_cluster_admin_credentials( api_version=api_version, server_fqdn=server_fqdn, template_url=self.list_cluster_admin_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1236,7 +1288,7 @@ def list_cluster_user_credentials( resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Lists the user credentials of a managed cluster. Lists the user credentials of a managed cluster. @@ -1252,13 +1304,16 @@ def list_cluster_user_credentials( :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_user_credentials_request( @@ -1268,11 +1323,13 @@ def list_cluster_user_credentials( api_version=api_version, server_fqdn=server_fqdn, template_url=self.list_cluster_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1300,7 +1357,7 @@ def list_cluster_monitoring_user_credentials( resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Lists the cluster monitoring user credentials of a managed cluster. Lists the cluster monitoring user credentials of a managed cluster. @@ -1316,13 +1373,16 @@ def list_cluster_monitoring_user_credentials( :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_monitoring_user_credentials_request( @@ -1332,11 +1392,13 @@ def list_cluster_monitoring_user_credentials( api_version=api_version, server_fqdn=server_fqdn, template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1363,7 +1425,7 @@ def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedCluster": + ) -> _models.ManagedCluster: """Gets a managed cluster. Gets a managed cluster. @@ -1377,13 +1439,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.ManagedCluster :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] request = build_get_request( @@ -1392,11 +1457,13 @@ def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1421,17 +1488,20 @@ def _create_or_update_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-09-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'ManagedCluster') @@ -1443,11 +1513,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1477,9 +1549,9 @@ def begin_create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> LROPoller["_models.ManagedCluster"]: + ) -> LROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. Creates or updates a managed cluster. @@ -1504,37 +1576,47 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_09_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1551,17 +1633,20 @@ def _update_tags_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-09-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'TagsObject') @@ -1573,11 +1658,13 @@ def _update_tags_initial( content_type=content_type, json=_json, template_url=self._update_tags_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1603,9 +1690,9 @@ def begin_update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> LROPoller["_models.ManagedCluster"]: + ) -> LROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates tags on a managed cluster. @@ -1630,37 +1717,47 @@ def begin_update_tags( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_09_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._update_tags_initial( + raw_result = self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1679,13 +1776,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -1694,11 +1794,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1742,20 +1844,25 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_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) @@ -1765,8 +1872,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1783,17 +1896,20 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-09-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') @@ -1805,11 +1921,13 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re content_type=content_type, json=_json, template_url=self._reset_service_principal_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1831,7 +1949,7 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> LROPoller[None]: """Reset the Service Principal Profile of a managed cluster. @@ -1857,23 +1975,28 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._reset_service_principal_profile_initial( + raw_result = self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1883,8 +2006,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1901,17 +2030,20 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-09-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') @@ -1923,11 +2055,13 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement content_type=content_type, json=_json, template_url=self._reset_aad_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1949,7 +2083,7 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> LROPoller[None]: """Reset the AAD Profile of a managed cluster. @@ -1974,23 +2108,28 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._reset_aad_profile_initial( + raw_result = self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -2000,8 +2139,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2020,13 +2165,16 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_rotate_cluster_certificates_request_initial( @@ -2035,11 +2183,13 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return resource_name=resource_name, api_version=api_version, template_url=self._rotate_cluster_certificates_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2084,20 +2234,25 @@ def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-st :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._rotate_cluster_certificates_initial( + raw_result = self._rotate_cluster_certificates_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) @@ -2107,8 +2262,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2127,13 +2288,16 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_stop_request_initial( @@ -2142,11 +2306,13 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_name, api_version=api_version, template_url=self._stop_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2194,20 +2360,25 @@ def begin_stop( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._stop_initial( + raw_result = self._stop_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) @@ -2217,8 +2388,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2237,13 +2414,16 @@ def _start_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_start_request_initial( @@ -2252,11 +2432,13 @@ def _start_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_name, api_version=api_version, template_url=self._start_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2301,20 +2483,25 @@ def begin_start( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._start_initial( + raw_result = self._start_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) @@ -2324,8 +2511,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2342,17 +2535,20 @@ def _run_command_initial( self, resource_group_name: str, resource_name: str, - request_payload: "_models.RunCommandRequest", + request_payload: _models.RunCommandRequest, **kwargs: Any - ) -> Optional["_models.RunCommandResult"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RunCommandResult"]] + ) -> Optional[_models.RunCommandResult]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-09-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] _json = self._serialize.body(request_payload, 'RunCommandRequest') @@ -2364,11 +2560,13 @@ def _run_command_initial( content_type=content_type, json=_json, template_url=self._run_command_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2396,9 +2594,9 @@ def begin_run_command( self, resource_group_name: str, resource_name: str, - request_payload: "_models.RunCommandRequest", + request_payload: _models.RunCommandRequest, **kwargs: Any - ) -> LROPoller["_models.RunCommandResult"]: + ) -> LROPoller[_models.RunCommandResult]: """Submits a command to run against the Managed Cluster. AKS will create a pod to run the command. This is primarily useful for private clusters. For @@ -2425,37 +2623,47 @@ def begin_run_command( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_09_01.models.RunCommandResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.RunCommandResult] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._run_command_initial( + raw_result = self._run_command_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, request_payload=request_payload, 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): - response = pipeline_response.http_response deserialized = self._deserialize('RunCommandResult', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2475,7 +2683,7 @@ def get_command_result( resource_name: str, command_id: str, **kwargs: Any - ) -> Optional["_models.RunCommandResult"]: + ) -> Optional[_models.RunCommandResult]: """Gets the results of a command which has been run on the Managed Cluster. Gets the results of a command which has been run on the Managed Cluster. @@ -2491,13 +2699,16 @@ def get_command_result( :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.RunCommandResult or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RunCommandResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] request = build_get_command_result_request( @@ -2507,11 +2718,13 @@ def get_command_result( command_id=command_id, api_version=api_version, template_url=self.get_command_result.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2540,7 +2753,7 @@ def list_outbound_network_dependencies_endpoints( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Iterable["_models.OutboundEnvironmentEndpointCollection"]: + ) -> Iterable[_models.OutboundEnvironmentEndpointCollection]: """Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. @@ -2558,13 +2771,16 @@ def list_outbound_network_dependencies_endpoints( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_09_01.models.OutboundEnvironmentEndpointCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OutboundEnvironmentEndpointCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -2574,9 +2790,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=self.list_outbound_network_dependencies_endpoints.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -2586,9 +2804,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/operations/_operations.py index f6d02b685927..dddb70e5a3eb 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/operations/_operations.py @@ -16,6 +16,7 @@ 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 @@ -29,55 +30,54 @@ def build_list_request( **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.ContainerService/operations") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class Operations(object): - """Operations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_09_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_09_01.ContainerServiceClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> Iterable["_models.OperationListResult"]: + ) -> Iterable[_models.OperationListResult]: """Gets a list of operations. Gets a list of operations. @@ -88,31 +88,38 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_09_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/operations/_private_endpoint_connections_operations.py index a5abd5905bbf..4a575d3d6d95 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/operations/_private_endpoint_connections_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast from msrest import Serializer @@ -16,13 +16,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -34,9 +34,12 @@ def build_list_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections") # pylint: disable=line-too-long path_format_arguments = { @@ -48,18 +51,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -71,9 +72,12 @@ def build_get_request( private_endpoint_connection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -86,18 +90,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -108,14 +110,17 @@ def build_update_request( resource_name: str, private_endpoint_connection_name: str, *, - json: JSONType = None, + json: Optional[_models.PrivateEndpointConnection] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -128,20 +133,18 @@ def build_update_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -155,9 +158,12 @@ def build_delete_request_initial( private_endpoint_connection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -170,42 +176,38 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class PrivateEndpointConnectionsOperations(object): - """PrivateEndpointConnectionsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class PrivateEndpointConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_09_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_09_01.ContainerServiceClient`'s + :attr:`private_endpoint_connections` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -213,7 +215,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnectionListResult": + ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. To learn more about private clusters, see: @@ -228,13 +230,16 @@ def list( :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.PrivateEndpointConnectionListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] request = build_list_request( @@ -243,11 +248,13 @@ def list( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -275,7 +282,7 @@ def get( resource_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Gets the specified private endpoint connection. To learn more about private clusters, see: @@ -292,13 +299,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] request = build_get_request( @@ -308,11 +318,13 @@ def get( private_endpoint_connection_name=private_endpoint_connection_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -339,9 +351,9 @@ def update( resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - parameters: "_models.PrivateEndpointConnection", + parameters: _models.PrivateEndpointConnection, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. Updates a private endpoint connection. @@ -359,14 +371,17 @@ def update( :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-09-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] _json = self._serialize.body(parameters, 'PrivateEndpointConnection') @@ -379,11 +394,13 @@ def update( content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -411,13 +428,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -427,11 +447,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name=private_endpoint_connection_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -478,21 +500,26 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -502,8 +529,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/operations/_private_link_resources_operations.py index 0340c20a1188..72ed10d132a3 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/operations/_private_link_resources_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/operations/_private_link_resources_operations.py @@ -15,6 +15,7 @@ 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 @@ -31,9 +32,12 @@ def build_list_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources") # pylint: disable=line-too-long path_format_arguments = { @@ -45,42 +49,38 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class PrivateLinkResourcesOperations(object): - """PrivateLinkResourcesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class PrivateLinkResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_09_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_09_01.ContainerServiceClient`'s + :attr:`private_link_resources` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -88,7 +88,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.PrivateLinkResourcesListResult": + ) -> _models.PrivateLinkResourcesListResult: """Gets a list of private link resources in the specified managed cluster. To learn more about private clusters, see: @@ -103,13 +103,16 @@ def list( :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.PrivateLinkResourcesListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourcesListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] request = build_list_request( @@ -118,11 +121,13 @@ def list( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/operations/_resolve_private_link_service_id_operations.py index 787ab0114b09..d6875eee7e03 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/operations/_resolve_private_link_service_id_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/operations/_resolve_private_link_service_id_operations.py @@ -15,12 +15,12 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -31,14 +31,17 @@ def build_post_request( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.PrivateLinkResource] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId") # pylint: disable=line-too-long path_format_arguments = { @@ -50,55 +53,51 @@ def build_post_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs ) -class ResolvePrivateLinkServiceIdOperations(object): - """ResolvePrivateLinkServiceIdOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ResolvePrivateLinkServiceIdOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_09_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_09_01.ContainerServiceClient`'s + :attr:`resolve_private_link_service_id` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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 post( self, resource_group_name: str, resource_name: str, - parameters: "_models.PrivateLinkResource", + parameters: _models.PrivateLinkResource, **kwargs: Any - ) -> "_models.PrivateLinkResource": + ) -> _models.PrivateLinkResource: """Gets the private link service ID for the specified managed cluster. Gets the private link service ID for the specified managed cluster. @@ -114,14 +113,17 @@ def post( :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.PrivateLinkResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-09-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] _json = self._serialize.body(parameters, 'PrivateLinkResource') @@ -133,11 +135,13 @@ def post( content_type=content_type, json=_json, template_url=self.post.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/operations/_snapshots_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/operations/_snapshots_operations.py index 2799573527f8..e4b966ca49f3 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/operations/_snapshots_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_09_01/operations/_snapshots_operations.py @@ -16,12 +16,12 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -31,9 +31,12 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots") path_format_arguments = { @@ -43,18 +46,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -64,9 +65,12 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots") # pylint: disable=line-too-long path_format_arguments = { @@ -77,18 +81,16 @@ def build_list_by_resource_group_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -99,9 +101,12 @@ def build_get_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -113,18 +118,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -134,14 +137,17 @@ def build_create_or_update_request( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.Snapshot] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -153,20 +159,18 @@ def build_create_or_update_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -178,14 +182,17 @@ def build_update_tags_request( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.TagsObject] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -197,20 +204,18 @@ def build_update_tags_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -223,9 +228,12 @@ def build_delete_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -237,48 +245,44 @@ def build_delete_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class SnapshotsOperations(object): - """SnapshotsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class SnapshotsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_09_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_09_01.ContainerServiceClient`'s + :attr:`snapshots` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> Iterable["_models.SnapshotListResult"]: + ) -> Iterable[_models.SnapshotListResult]: """Gets a list of snapshots in the specified subscription. Gets a list of snapshots in the specified subscription. @@ -289,13 +293,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_09_01.models.SnapshotListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -303,9 +310,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -313,9 +322,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -353,7 +364,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.SnapshotListResult"]: + ) -> Iterable[_models.SnapshotListResult]: """Lists snapshots in the specified subscription and resource group. Lists snapshots in the specified subscription and resource group. @@ -366,13 +377,16 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_09_01.models.SnapshotListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -381,9 +395,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -392,9 +408,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -433,7 +451,7 @@ def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.Snapshot": + ) -> _models.Snapshot: """Gets a snapshot. Gets a snapshot. @@ -447,13 +465,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.Snapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] request = build_get_request( @@ -462,11 +483,13 @@ def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -492,9 +515,9 @@ def create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.Snapshot", + parameters: _models.Snapshot, **kwargs: Any - ) -> "_models.Snapshot": + ) -> _models.Snapshot: """Creates or updates a snapshot. Creates or updates a snapshot. @@ -510,14 +533,17 @@ def create_or_update( :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.Snapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-09-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] _json = self._serialize.body(parameters, 'Snapshot') @@ -529,11 +555,13 @@ def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -563,9 +591,9 @@ def update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.Snapshot": + ) -> _models.Snapshot: """Updates tags on a snapshot. Updates tags on a snapshot. @@ -581,14 +609,17 @@ def update_tags( :rtype: ~azure.mgmt.containerservice.v2021_09_01.models.Snapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-09-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] _json = self._serialize.body(parameters, 'TagsObject') @@ -600,11 +631,13 @@ def update_tags( content_type=content_type, json=_json, template_url=self.update_tags.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -645,13 +678,16 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-09-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -660,11 +696,13 @@ def delete( # pylint: disable=inconsistent-return-statements resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/__init__.py index 53c675bd95e2..37a5f9e02e6f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._container_service_client import ContainerServiceClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['ContainerServiceClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/_container_service_client.py index a8028d6c8496..4d30edae8329 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/_container_service_client.py @@ -74,14 +74,30 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.managed_clusters = ManagedClustersOperations(self._client, self._config, self._serialize, self._deserialize) - self.maintenance_configurations = MaintenanceConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) - self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) - self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations(self._client, self._config, self._serialize, self._deserialize) - self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_clusters = ManagedClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.maintenance_configurations = MaintenanceConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.agent_pools = AgentPoolsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.snapshots = SnapshotsOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/__init__.py index 53c675bd95e2..37a5f9e02e6f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._container_service_client import ContainerServiceClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['ContainerServiceClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/_container_service_client.py index b47c1993747f..811733b02e20 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/_container_service_client.py @@ -75,14 +75,30 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.managed_clusters = ManagedClustersOperations(self._client, self._config, self._serialize, self._deserialize) - self.maintenance_configurations = MaintenanceConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) - self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) - self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations(self._client, self._config, self._serialize, self._deserialize) - self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_clusters = ManagedClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.maintenance_configurations = MaintenanceConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.agent_pools = AgentPoolsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.snapshots = SnapshotsOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/operations/__init__.py index 5e1e5e72fa59..e0748876288c 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/operations/__init__.py @@ -15,6 +15,9 @@ from ._resolve_private_link_service_id_operations import ResolvePrivateLinkServiceIdOperations from ._snapshots_operations import SnapshotsOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'Operations', 'ManagedClustersOperations', @@ -25,3 +28,5 @@ 'ResolvePrivateLinkServiceIdOperations', 'SnapshotsOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/operations/_agent_pools_operations.py index b344af96b5f5..562f9ae8f3b3 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/operations/_agent_pools_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. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ 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 @@ -26,26 +27,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class AgentPoolsOperations: - """AgentPoolsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_10_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_10_01.aio.ContainerServiceClient`'s + :attr:`agent_pools` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -53,7 +52,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> AsyncIterable["_models.AgentPoolListResult"]: + ) -> AsyncIterable[_models.AgentPoolListResult]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. @@ -68,13 +67,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_10_01.models.AgentPoolListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -84,9 +86,11 @@ def prepare_request(next_link=None): resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -96,9 +100,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -138,7 +144,7 @@ async def get( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPool": + ) -> _models.AgentPool: """Gets the specified managed cluster agent pool. Gets the specified managed cluster agent pool. @@ -154,13 +160,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.AgentPool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] request = build_get_request( @@ -170,11 +179,13 @@ async def get( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -200,17 +211,20 @@ async def _create_or_update_initial( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> "_models.AgentPool": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] + ) -> _models.AgentPool: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] _json = self._serialize.body(parameters, 'AgentPool') @@ -223,11 +237,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -258,9 +274,9 @@ async def begin_create_or_update( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> AsyncLROPoller["_models.AgentPool"]: + ) -> AsyncLROPoller[_models.AgentPool]: """Creates or updates an agent pool in the specified managed cluster. Creates or updates an agent pool in the specified managed cluster. @@ -287,17 +303,20 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_10_01.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, @@ -305,20 +324,27 @@ async def begin_create_or_update( 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): - response = pipeline_response.http_response deserialized = self._deserialize('AgentPool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -338,13 +364,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements agent_pool_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -354,11 +383,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -405,21 +436,26 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-10-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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) @@ -429,8 +465,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -450,7 +492,7 @@ async def get_upgrade_profile( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPoolUpgradeProfile": + ) -> _models.AgentPoolUpgradeProfile: """Gets the upgrade profile for an agent pool. Gets the upgrade profile for an agent pool. @@ -466,13 +508,16 @@ async def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.AgentPoolUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] request = build_get_upgrade_profile_request( @@ -482,11 +527,13 @@ async def get_upgrade_profile( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -513,7 +560,7 @@ async def get_available_agent_pool_versions( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.AgentPoolAvailableVersions": + ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported Kubernetes versions for the specified agent pool. See `supported Kubernetes versions @@ -529,13 +576,16 @@ async def get_available_agent_pool_versions( :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.AgentPoolAvailableVersions :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolAvailableVersions"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] request = build_get_available_agent_pool_versions_request( @@ -544,11 +594,13 @@ async def get_available_agent_pool_versions( resource_name=resource_name, api_version=api_version, template_url=self.get_available_agent_pool_versions.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -575,14 +627,17 @@ async def _upgrade_node_image_version_initial( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> Optional["_models.AgentPool"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.AgentPool"]] + ) -> Optional[_models.AgentPool]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] request = build_upgrade_node_image_version_request_initial( @@ -592,11 +647,13 @@ async def _upgrade_node_image_version_initial( agent_pool_name=agent_pool_name, api_version=api_version, template_url=self._upgrade_node_image_version_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -629,7 +686,7 @@ async def begin_upgrade_node_image_version( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> AsyncLROPoller["_models.AgentPool"]: + ) -> AsyncLROPoller[_models.AgentPool]: """Upgrades the node image version of an agent pool to the latest. Upgrading the node image version of an agent pool applies the newest OS and runtime updates to @@ -656,21 +713,26 @@ async def begin_upgrade_node_image_version( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_10_01.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._upgrade_node_image_version_initial( + raw_result = await self._upgrade_node_image_version_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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) @@ -686,8 +748,14 @@ def get_long_running_output(pipeline_response): return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/operations/_maintenance_configurations_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/operations/_maintenance_configurations_operations.py index 1d469266b93b..dd6b0cdc6d5a 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/operations/_maintenance_configurations_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/operations/_maintenance_configurations_operations.py @@ -15,6 +15,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -24,26 +25,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class MaintenanceConfigurationsOperations: - """MaintenanceConfigurationsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_10_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_10_01.aio.ContainerServiceClient`'s + :attr:`maintenance_configurations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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_by_managed_cluster( @@ -51,7 +50,7 @@ def list_by_managed_cluster( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> AsyncIterable["_models.MaintenanceConfigurationListResult"]: + ) -> AsyncIterable[_models.MaintenanceConfigurationListResult]: """Gets a list of maintenance configurations in the specified managed cluster. Gets a list of maintenance configurations in the specified managed cluster. @@ -67,13 +66,16 @@ def list_by_managed_cluster( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_10_01.models.MaintenanceConfigurationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfigurationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfigurationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -83,9 +85,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=self.list_by_managed_cluster.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -95,9 +99,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -137,7 +143,7 @@ async def get( resource_name: str, config_name: str, **kwargs: Any - ) -> "_models.MaintenanceConfiguration": + ) -> _models.MaintenanceConfiguration: """Gets the specified maintenance configuration of a managed cluster. Gets the specified maintenance configuration of a managed cluster. @@ -153,13 +159,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.MaintenanceConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfiguration"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] request = build_get_request( @@ -169,11 +178,13 @@ async def get( config_name=config_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -200,9 +211,9 @@ async def create_or_update( resource_group_name: str, resource_name: str, config_name: str, - parameters: "_models.MaintenanceConfiguration", + parameters: _models.MaintenanceConfiguration, **kwargs: Any - ) -> "_models.MaintenanceConfiguration": + ) -> _models.MaintenanceConfiguration: """Creates or updates a maintenance configuration in the specified managed cluster. Creates or updates a maintenance configuration in the specified managed cluster. @@ -220,14 +231,17 @@ async def create_or_update( :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.MaintenanceConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfiguration"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] _json = self._serialize.body(parameters, 'MaintenanceConfiguration') @@ -240,11 +254,13 @@ async def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -288,13 +304,16 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -304,11 +323,13 @@ async def delete( # pylint: disable=inconsistent-return-statements config_name=config_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/operations/_managed_clusters_operations.py index 93ec34df3a42..580fdff286e7 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/operations/_managed_clusters_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. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ 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 @@ -26,26 +27,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ManagedClustersOperations: # pylint: disable=too-many-public-methods - """ManagedClustersOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_10_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_10_01.aio.ContainerServiceClient`'s + :attr:`managed_clusters` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace_async async def get_os_options( @@ -53,7 +52,7 @@ async def get_os_options( location: str, resource_type: Optional[str] = None, **kwargs: Any - ) -> "_models.OSOptionProfile": + ) -> _models.OSOptionProfile: """Gets supported OS options in the specified subscription. Gets supported OS options in the specified subscription. @@ -68,13 +67,16 @@ async def get_os_options( :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.OSOptionProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OSOptionProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OSOptionProfile] request = build_get_os_options_request( @@ -83,11 +85,13 @@ async def get_os_options( api_version=api_version, resource_type=resource_type, template_url=self.get_os_options.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -112,7 +116,7 @@ async def get_os_options( def list( self, **kwargs: Any - ) -> AsyncIterable["_models.ManagedClusterListResult"]: + ) -> AsyncIterable[_models.ManagedClusterListResult]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. @@ -124,13 +128,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_10_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -138,9 +145,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -148,9 +157,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -188,7 +199,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ManagedClusterListResult"]: + ) -> AsyncIterable[_models.ManagedClusterListResult]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. @@ -202,13 +213,16 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_10_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -217,9 +231,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -228,9 +244,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -269,7 +287,7 @@ async def get_upgrade_profile( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedClusterUpgradeProfile": + ) -> _models.ManagedClusterUpgradeProfile: """Gets the upgrade profile of a managed cluster. Gets the upgrade profile of a managed cluster. @@ -283,13 +301,16 @@ async def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.ManagedClusterUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] request = build_get_upgrade_profile_request( @@ -298,11 +319,13 @@ async def get_upgrade_profile( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -330,7 +353,7 @@ async def get_access_profile( resource_name: str, role_name: str, **kwargs: Any - ) -> "_models.ManagedClusterAccessProfile": + ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. **WARNING**\ : This API will be deprecated. Instead use `ListClusterUserCredentials @@ -349,13 +372,16 @@ async def get_access_profile( :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.ManagedClusterAccessProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterAccessProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] request = build_get_access_profile_request( @@ -365,11 +391,13 @@ async def get_access_profile( role_name=role_name, api_version=api_version, template_url=self.get_access_profile.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -397,7 +425,7 @@ async def list_cluster_admin_credentials( resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Lists the admin credentials of a managed cluster. Lists the admin credentials of a managed cluster. @@ -413,13 +441,16 @@ async def list_cluster_admin_credentials( :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_admin_credentials_request( @@ -429,11 +460,13 @@ async def list_cluster_admin_credentials( api_version=api_version, server_fqdn=server_fqdn, template_url=self.list_cluster_admin_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -461,7 +494,7 @@ async def list_cluster_user_credentials( resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Lists the user credentials of a managed cluster. Lists the user credentials of a managed cluster. @@ -477,13 +510,16 @@ async def list_cluster_user_credentials( :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_user_credentials_request( @@ -493,11 +529,13 @@ async def list_cluster_user_credentials( api_version=api_version, server_fqdn=server_fqdn, template_url=self.list_cluster_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -525,7 +563,7 @@ async def list_cluster_monitoring_user_credentials( resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Lists the cluster monitoring user credentials of a managed cluster. Lists the cluster monitoring user credentials of a managed cluster. @@ -541,13 +579,16 @@ async def list_cluster_monitoring_user_credentials( :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_monitoring_user_credentials_request( @@ -557,11 +598,13 @@ async def list_cluster_monitoring_user_credentials( api_version=api_version, server_fqdn=server_fqdn, template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -588,7 +631,7 @@ async def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedCluster": + ) -> _models.ManagedCluster: """Gets a managed cluster. Gets a managed cluster. @@ -602,13 +645,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.ManagedCluster :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] request = build_get_request( @@ -617,11 +663,13 @@ async def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -646,17 +694,20 @@ async def _create_or_update_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'ManagedCluster') @@ -668,11 +719,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -702,9 +755,9 @@ async def begin_create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> AsyncLROPoller["_models.ManagedCluster"]: + ) -> AsyncLROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. Creates or updates a managed cluster. @@ -729,37 +782,47 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_10_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -776,17 +839,20 @@ async def _update_tags_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'TagsObject') @@ -798,11 +864,13 @@ async def _update_tags_initial( content_type=content_type, json=_json, template_url=self._update_tags_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -828,9 +896,9 @@ async def begin_update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> AsyncLROPoller["_models.ManagedCluster"]: + ) -> AsyncLROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates tags on a managed cluster. @@ -855,37 +923,47 @@ async def begin_update_tags( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_10_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._update_tags_initial( + raw_result = await self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -904,13 +982,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -919,11 +1000,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -967,20 +1050,25 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-10-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_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) @@ -990,8 +1078,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1008,17 +1102,20 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') @@ -1030,11 +1127,13 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist content_type=content_type, json=_json, template_url=self._reset_service_principal_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1056,7 +1155,7 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> AsyncLROPoller[None]: """Reset the Service Principal Profile of a managed cluster. @@ -1082,23 +1181,28 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._reset_service_principal_profile_initial( + raw_result = await self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1108,8 +1212,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1126,17 +1236,20 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') @@ -1148,11 +1261,13 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta content_type=content_type, json=_json, template_url=self._reset_aad_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1174,7 +1289,7 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> AsyncLROPoller[None]: """Reset the AAD Profile of a managed cluster. @@ -1199,23 +1314,28 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._reset_aad_profile_initial( + raw_result = await self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1225,8 +1345,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1245,13 +1371,16 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_rotate_cluster_certificates_request_initial( @@ -1260,11 +1389,13 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- resource_name=resource_name, api_version=api_version, template_url=self._rotate_cluster_certificates_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1309,20 +1440,25 @@ async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-ret :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-10-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._rotate_cluster_certificates_initial( + raw_result = await self._rotate_cluster_certificates_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) @@ -1332,8 +1468,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1352,13 +1494,16 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_stop_request_initial( @@ -1367,11 +1512,13 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_name, api_version=api_version, template_url=self._stop_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1419,20 +1566,25 @@ async def begin_stop( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-10-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._stop_initial( + raw_result = await self._stop_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) @@ -1442,8 +1594,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1462,13 +1620,16 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_start_request_initial( @@ -1477,11 +1638,13 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_name, api_version=api_version, template_url=self._start_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1526,20 +1689,25 @@ async def begin_start( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-10-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._start_initial( + raw_result = await self._start_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) @@ -1549,8 +1717,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1567,17 +1741,20 @@ async def _run_command_initial( self, resource_group_name: str, resource_name: str, - request_payload: "_models.RunCommandRequest", + request_payload: _models.RunCommandRequest, **kwargs: Any - ) -> Optional["_models.RunCommandResult"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RunCommandResult"]] + ) -> Optional[_models.RunCommandResult]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] _json = self._serialize.body(request_payload, 'RunCommandRequest') @@ -1589,11 +1766,13 @@ async def _run_command_initial( content_type=content_type, json=_json, template_url=self._run_command_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1621,9 +1800,9 @@ async def begin_run_command( self, resource_group_name: str, resource_name: str, - request_payload: "_models.RunCommandRequest", + request_payload: _models.RunCommandRequest, **kwargs: Any - ) -> AsyncLROPoller["_models.RunCommandResult"]: + ) -> AsyncLROPoller[_models.RunCommandResult]: """Submits a command to run against the Managed Cluster. AKS will create a pod to run the command. This is primarily useful for private clusters. For @@ -1650,37 +1829,47 @@ async def begin_run_command( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_10_01.models.RunCommandResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.RunCommandResult] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._run_command_initial( + raw_result = await self._run_command_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, request_payload=request_payload, 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): - response = pipeline_response.http_response deserialized = self._deserialize('RunCommandResult', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1700,7 +1889,7 @@ async def get_command_result( resource_name: str, command_id: str, **kwargs: Any - ) -> Optional["_models.RunCommandResult"]: + ) -> Optional[_models.RunCommandResult]: """Gets the results of a command which has been run on the Managed Cluster. Gets the results of a command which has been run on the Managed Cluster. @@ -1716,13 +1905,16 @@ async def get_command_result( :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.RunCommandResult or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RunCommandResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] request = build_get_command_result_request( @@ -1732,11 +1924,13 @@ async def get_command_result( command_id=command_id, api_version=api_version, template_url=self.get_command_result.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1765,7 +1959,7 @@ def list_outbound_network_dependencies_endpoints( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> AsyncIterable["_models.OutboundEnvironmentEndpointCollection"]: + ) -> AsyncIterable[_models.OutboundEnvironmentEndpointCollection]: """Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. @@ -1783,13 +1977,16 @@ def list_outbound_network_dependencies_endpoints( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_10_01.models.OutboundEnvironmentEndpointCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OutboundEnvironmentEndpointCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -1799,9 +1996,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=self.list_outbound_network_dependencies_endpoints.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -1811,9 +2010,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/operations/_operations.py index 19e288c18f55..9e3a9116160f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/operations/_operations.py @@ -14,6 +14,7 @@ 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 @@ -23,32 +24,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class Operations: - """Operations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_10_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_10_01.aio.ContainerServiceClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.OperationListResult"]: + ) -> AsyncIterable[_models.OperationListResult]: """Gets a list of operations. Gets a list of operations. @@ -59,31 +58,38 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_10_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/operations/_private_endpoint_connections_operations.py index e3a3f29718e7..80479203b650 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/operations/_private_endpoint_connections_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -14,6 +14,7 @@ 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 @@ -24,26 +25,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class PrivateEndpointConnectionsOperations: - """PrivateEndpointConnectionsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_10_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_10_01.aio.ContainerServiceClient`'s + :attr:`private_endpoint_connections` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -51,7 +50,7 @@ async def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnectionListResult": + ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. To learn more about private clusters, see: @@ -66,13 +65,16 @@ async def list( :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.PrivateEndpointConnectionListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] request = build_list_request( @@ -81,11 +83,13 @@ async def list( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -113,7 +117,7 @@ async def get( resource_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Gets the specified private endpoint connection. To learn more about private clusters, see: @@ -130,13 +134,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] request = build_get_request( @@ -146,11 +153,13 @@ async def get( private_endpoint_connection_name=private_endpoint_connection_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -177,9 +186,9 @@ async def update( resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - parameters: "_models.PrivateEndpointConnection", + parameters: _models.PrivateEndpointConnection, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. Updates a private endpoint connection. @@ -197,14 +206,17 @@ async def update( :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] _json = self._serialize.body(parameters, 'PrivateEndpointConnection') @@ -217,11 +229,13 @@ async def update( content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -249,13 +263,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -265,11 +282,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name=private_endpoint_connection_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -316,21 +335,26 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-10-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -340,8 +364,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/operations/_private_link_resources_operations.py index 9082e1ff4388..02136afd64ab 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/operations/_private_link_resources_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/operations/_private_link_resources_operations.py @@ -13,6 +13,7 @@ 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 @@ -22,26 +23,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class PrivateLinkResourcesOperations: - """PrivateLinkResourcesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_10_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_10_01.aio.ContainerServiceClient`'s + :attr:`private_link_resources` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -49,7 +48,7 @@ async def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.PrivateLinkResourcesListResult": + ) -> _models.PrivateLinkResourcesListResult: """Gets a list of private link resources in the specified managed cluster. To learn more about private clusters, see: @@ -64,13 +63,16 @@ async def list( :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.PrivateLinkResourcesListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourcesListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] request = build_list_request( @@ -79,11 +81,13 @@ async def list( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/operations/_resolve_private_link_service_id_operations.py index dee25f6266f3..8e6150f50c7b 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/operations/_resolve_private_link_service_id_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/operations/_resolve_private_link_service_id_operations.py @@ -13,6 +13,7 @@ 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 @@ -22,35 +23,33 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ResolvePrivateLinkServiceIdOperations: - """ResolvePrivateLinkServiceIdOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_10_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_10_01.aio.ContainerServiceClient`'s + :attr:`resolve_private_link_service_id` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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 post( self, resource_group_name: str, resource_name: str, - parameters: "_models.PrivateLinkResource", + parameters: _models.PrivateLinkResource, **kwargs: Any - ) -> "_models.PrivateLinkResource": + ) -> _models.PrivateLinkResource: """Gets the private link service ID for the specified managed cluster. Gets the private link service ID for the specified managed cluster. @@ -66,14 +65,17 @@ async def post( :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.PrivateLinkResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] _json = self._serialize.body(parameters, 'PrivateLinkResource') @@ -85,11 +87,13 @@ async def post( content_type=content_type, json=_json, template_url=self.post.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/operations/_snapshots_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/operations/_snapshots_operations.py index b2185b10dec6..b476220190d3 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/operations/_snapshots_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/aio/operations/_snapshots_operations.py @@ -15,6 +15,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -24,32 +25,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class SnapshotsOperations: - """SnapshotsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_10_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_10_01.aio.ContainerServiceClient`'s + :attr:`snapshots` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.SnapshotListResult"]: + ) -> AsyncIterable[_models.SnapshotListResult]: """Gets a list of snapshots in the specified subscription. Gets a list of snapshots in the specified subscription. @@ -60,13 +59,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_10_01.models.SnapshotListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -74,9 +76,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -84,9 +88,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -124,7 +130,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.SnapshotListResult"]: + ) -> AsyncIterable[_models.SnapshotListResult]: """Lists snapshots in the specified subscription and resource group. Lists snapshots in the specified subscription and resource group. @@ -137,13 +143,16 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_10_01.models.SnapshotListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -152,9 +161,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -163,9 +174,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -204,7 +217,7 @@ async def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.Snapshot": + ) -> _models.Snapshot: """Gets a snapshot. Gets a snapshot. @@ -218,13 +231,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.Snapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] request = build_get_request( @@ -233,11 +249,13 @@ async def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -263,9 +281,9 @@ async def create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.Snapshot", + parameters: _models.Snapshot, **kwargs: Any - ) -> "_models.Snapshot": + ) -> _models.Snapshot: """Creates or updates a snapshot. Creates or updates a snapshot. @@ -281,14 +299,17 @@ async def create_or_update( :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.Snapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] _json = self._serialize.body(parameters, 'Snapshot') @@ -300,11 +321,13 @@ async def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -334,9 +357,9 @@ async def update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.Snapshot": + ) -> _models.Snapshot: """Updates tags on a snapshot. Updates tags on a snapshot. @@ -352,14 +375,17 @@ async def update_tags( :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.Snapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] _json = self._serialize.body(parameters, 'TagsObject') @@ -371,11 +397,13 @@ async def update_tags( content_type=content_type, json=_json, template_url=self.update_tags.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -416,13 +444,16 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -431,11 +462,13 @@ async def delete( # pylint: disable=inconsistent-return-statements resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/models/__init__.py index 641f278c0c33..ffb280a7c2fe 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/models/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/models/__init__.py @@ -131,7 +131,9 @@ WeekDay, WorkloadRuntime, ) - +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'AgentPool', 'AgentPoolAvailableVersions', @@ -255,3 +257,5 @@ 'WeekDay', 'WorkloadRuntime', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/models/_container_service_client_enums.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/models/_container_service_client_enums.py index feacacdf3147..145f90c5ecca 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/models/_container_service_client_enums.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/models/_container_service_client_enums.py @@ -7,11 +7,10 @@ # -------------------------------------------------------------------------- from enum import Enum -from six import with_metaclass from azure.core import CaseInsensitiveEnumMeta -class AgentPoolMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class AgentPoolMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: https://docs.microsoft.com/azure/aks/use-system-pools @@ -24,7 +23,7 @@ class AgentPoolMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: User agent pools are primarily for hosting your application pods. USER = "User" -class AgentPoolType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class AgentPoolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of Agent Pool. """ @@ -33,7 +32,7 @@ class AgentPoolType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Use of this is strongly discouraged. AVAILABILITY_SET = "AvailabilitySet" -class Code(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class Code(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Tells whether the cluster is Running or Stopped """ @@ -42,7 +41,7 @@ class Code(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: The cluster is stopped. STOPPED = "Stopped" -class ConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The private link service connection status. """ @@ -51,7 +50,7 @@ class ConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): REJECTED = "Rejected" DISCONNECTED = "Disconnected" -class ContainerServiceStorageProfileTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Specifies what kind of storage to use. If omitted, the default will be chosen on your behalf based on the choice of orchestrator. """ @@ -59,7 +58,7 @@ class ContainerServiceStorageProfileTypes(with_metaclass(CaseInsensitiveEnumMeta STORAGE_ACCOUNT = "StorageAccount" MANAGED_DISKS = "ManagedDisks" -class ContainerServiceVMSizeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Size of agent VMs. Note: This is no longer maintained. """ @@ -238,7 +237,7 @@ class ContainerServiceVMSizeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, E STANDARD_NV24 = "Standard_NV24" STANDARD_NV6 = "Standard_NV6" -class Count(with_metaclass(CaseInsensitiveEnumMeta, int, Enum)): +class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): """Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, and 5. The default value is 1. """ @@ -247,7 +246,7 @@ class Count(with_metaclass(CaseInsensitiveEnumMeta, int, Enum)): THREE = 3 FIVE = 5 -class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of identity that created the resource. """ @@ -256,7 +255,7 @@ class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class Expander(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class Expander(str, Enum, metaclass=CaseInsensitiveEnumMeta): """If not specified, the default is 'random'. See `expanders `_ for more information. @@ -279,13 +278,13 @@ class Expander(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Used when you don't have a particular need for the node groups to scale differently. RANDOM = "random" -class ExtendedLocationTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ExtendedLocationTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of extendedLocation. """ EDGE_ZONE = "EdgeZone" -class GPUInstanceProfile(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class GPUInstanceProfile(str, Enum, metaclass=CaseInsensitiveEnumMeta): """GPUInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU. """ @@ -295,14 +294,14 @@ class GPUInstanceProfile(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MIG4_G = "MIG4g" MIG7_G = "MIG7g" -class IpFamily(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class IpFamily(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The IP version to use for cluster networking and IP assignment. """ I_PV4 = "IPv4" I_PV6 = "IPv6" -class KubeletDiskType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class KubeletDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. """ @@ -312,7 +311,7 @@ class KubeletDiskType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Kubelet will use the temporary disk for its data. TEMPORARY = "Temporary" -class LicenseType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class LicenseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The license type to use for Windows VMs. See `Azure Hybrid User Benefits `_ for more details. """ @@ -322,7 +321,7 @@ class LicenseType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Enables Azure Hybrid User Benefits for Windows VMs. WINDOWS_SERVER = "Windows_Server" -class LoadBalancerSku(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class LoadBalancerSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the differences between load balancer SKUs. @@ -335,7 +334,7 @@ class LoadBalancerSku(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Use a basic Load Balancer with limited functionality. BASIC = "basic" -class ManagedClusterPodIdentityProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ManagedClusterPodIdentityProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The current provisioning state of the pod identity. """ @@ -344,13 +343,13 @@ class ManagedClusterPodIdentityProvisioningState(with_metaclass(CaseInsensitiveE DELETING = "Deleting" FAILED = "Failed" -class ManagedClusterSKUName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ManagedClusterSKUName(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The name of a managed cluster SKU. """ BASIC = "Basic" -class ManagedClusterSKUTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ManagedClusterSKUTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): """If not specified, the default is 'Free'. See `uptime SLA `_ for more details. """ @@ -361,7 +360,7 @@ class ManagedClusterSKUTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: No guaranteed SLA, no additional charges. Free tier clusters have an SLO of 99.5%. FREE = "Free" -class NetworkMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """This cannot be specified if networkPlugin is anything other than 'azure'. """ @@ -372,7 +371,7 @@ class NetworkMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: This is no longer supported. BRIDGE = "bridge" -class NetworkPlugin(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkPlugin(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Network plugin used for building the Kubernetes network. """ @@ -385,7 +384,7 @@ class NetworkPlugin(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: information. KUBENET = "kubenet" -class NetworkPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Network policy used for building the Kubernetes network. """ @@ -398,7 +397,7 @@ class NetworkPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: for more information. AZURE = "azure" -class OSDiskType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OSDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS @@ -414,14 +413,14 @@ class OSDiskType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: provides lower read/write latency, along with faster node scaling and cluster upgrades. EPHEMERAL = "Ephemeral" -class OSSKU(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OSSKU(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Specifies an OS SKU. This value must not be specified if OSType is Windows. """ UBUNTU = "Ubuntu" CBL_MARINER = "CBLMariner" -class OSType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The operating system type. The default is Linux. """ @@ -430,7 +429,7 @@ class OSType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Use Windows. WINDOWS = "Windows" -class OutboundType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OutboundType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type `_. """ @@ -450,7 +449,7 @@ class OutboundType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: advanced scenario and requires proper network configuration. USER_ASSIGNED_NAT_GATEWAY = "userAssignedNATGateway" -class PrivateEndpointConnectionProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class PrivateEndpointConnectionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The current provisioning state. """ @@ -459,14 +458,14 @@ class PrivateEndpointConnectionProvisioningState(with_metaclass(CaseInsensitiveE DELETING = "Deleting" FAILED = "Failed" -class PublicNetworkAccess(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class PublicNetworkAccess(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Allow or deny public network access for AKS """ ENABLED = "Enabled" DISABLED = "Disabled" -class ResourceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """For more information see `use managed identities in AKS `_. """ @@ -482,7 +481,7 @@ class ResourceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Do not use a managed identity for the Managed Cluster, service principal will be used instead. NONE = "None" -class ScaleDownMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ScaleDownMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Describes how VMs are added to or removed from Agent Pools. See `billing states `_. """ @@ -493,7 +492,7 @@ class ScaleDownMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: during scale down. DEALLOCATE = "Deallocate" -class ScaleSetEvictionPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The eviction policy specifies what to do with the VM when it is evicted. The default is Delete. For more information about eviction see `spot VMs `_ @@ -506,7 +505,7 @@ class ScaleSetEvictionPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)) #: cause issues with cluster scaling or upgrading. DEALLOCATE = "Deallocate" -class ScaleSetPriority(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ScaleSetPriority(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The Virtual Machine Scale Set priority. """ @@ -516,14 +515,14 @@ class ScaleSetPriority(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Regular VMs will be used. REGULAR = "Regular" -class SnapshotType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SnapshotType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of a snapshot. The default is NodePool. """ #: The snapshot is a snapshot of a node pool. NODE_POOL = "NodePool" -class UpgradeChannel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class UpgradeChannel(str, Enum, metaclass=CaseInsensitiveEnumMeta): """For more information see `setting the AKS cluster auto-upgrade channel `_. """ @@ -553,7 +552,7 @@ class UpgradeChannel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Disables auto-upgrades and keeps the cluster at its current version of Kubernetes. NONE = "none" -class WeekDay(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class WeekDay(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The weekday enum. """ @@ -565,7 +564,7 @@ class WeekDay(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): FRIDAY = "Friday" SATURDAY = "Saturday" -class WorkloadRuntime(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class WorkloadRuntime(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Determines the type of workload a node can run. """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/models/_models_py3.py index 74436df3af1d..b86bf3087f76 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/models/_models_py3.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/models/_models_py3.py @@ -7,11 +7,13 @@ # -------------------------------------------------------------------------- import datetime -from typing import Dict, List, Optional, Union +from typing import Dict, List, Optional, TYPE_CHECKING, Union import msrest.serialization -from ._container_service_client_enums import * +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + import __init__ as _models class SubResource(msrest.serialization.Model): @@ -79,15 +81,15 @@ class AgentPool(SubResource): :ivar os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS - `_. Possible values - include: "Managed", "Ephemeral". + `_. Known values are: + "Managed", "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2021_10_01.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Possible values include: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_10_01.models.KubeletDiskType - :ivar workload_runtime: Determines the type of workload a node can run. Possible values - include: "OCIContainer", "WasmWasi". + :ivar workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer", "WasmWasi". :vartype workload_runtime: str or ~azure.mgmt.containerservice.v2021_10_01.models.WorkloadRuntime :ivar vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and used. @@ -101,11 +103,11 @@ class AgentPool(SubResource): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2021_10_01.models.OSType - :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Possible values include: "Ubuntu", "CBLMariner". + :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known + values are: "Ubuntu", "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2021_10_01.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. :vartype max_count: int @@ -114,16 +116,15 @@ class AgentPool(SubResource): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it - defaults to Delete. Possible values include: "Delete", "Deallocate". + defaults to Delete. Known values are: "Delete", "Deallocate". :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2021_10_01.models.ScaleDownMode - :ivar type_properties_type: The type of Agent Pool. Possible values include: + :ivar type_properties_type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :vartype type_properties_type: str or ~azure.mgmt.containerservice.v2021_10_01.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Possible values include: "System", - "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". :vartype mode: str or ~azure.mgmt.containerservice.v2021_10_01.models.AgentPoolMode :ivar orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -158,12 +159,12 @@ class AgentPool(SubResource): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Possible values include: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_10_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Possible values include: "Delete", - "Deallocate". Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_10_01.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which @@ -195,7 +196,7 @@ class AgentPool(SubResource): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2021_10_01.models.GPUInstanceProfile :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool @@ -263,40 +264,40 @@ def __init__( count: Optional[int] = None, vm_size: Optional[str] = None, os_disk_size_gb: Optional[int] = None, - os_disk_type: Optional[Union[str, "OSDiskType"]] = None, - kubelet_disk_type: Optional[Union[str, "KubeletDiskType"]] = None, - workload_runtime: Optional[Union[str, "WorkloadRuntime"]] = None, + os_disk_type: Optional[Union[str, "_models.OSDiskType"]] = None, + kubelet_disk_type: Optional[Union[str, "_models.KubeletDiskType"]] = None, + workload_runtime: Optional[Union[str, "_models.WorkloadRuntime"]] = None, vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", - os_sku: Optional[Union[str, "OSSKU"]] = None, + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - scale_down_mode: Optional[Union[str, "ScaleDownMode"]] = None, - type_properties_type: Optional[Union[str, "AgentPoolType"]] = None, - mode: Optional[Union[str, "AgentPoolMode"]] = None, + scale_down_mode: Optional[Union[str, "_models.ScaleDownMode"]] = None, + type_properties_type: Optional[Union[str, "_models.AgentPoolType"]] = None, + mode: Optional[Union[str, "_models.AgentPoolMode"]] = None, orchestrator_version: Optional[str] = None, - upgrade_settings: Optional["AgentPoolUpgradeSettings"] = None, - power_state: Optional["PowerState"] = None, + upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, + power_state: Optional["_models.PowerState"] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", spot_max_price: Optional[float] = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, proximity_placement_group_id: Optional[str] = None, - kubelet_config: Optional["KubeletConfig"] = None, - linux_os_config: Optional["LinuxOSConfig"] = None, + kubelet_config: Optional["_models.KubeletConfig"] = None, + linux_os_config: Optional["_models.LinuxOSConfig"] = None, enable_encryption_at_host: Optional[bool] = None, enable_ultra_ssd: Optional[bool] = None, enable_fips: Optional[bool] = None, - gpu_instance_profile: Optional[Union[str, "GPUInstanceProfile"]] = None, - creation_data: Optional["CreationData"] = None, + gpu_instance_profile: Optional[Union[str, "_models.GPUInstanceProfile"]] = None, + creation_data: Optional["_models.CreationData"] = None, **kwargs ): """ @@ -315,15 +316,15 @@ def __init__( :keyword os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS - `_. Possible values - include: "Managed", "Ephemeral". + `_. Known values are: + "Managed", "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2021_10_01.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Possible values include: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_10_01.models.KubeletDiskType - :keyword workload_runtime: Determines the type of workload a node can run. Possible values - include: "OCIContainer", "WasmWasi". + :keyword workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer", "WasmWasi". :paramtype workload_runtime: str or ~azure.mgmt.containerservice.v2021_10_01.models.WorkloadRuntime :keyword vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and @@ -337,11 +338,11 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2021_10_01.models.OSType :keyword os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Possible values include: "Ubuntu", "CBLMariner". + Known values are: "Ubuntu", "CBLMariner". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2021_10_01.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -350,17 +351,16 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, - it defaults to Delete. Possible values include: "Delete", "Deallocate". + it defaults to Delete. Known values are: "Delete", "Deallocate". :paramtype scale_down_mode: str or ~azure.mgmt.containerservice.v2021_10_01.models.ScaleDownMode - :keyword type_properties_type: The type of Agent Pool. Possible values include: + :keyword type_properties_type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type_properties_type: str or ~azure.mgmt.containerservice.v2021_10_01.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Possible values include: "System", - "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2021_10_01.models.AgentPoolMode :keyword orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -391,12 +391,12 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Possible values include: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_10_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Possible values include: "Delete", - "Deallocate". Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_10_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which @@ -428,7 +428,7 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2021_10_01.models.GPUInstanceProfile @@ -510,7 +510,7 @@ class AgentPoolAvailableVersions(msrest.serialization.Model): def __init__( self, *, - agent_pool_versions: Optional[List["AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem"]] = None, + agent_pool_versions: Optional[List["_models.AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem"]] = None, **kwargs ): """ @@ -587,7 +587,7 @@ class AgentPoolListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["AgentPool"]] = None, + value: Optional[List["_models.AgentPool"]] = None, **kwargs ): """ @@ -614,8 +614,8 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): :vartype type: str :ivar kubernetes_version: Required. The Kubernetes version (major.minor.patch). :vartype kubernetes_version: str - :ivar os_type: Required. The operating system type. The default is Linux. Possible values - include: "Linux", "Windows". Default value: "Linux". + :ivar os_type: Required. The operating system type. The default is Linux. Known values are: + "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2021_10_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -646,16 +646,16 @@ def __init__( self, *, kubernetes_version: str, - os_type: Union[str, "OSType"] = "Linux", - upgrades: Optional[List["AgentPoolUpgradeProfilePropertiesUpgradesItem"]] = None, + os_type: Union[str, "_models.OSType"] = "Linux", + upgrades: Optional[List["_models.AgentPoolUpgradeProfilePropertiesUpgradesItem"]] = None, latest_node_image_version: Optional[str] = None, **kwargs ): """ :keyword kubernetes_version: Required. The Kubernetes version (major.minor.patch). :paramtype kubernetes_version: str - :keyword os_type: Required. The operating system type. The default is Linux. Possible values - include: "Linux", "Windows". Default value: "Linux". + :keyword os_type: Required. The operating system type. The default is Linux. Known values are: + "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2021_10_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: @@ -767,7 +767,7 @@ def __init__( code: Optional[str] = None, message: Optional[str] = None, target: Optional[str] = None, - details: Optional[List["CloudErrorBody"]] = None, + details: Optional[List["_models.CloudErrorBody"]] = None, **kwargs ): """ @@ -811,7 +811,7 @@ class ContainerServiceDiagnosticsProfile(msrest.serialization.Model): def __init__( self, *, - vm_diagnostics: "ContainerServiceVMDiagnostics", + vm_diagnostics: "_models.ContainerServiceVMDiagnostics", **kwargs ): """ @@ -848,7 +848,7 @@ def __init__( self, *, admin_username: str, - ssh: "ContainerServiceSshConfiguration", + ssh: "_models.ContainerServiceSshConfiguration", **kwargs ): """ @@ -871,17 +871,17 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar count: Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, - and 5. The default value is 1. Possible values include: 1, 3, 5. Default value: "1". + and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". :vartype count: int or ~azure.mgmt.containerservice.v2021_10_01.models.Count :ivar dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. :vartype dns_prefix: str - :ivar vm_size: Required. Size of agent VMs. Possible values include: "Standard_A1", - "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", - "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", - "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", - "Standard_A8m_v2", "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", - "Standard_B8ms", "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", - "Standard_D12", "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", + :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", + "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", + "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", + "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", "Standard_B8ms", + "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", "Standard_D12", + "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", "Standard_D13_v2_Promo", "Standard_D14", "Standard_D14_v2", "Standard_D14_v2_Promo", "Standard_D15_v2", "Standard_D16_v3", "Standard_D16s_v3", "Standard_D1_v2", "Standard_D2", "Standard_D2_v2", "Standard_D2_v2_Promo", "Standard_D2_v3", "Standard_D2s_v3", "Standard_D3", @@ -926,7 +926,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): :vartype first_consecutive_static_ip: str :ivar storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Possible values include: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". :vartype storage_profile: str or ~azure.mgmt.containerservice.v2021_10_01.models.ContainerServiceStorageProfileTypes :ivar fqdn: FQDN for the master pool. @@ -955,27 +955,27 @@ def __init__( self, *, dns_prefix: str, - vm_size: Union[str, "ContainerServiceVMSizeTypes"], - count: Optional[Union[int, "Count"]] = 1, + vm_size: Union[str, "_models.ContainerServiceVMSizeTypes"], + count: Optional[Union[int, "_models.Count"]] = 1, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, first_consecutive_static_ip: Optional[str] = "10.240.255.5", - storage_profile: Optional[Union[str, "ContainerServiceStorageProfileTypes"]] = None, + storage_profile: Optional[Union[str, "_models.ContainerServiceStorageProfileTypes"]] = None, **kwargs ): """ :keyword count: Number of masters (VMs) in the container service cluster. Allowed values are 1, - 3, and 5. The default value is 1. Possible values include: 1, 3, 5. Default value: "1". + 3, and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". :paramtype count: int or ~azure.mgmt.containerservice.v2021_10_01.models.Count :keyword dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. :paramtype dns_prefix: str - :keyword vm_size: Required. Size of agent VMs. Possible values include: "Standard_A1", - "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", - "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", - "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", - "Standard_A8m_v2", "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", - "Standard_B8ms", "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", - "Standard_D12", "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", + :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", + "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", + "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", + "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", "Standard_B8ms", + "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", "Standard_D12", + "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", "Standard_D13_v2_Promo", "Standard_D14", "Standard_D14_v2", "Standard_D14_v2_Promo", "Standard_D15_v2", "Standard_D16_v3", "Standard_D16s_v3", "Standard_D1_v2", "Standard_D2", "Standard_D2_v2", "Standard_D2_v2_Promo", "Standard_D2_v3", "Standard_D2s_v3", "Standard_D3", @@ -1020,7 +1020,7 @@ def __init__( :paramtype first_consecutive_static_ip: str :keyword storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Possible values include: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". :paramtype storage_profile: str or ~azure.mgmt.containerservice.v2021_10_01.models.ContainerServiceStorageProfileTypes """ @@ -1038,14 +1038,14 @@ def __init__( class ContainerServiceNetworkProfile(msrest.serialization.Model): """Profile of network configuration. - :ivar network_plugin: Network plugin used for building the Kubernetes network. Possible values - include: "azure", "kubenet". Default value: "kubenet". + :ivar network_plugin: Network plugin used for building the Kubernetes network. Known values + are: "azure", "kubenet". Default value: "kubenet". :vartype network_plugin: str or ~azure.mgmt.containerservice.v2021_10_01.models.NetworkPlugin - :ivar network_policy: Network policy used for building the Kubernetes network. Possible values - include: "calico", "azure". + :ivar network_policy: Network policy used for building the Kubernetes network. Known values + are: "calico", "azure". :vartype network_policy: str or ~azure.mgmt.containerservice.v2021_10_01.models.NetworkPolicy :ivar network_mode: This cannot be specified if networkPlugin is anything other than 'azure'. - Possible values include: "transparent", "bridge". + Known values are: "transparent", "bridge". :vartype network_mode: str or ~azure.mgmt.containerservice.v2021_10_01.models.NetworkMode :ivar pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :vartype pod_cidr: str @@ -1060,13 +1060,13 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): :vartype docker_bridge_cidr: str :ivar outbound_type: This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type - `_. Possible values include: - "loadBalancer", "userDefinedRouting", "managedNATGateway", "userAssignedNATGateway". Default - value: "loadBalancer". + `_. Known values are: "loadBalancer", + "userDefinedRouting", "managedNATGateway", "userAssignedNATGateway". Default value: + "loadBalancer". :vartype outbound_type: str or ~azure.mgmt.containerservice.v2021_10_01.models.OutboundType :ivar load_balancer_sku: The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the - differences between load balancer SKUs. Possible values include: "standard", "basic". + differences between load balancer SKUs. Known values are: "standard", "basic". :vartype load_balancer_sku: str or ~azure.mgmt.containerservice.v2021_10_01.models.LoadBalancerSku :ivar load_balancer_profile: Profile of the cluster load balancer. @@ -1115,31 +1115,31 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): def __init__( self, *, - network_plugin: Optional[Union[str, "NetworkPlugin"]] = "kubenet", - network_policy: Optional[Union[str, "NetworkPolicy"]] = None, - network_mode: Optional[Union[str, "NetworkMode"]] = None, + network_plugin: Optional[Union[str, "_models.NetworkPlugin"]] = "kubenet", + network_policy: Optional[Union[str, "_models.NetworkPolicy"]] = None, + network_mode: Optional[Union[str, "_models.NetworkMode"]] = None, pod_cidr: Optional[str] = "10.244.0.0/16", service_cidr: Optional[str] = "10.0.0.0/16", dns_service_ip: Optional[str] = "10.0.0.10", docker_bridge_cidr: Optional[str] = "172.17.0.1/16", - outbound_type: Optional[Union[str, "OutboundType"]] = "loadBalancer", - load_balancer_sku: Optional[Union[str, "LoadBalancerSku"]] = None, - load_balancer_profile: Optional["ManagedClusterLoadBalancerProfile"] = None, - nat_gateway_profile: Optional["ManagedClusterNATGatewayProfile"] = None, + outbound_type: Optional[Union[str, "_models.OutboundType"]] = "loadBalancer", + load_balancer_sku: Optional[Union[str, "_models.LoadBalancerSku"]] = None, + load_balancer_profile: Optional["_models.ManagedClusterLoadBalancerProfile"] = None, + nat_gateway_profile: Optional["_models.ManagedClusterNATGatewayProfile"] = None, pod_cidrs: Optional[List[str]] = None, service_cidrs: Optional[List[str]] = None, - ip_families: Optional[List[Union[str, "IpFamily"]]] = None, + ip_families: Optional[List[Union[str, "_models.IpFamily"]]] = None, **kwargs ): """ - :keyword network_plugin: Network plugin used for building the Kubernetes network. Possible - values include: "azure", "kubenet". Default value: "kubenet". + :keyword network_plugin: Network plugin used for building the Kubernetes network. Known values + are: "azure", "kubenet". Default value: "kubenet". :paramtype network_plugin: str or ~azure.mgmt.containerservice.v2021_10_01.models.NetworkPlugin - :keyword network_policy: Network policy used for building the Kubernetes network. Possible - values include: "calico", "azure". + :keyword network_policy: Network policy used for building the Kubernetes network. Known values + are: "calico", "azure". :paramtype network_policy: str or ~azure.mgmt.containerservice.v2021_10_01.models.NetworkPolicy :keyword network_mode: This cannot be specified if networkPlugin is anything other than - 'azure'. Possible values include: "transparent", "bridge". + 'azure'. Known values are: "transparent", "bridge". :paramtype network_mode: str or ~azure.mgmt.containerservice.v2021_10_01.models.NetworkMode :keyword pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :paramtype pod_cidr: str @@ -1154,13 +1154,13 @@ def __init__( :paramtype docker_bridge_cidr: str :keyword outbound_type: This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type - `_. Possible values include: - "loadBalancer", "userDefinedRouting", "managedNATGateway", "userAssignedNATGateway". Default - value: "loadBalancer". + `_. Known values are: "loadBalancer", + "userDefinedRouting", "managedNATGateway", "userAssignedNATGateway". Default value: + "loadBalancer". :paramtype outbound_type: str or ~azure.mgmt.containerservice.v2021_10_01.models.OutboundType :keyword load_balancer_sku: The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the - differences between load balancer SKUs. Possible values include: "standard", "basic". + differences between load balancer SKUs. Known values are: "standard", "basic". :paramtype load_balancer_sku: str or ~azure.mgmt.containerservice.v2021_10_01.models.LoadBalancerSku :keyword load_balancer_profile: Profile of the cluster load balancer. @@ -1220,7 +1220,7 @@ class ContainerServiceSshConfiguration(msrest.serialization.Model): def __init__( self, *, - public_keys: List["ContainerServiceSshPublicKey"], + public_keys: List["_models.ContainerServiceSshPublicKey"], **kwargs ): """ @@ -1408,7 +1408,7 @@ def __init__( self, *, domain_name: Optional[str] = None, - endpoint_details: Optional[List["EndpointDetail"]] = None, + endpoint_details: Optional[List["_models.EndpointDetail"]] = None, **kwargs ): """ @@ -1474,7 +1474,7 @@ class ExtendedLocation(msrest.serialization.Model): :ivar name: The name of the extended location. :vartype name: str - :ivar type: The type of the extended location. Possible values include: "EdgeZone". + :ivar type: The type of the extended location. Known values are: "EdgeZone". :vartype type: str or ~azure.mgmt.containerservice.v2021_10_01.models.ExtendedLocationTypes """ @@ -1487,13 +1487,13 @@ def __init__( self, *, name: Optional[str] = None, - type: Optional[Union[str, "ExtendedLocationTypes"]] = None, + type: Optional[Union[str, "_models.ExtendedLocationTypes"]] = None, **kwargs ): """ :keyword name: The name of the extended location. :paramtype name: str - :keyword type: The type of the extended location. Possible values include: "EdgeZone". + :keyword type: The type of the extended location. Known values are: "EdgeZone". :paramtype type: str or ~azure.mgmt.containerservice.v2021_10_01.models.ExtendedLocationTypes """ super(ExtendedLocation, self).__init__(**kwargs) @@ -1652,7 +1652,7 @@ class LinuxOSConfig(msrest.serialization.Model): def __init__( self, *, - sysctls: Optional["SysctlConfig"] = None, + sysctls: Optional["_models.SysctlConfig"] = None, transparent_huge_page_enabled: Optional[str] = None, transparent_huge_page_defrag: Optional[str] = None, swap_file_size_mb: Optional[int] = None, @@ -1720,8 +1720,8 @@ class MaintenanceConfiguration(SubResource): def __init__( self, *, - time_in_week: Optional[List["TimeInWeek"]] = None, - not_allowed_time: Optional[List["TimeSpan"]] = None, + time_in_week: Optional[List["_models.TimeInWeek"]] = None, + not_allowed_time: Optional[List["_models.TimeSpan"]] = None, **kwargs ): """ @@ -1760,7 +1760,7 @@ class MaintenanceConfigurationListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["MaintenanceConfiguration"]] = None, + value: Optional[List["_models.MaintenanceConfiguration"]] = None, **kwargs ): """ @@ -1938,8 +1938,8 @@ class ManagedCluster(Resource): :ivar security_profile: Security profile for the managed cluster. :vartype security_profile: ~azure.mgmt.containerservice.v2021_10_01.models.ManagedClusterSecurityProfile - :ivar public_network_access: Allow or deny public network access for AKS. Possible values - include: "Enabled", "Disabled". + :ivar public_network_access: Allow or deny public network access for AKS. Known values are: + "Enabled", "Disabled". :vartype public_network_access: str or ~azure.mgmt.containerservice.v2021_10_01.models.PublicNetworkAccess """ @@ -2003,33 +2003,33 @@ def __init__( *, location: str, tags: Optional[Dict[str, str]] = None, - sku: Optional["ManagedClusterSKU"] = None, - extended_location: Optional["ExtendedLocation"] = None, - identity: Optional["ManagedClusterIdentity"] = None, + sku: Optional["_models.ManagedClusterSKU"] = None, + extended_location: Optional["_models.ExtendedLocation"] = None, + identity: Optional["_models.ManagedClusterIdentity"] = None, kubernetes_version: Optional[str] = None, dns_prefix: Optional[str] = None, fqdn_subdomain: Optional[str] = None, - agent_pool_profiles: Optional[List["ManagedClusterAgentPoolProfile"]] = None, - linux_profile: Optional["ContainerServiceLinuxProfile"] = None, - windows_profile: Optional["ManagedClusterWindowsProfile"] = None, - service_principal_profile: Optional["ManagedClusterServicePrincipalProfile"] = None, - addon_profiles: Optional[Dict[str, "ManagedClusterAddonProfile"]] = None, - pod_identity_profile: Optional["ManagedClusterPodIdentityProfile"] = None, + agent_pool_profiles: Optional[List["_models.ManagedClusterAgentPoolProfile"]] = None, + linux_profile: Optional["_models.ContainerServiceLinuxProfile"] = None, + windows_profile: Optional["_models.ManagedClusterWindowsProfile"] = None, + service_principal_profile: Optional["_models.ManagedClusterServicePrincipalProfile"] = None, + addon_profiles: Optional[Dict[str, "_models.ManagedClusterAddonProfile"]] = None, + pod_identity_profile: Optional["_models.ManagedClusterPodIdentityProfile"] = None, node_resource_group: Optional[str] = None, enable_rbac: Optional[bool] = None, enable_pod_security_policy: Optional[bool] = None, - network_profile: Optional["ContainerServiceNetworkProfile"] = None, - aad_profile: Optional["ManagedClusterAADProfile"] = None, - auto_upgrade_profile: Optional["ManagedClusterAutoUpgradeProfile"] = None, - auto_scaler_profile: Optional["ManagedClusterPropertiesAutoScalerProfile"] = None, - api_server_access_profile: Optional["ManagedClusterAPIServerAccessProfile"] = None, + network_profile: Optional["_models.ContainerServiceNetworkProfile"] = None, + aad_profile: Optional["_models.ManagedClusterAADProfile"] = None, + auto_upgrade_profile: Optional["_models.ManagedClusterAutoUpgradeProfile"] = None, + auto_scaler_profile: Optional["_models.ManagedClusterPropertiesAutoScalerProfile"] = None, + api_server_access_profile: Optional["_models.ManagedClusterAPIServerAccessProfile"] = None, disk_encryption_set_id: Optional[str] = None, - identity_profile: Optional[Dict[str, "UserAssignedIdentity"]] = None, - private_link_resources: Optional[List["PrivateLinkResource"]] = None, + identity_profile: Optional[Dict[str, "_models.UserAssignedIdentity"]] = None, + private_link_resources: Optional[List["_models.PrivateLinkResource"]] = None, disable_local_accounts: Optional[bool] = None, - http_proxy_config: Optional["ManagedClusterHTTPProxyConfig"] = None, - security_profile: Optional["ManagedClusterSecurityProfile"] = None, - public_network_access: Optional[Union[str, "PublicNetworkAccess"]] = None, + http_proxy_config: Optional["_models.ManagedClusterHTTPProxyConfig"] = None, + security_profile: Optional["_models.ManagedClusterSecurityProfile"] = None, + public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None, **kwargs ): """ @@ -2118,8 +2118,8 @@ def __init__( :keyword security_profile: Security profile for the managed cluster. :paramtype security_profile: ~azure.mgmt.containerservice.v2021_10_01.models.ManagedClusterSecurityProfile - :keyword public_network_access: Allow or deny public network access for AKS. Possible values - include: "Enabled", "Disabled". + :keyword public_network_access: Allow or deny public network access for AKS. Known values are: + "Enabled", "Disabled". :paramtype public_network_access: str or ~azure.mgmt.containerservice.v2021_10_01.models.PublicNetworkAccess """ @@ -2428,15 +2428,15 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS - `_. Possible values - include: "Managed", "Ephemeral". + `_. Known values are: + "Managed", "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2021_10_01.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Possible values include: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_10_01.models.KubeletDiskType - :ivar workload_runtime: Determines the type of workload a node can run. Possible values - include: "OCIContainer", "WasmWasi". + :ivar workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer", "WasmWasi". :vartype workload_runtime: str or ~azure.mgmt.containerservice.v2021_10_01.models.WorkloadRuntime :ivar vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and used. @@ -2450,11 +2450,11 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2021_10_01.models.OSType - :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Possible values include: "Ubuntu", "CBLMariner". + :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known + values are: "Ubuntu", "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2021_10_01.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. :vartype max_count: int @@ -2463,15 +2463,14 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it - defaults to Delete. Possible values include: "Delete", "Deallocate". + defaults to Delete. Known values are: "Delete", "Deallocate". :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2021_10_01.models.ScaleDownMode - :ivar type: The type of Agent Pool. Possible values include: "VirtualMachineScaleSets", + :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2021_10_01.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Possible values include: "System", - "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". :vartype mode: str or ~azure.mgmt.containerservice.v2021_10_01.models.AgentPoolMode :ivar orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -2506,12 +2505,12 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Possible values include: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_10_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Possible values include: "Delete", - "Deallocate". Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_10_01.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which @@ -2543,7 +2542,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2021_10_01.models.GPUInstanceProfile :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool @@ -2605,40 +2604,40 @@ def __init__( count: Optional[int] = None, vm_size: Optional[str] = None, os_disk_size_gb: Optional[int] = None, - os_disk_type: Optional[Union[str, "OSDiskType"]] = None, - kubelet_disk_type: Optional[Union[str, "KubeletDiskType"]] = None, - workload_runtime: Optional[Union[str, "WorkloadRuntime"]] = None, + os_disk_type: Optional[Union[str, "_models.OSDiskType"]] = None, + kubelet_disk_type: Optional[Union[str, "_models.KubeletDiskType"]] = None, + workload_runtime: Optional[Union[str, "_models.WorkloadRuntime"]] = None, vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", - os_sku: Optional[Union[str, "OSSKU"]] = None, + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - scale_down_mode: Optional[Union[str, "ScaleDownMode"]] = None, - type: Optional[Union[str, "AgentPoolType"]] = None, - mode: Optional[Union[str, "AgentPoolMode"]] = None, + scale_down_mode: Optional[Union[str, "_models.ScaleDownMode"]] = None, + type: Optional[Union[str, "_models.AgentPoolType"]] = None, + mode: Optional[Union[str, "_models.AgentPoolMode"]] = None, orchestrator_version: Optional[str] = None, - upgrade_settings: Optional["AgentPoolUpgradeSettings"] = None, - power_state: Optional["PowerState"] = None, + upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, + power_state: Optional["_models.PowerState"] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", spot_max_price: Optional[float] = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, proximity_placement_group_id: Optional[str] = None, - kubelet_config: Optional["KubeletConfig"] = None, - linux_os_config: Optional["LinuxOSConfig"] = None, + kubelet_config: Optional["_models.KubeletConfig"] = None, + linux_os_config: Optional["_models.LinuxOSConfig"] = None, enable_encryption_at_host: Optional[bool] = None, enable_ultra_ssd: Optional[bool] = None, enable_fips: Optional[bool] = None, - gpu_instance_profile: Optional[Union[str, "GPUInstanceProfile"]] = None, - creation_data: Optional["CreationData"] = None, + gpu_instance_profile: Optional[Union[str, "_models.GPUInstanceProfile"]] = None, + creation_data: Optional["_models.CreationData"] = None, **kwargs ): """ @@ -2657,15 +2656,15 @@ def __init__( :keyword os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS - `_. Possible values - include: "Managed", "Ephemeral". + `_. Known values are: + "Managed", "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2021_10_01.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Possible values include: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_10_01.models.KubeletDiskType - :keyword workload_runtime: Determines the type of workload a node can run. Possible values - include: "OCIContainer", "WasmWasi". + :keyword workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer", "WasmWasi". :paramtype workload_runtime: str or ~azure.mgmt.containerservice.v2021_10_01.models.WorkloadRuntime :keyword vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and @@ -2679,11 +2678,11 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2021_10_01.models.OSType :keyword os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Possible values include: "Ubuntu", "CBLMariner". + Known values are: "Ubuntu", "CBLMariner". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2021_10_01.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -2692,16 +2691,15 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, - it defaults to Delete. Possible values include: "Delete", "Deallocate". + it defaults to Delete. Known values are: "Delete", "Deallocate". :paramtype scale_down_mode: str or ~azure.mgmt.containerservice.v2021_10_01.models.ScaleDownMode - :keyword type: The type of Agent Pool. Possible values include: "VirtualMachineScaleSets", + :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2021_10_01.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Possible values include: "System", - "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2021_10_01.models.AgentPoolMode :keyword orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -2732,12 +2730,12 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Possible values include: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_10_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Possible values include: "Delete", - "Deallocate". Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_10_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which @@ -2769,7 +2767,7 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2021_10_01.models.GPUInstanceProfile @@ -2841,15 +2839,15 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS - `_. Possible values - include: "Managed", "Ephemeral". + `_. Known values are: + "Managed", "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2021_10_01.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Possible values include: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_10_01.models.KubeletDiskType - :ivar workload_runtime: Determines the type of workload a node can run. Possible values - include: "OCIContainer", "WasmWasi". + :ivar workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer", "WasmWasi". :vartype workload_runtime: str or ~azure.mgmt.containerservice.v2021_10_01.models.WorkloadRuntime :ivar vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and used. @@ -2863,11 +2861,11 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2021_10_01.models.OSType - :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Possible values include: "Ubuntu", "CBLMariner". + :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known + values are: "Ubuntu", "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2021_10_01.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. :vartype max_count: int @@ -2876,15 +2874,14 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it - defaults to Delete. Possible values include: "Delete", "Deallocate". + defaults to Delete. Known values are: "Delete", "Deallocate". :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2021_10_01.models.ScaleDownMode - :ivar type: The type of Agent Pool. Possible values include: "VirtualMachineScaleSets", + :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2021_10_01.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Possible values include: "System", - "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". :vartype mode: str or ~azure.mgmt.containerservice.v2021_10_01.models.AgentPoolMode :ivar orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -2919,12 +2916,12 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Possible values include: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_10_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Possible values include: "Delete", - "Deallocate". Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_10_01.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which @@ -2956,7 +2953,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2021_10_01.models.GPUInstanceProfile :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool @@ -3023,40 +3020,40 @@ def __init__( count: Optional[int] = None, vm_size: Optional[str] = None, os_disk_size_gb: Optional[int] = None, - os_disk_type: Optional[Union[str, "OSDiskType"]] = None, - kubelet_disk_type: Optional[Union[str, "KubeletDiskType"]] = None, - workload_runtime: Optional[Union[str, "WorkloadRuntime"]] = None, + os_disk_type: Optional[Union[str, "_models.OSDiskType"]] = None, + kubelet_disk_type: Optional[Union[str, "_models.KubeletDiskType"]] = None, + workload_runtime: Optional[Union[str, "_models.WorkloadRuntime"]] = None, vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", - os_sku: Optional[Union[str, "OSSKU"]] = None, + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - scale_down_mode: Optional[Union[str, "ScaleDownMode"]] = None, - type: Optional[Union[str, "AgentPoolType"]] = None, - mode: Optional[Union[str, "AgentPoolMode"]] = None, + scale_down_mode: Optional[Union[str, "_models.ScaleDownMode"]] = None, + type: Optional[Union[str, "_models.AgentPoolType"]] = None, + mode: Optional[Union[str, "_models.AgentPoolMode"]] = None, orchestrator_version: Optional[str] = None, - upgrade_settings: Optional["AgentPoolUpgradeSettings"] = None, - power_state: Optional["PowerState"] = None, + upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, + power_state: Optional["_models.PowerState"] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", spot_max_price: Optional[float] = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, proximity_placement_group_id: Optional[str] = None, - kubelet_config: Optional["KubeletConfig"] = None, - linux_os_config: Optional["LinuxOSConfig"] = None, + kubelet_config: Optional["_models.KubeletConfig"] = None, + linux_os_config: Optional["_models.LinuxOSConfig"] = None, enable_encryption_at_host: Optional[bool] = None, enable_ultra_ssd: Optional[bool] = None, enable_fips: Optional[bool] = None, - gpu_instance_profile: Optional[Union[str, "GPUInstanceProfile"]] = None, - creation_data: Optional["CreationData"] = None, + gpu_instance_profile: Optional[Union[str, "_models.GPUInstanceProfile"]] = None, + creation_data: Optional["_models.CreationData"] = None, **kwargs ): """ @@ -3075,15 +3072,15 @@ def __init__( :keyword os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS - `_. Possible values - include: "Managed", "Ephemeral". + `_. Known values are: + "Managed", "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2021_10_01.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Possible values include: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_10_01.models.KubeletDiskType - :keyword workload_runtime: Determines the type of workload a node can run. Possible values - include: "OCIContainer", "WasmWasi". + :keyword workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer", "WasmWasi". :paramtype workload_runtime: str or ~azure.mgmt.containerservice.v2021_10_01.models.WorkloadRuntime :keyword vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and @@ -3097,11 +3094,11 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2021_10_01.models.OSType :keyword os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Possible values include: "Ubuntu", "CBLMariner". + Known values are: "Ubuntu", "CBLMariner". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2021_10_01.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -3110,16 +3107,15 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, - it defaults to Delete. Possible values include: "Delete", "Deallocate". + it defaults to Delete. Known values are: "Delete", "Deallocate". :paramtype scale_down_mode: str or ~azure.mgmt.containerservice.v2021_10_01.models.ScaleDownMode - :keyword type: The type of Agent Pool. Possible values include: "VirtualMachineScaleSets", + :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2021_10_01.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Possible values include: "System", - "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2021_10_01.models.AgentPoolMode :keyword orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -3150,12 +3146,12 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Possible values include: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_10_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Possible values include: "Delete", - "Deallocate". Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_10_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which @@ -3187,7 +3183,7 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2021_10_01.models.GPUInstanceProfile @@ -3272,8 +3268,8 @@ class ManagedClusterAutoUpgradeProfile(msrest.serialization.Model): """Auto upgrade profile for a managed cluster. :ivar upgrade_channel: For more information see `setting the AKS cluster auto-upgrade channel - `_. Possible - values include: "rapid", "stable", "patch", "node-image", "none". + `_. Known values + are: "rapid", "stable", "patch", "node-image", "none". :vartype upgrade_channel: str or ~azure.mgmt.containerservice.v2021_10_01.models.UpgradeChannel """ @@ -3284,13 +3280,13 @@ class ManagedClusterAutoUpgradeProfile(msrest.serialization.Model): def __init__( self, *, - upgrade_channel: Optional[Union[str, "UpgradeChannel"]] = None, + upgrade_channel: Optional[Union[str, "_models.UpgradeChannel"]] = None, **kwargs ): """ :keyword upgrade_channel: For more information see `setting the AKS cluster auto-upgrade channel `_. - Possible values include: "rapid", "stable", "patch", "node-image", "none". + Known values are: "rapid", "stable", "patch", "node-image", "none". :paramtype upgrade_channel: str or ~azure.mgmt.containerservice.v2021_10_01.models.UpgradeChannel """ @@ -3356,7 +3352,7 @@ class ManagedClusterIdentity(msrest.serialization.Model): components. :vartype tenant_id: str :ivar type: For more information see `use managed identities in AKS - `_. Possible values include: + `_. Known values are: "SystemAssigned", "UserAssigned", "None". :vartype type: str or ~azure.mgmt.containerservice.v2021_10_01.models.ResourceIdentityType :ivar user_assigned_identities: The keys must be ARM resource IDs in the form: @@ -3380,13 +3376,13 @@ class ManagedClusterIdentity(msrest.serialization.Model): def __init__( self, *, - type: Optional[Union[str, "ResourceIdentityType"]] = None, - user_assigned_identities: Optional[Dict[str, "ManagedServiceIdentityUserAssignedIdentitiesValue"]] = None, + type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, + user_assigned_identities: Optional[Dict[str, "_models.ManagedServiceIdentityUserAssignedIdentitiesValue"]] = None, **kwargs ): """ :keyword type: For more information see `use managed identities in AKS - `_. Possible values include: + `_. Known values are: "SystemAssigned", "UserAssigned", "None". :paramtype type: str or ~azure.mgmt.containerservice.v2021_10_01.models.ResourceIdentityType :keyword user_assigned_identities: The keys must be ARM resource IDs in the form: @@ -3424,7 +3420,7 @@ class ManagedClusterListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["ManagedCluster"]] = None, + value: Optional[List["_models.ManagedCluster"]] = None, **kwargs ): """ @@ -3482,10 +3478,10 @@ class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): def __init__( self, *, - managed_outbound_i_ps: Optional["ManagedClusterLoadBalancerProfileManagedOutboundIPs"] = None, - outbound_ip_prefixes: Optional["ManagedClusterLoadBalancerProfileOutboundIPPrefixes"] = None, - outbound_i_ps: Optional["ManagedClusterLoadBalancerProfileOutboundIPs"] = None, - effective_outbound_i_ps: Optional[List["ResourceReference"]] = None, + managed_outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileManagedOutboundIPs"] = None, + outbound_ip_prefixes: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPPrefixes"] = None, + outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPs"] = None, + effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, allocated_outbound_ports: Optional[int] = 0, idle_timeout_in_minutes: Optional[int] = 30, enable_multiple_standard_load_balancers: Optional[bool] = None, @@ -3587,7 +3583,7 @@ class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.M def __init__( self, *, - public_ip_prefixes: Optional[List["ResourceReference"]] = None, + public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, **kwargs ): """ @@ -3613,7 +3609,7 @@ class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): def __init__( self, *, - public_i_ps: Optional[List["ResourceReference"]] = None, + public_i_ps: Optional[List["_models.ResourceReference"]] = None, **kwargs ): """ @@ -3683,8 +3679,8 @@ class ManagedClusterNATGatewayProfile(msrest.serialization.Model): def __init__( self, *, - managed_outbound_ip_profile: Optional["ManagedClusterManagedOutboundIPProfile"] = None, - effective_outbound_i_ps: Optional[List["ResourceReference"]] = None, + managed_outbound_ip_profile: Optional["_models.ManagedClusterManagedOutboundIPProfile"] = None, + effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, idle_timeout_in_minutes: Optional[int] = 4, **kwargs ): @@ -3722,8 +3718,8 @@ class ManagedClusterPodIdentity(msrest.serialization.Model): :vartype binding_selector: str :ivar identity: Required. The user assigned identity details. :vartype identity: ~azure.mgmt.containerservice.v2021_10_01.models.UserAssignedIdentity - :ivar provisioning_state: The current provisioning state of the pod identity. Possible values - include: "Assigned", "Updating", "Deleting", "Failed". + :ivar provisioning_state: The current provisioning state of the pod identity. Known values are: + "Assigned", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2021_10_01.models.ManagedClusterPodIdentityProvisioningState :ivar provisioning_info: @@ -3753,7 +3749,7 @@ def __init__( *, name: str, namespace: str, - identity: "UserAssignedIdentity", + identity: "_models.UserAssignedIdentity", binding_selector: Optional[str] = None, **kwargs ): @@ -3854,8 +3850,8 @@ def __init__( *, enabled: Optional[bool] = None, allow_network_plugin_kubenet: Optional[bool] = None, - user_assigned_identities: Optional[List["ManagedClusterPodIdentity"]] = None, - user_assigned_identity_exceptions: Optional[List["ManagedClusterPodIdentityException"]] = None, + user_assigned_identities: Optional[List["_models.ManagedClusterPodIdentity"]] = None, + user_assigned_identity_exceptions: Optional[List["_models.ManagedClusterPodIdentityException"]] = None, **kwargs ): """ @@ -3896,7 +3892,7 @@ class ManagedClusterPodIdentityProvisioningError(msrest.serialization.Model): def __init__( self, *, - error: Optional["ManagedClusterPodIdentityProvisioningErrorBody"] = None, + error: Optional["_models.ManagedClusterPodIdentityProvisioningErrorBody"] = None, **kwargs ): """ @@ -3938,7 +3934,7 @@ def __init__( code: Optional[str] = None, message: Optional[str] = None, target: Optional[str] = None, - details: Optional[List["ManagedClusterPodIdentityProvisioningErrorBody"]] = None, + details: Optional[List["_models.ManagedClusterPodIdentityProvisioningErrorBody"]] = None, **kwargs ): """ @@ -3977,7 +3973,7 @@ class ManagedClusterPodIdentityProvisioningInfo(msrest.serialization.Model): def __init__( self, *, - error: Optional["ManagedClusterPodIdentityProvisioningError"] = None, + error: Optional["_models.ManagedClusterPodIdentityProvisioningError"] = None, **kwargs ): """ @@ -3998,8 +3994,8 @@ class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): :vartype kubernetes_version: str :ivar name: The Agent Pool name. :vartype name: str - :ivar os_type: Required. The operating system type. The default is Linux. Possible values - include: "Linux", "Windows". Default value: "Linux". + :ivar os_type: Required. The operating system type. The default is Linux. Known values are: + "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2021_10_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -4022,9 +4018,9 @@ def __init__( self, *, kubernetes_version: str, - os_type: Union[str, "OSType"] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", name: Optional[str] = None, - upgrades: Optional[List["ManagedClusterPoolUpgradeProfileUpgradesItem"]] = None, + upgrades: Optional[List["_models.ManagedClusterPoolUpgradeProfileUpgradesItem"]] = None, **kwargs ): """ @@ -4032,8 +4028,8 @@ def __init__( :paramtype kubernetes_version: str :keyword name: The Agent Pool name. :paramtype name: str - :keyword os_type: Required. The operating system type. The default is Linux. Possible values - include: "Linux", "Windows". Default value: "Linux". + :keyword os_type: Required. The operating system type. The default is Linux. Known values are: + "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2021_10_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: @@ -4085,8 +4081,7 @@ class ManagedClusterPropertiesAutoScalerProfile(msrest.serialization.Model): :vartype balance_similar_node_groups: str :ivar expander: If not specified, the default is 'random'. See `expanders `_ - for more information. Possible values include: "least-waste", "most-pods", "priority", - "random". + for more information. Known values are: "least-waste", "most-pods", "priority", "random". :vartype expander: str or ~azure.mgmt.containerservice.v2021_10_01.models.Expander :ivar max_empty_bulk_delete: The default is 10. :vartype max_empty_bulk_delete: str @@ -4153,7 +4148,7 @@ def __init__( self, *, balance_similar_node_groups: Optional[str] = None, - expander: Optional[Union[str, "Expander"]] = None, + expander: Optional[Union[str, "_models.Expander"]] = None, max_empty_bulk_delete: Optional[str] = None, max_graceful_termination_sec: Optional[str] = None, max_node_provision_time: Optional[str] = None, @@ -4176,8 +4171,7 @@ def __init__( :paramtype balance_similar_node_groups: str :keyword expander: If not specified, the default is 'random'. See `expanders `_ - for more information. Possible values include: "least-waste", "most-pods", "priority", - "random". + for more information. Known values are: "least-waste", "most-pods", "priority", "random". :paramtype expander: str or ~azure.mgmt.containerservice.v2021_10_01.models.Expander :keyword max_empty_bulk_delete: The default is 10. :paramtype max_empty_bulk_delete: str @@ -4255,7 +4249,7 @@ class ManagedClusterSecurityProfile(msrest.serialization.Model): def __init__( self, *, - azure_defender: Optional["ManagedClusterSecurityProfileAzureDefender"] = None, + azure_defender: Optional["_models.ManagedClusterSecurityProfileAzureDefender"] = None, **kwargs ): """ @@ -4346,11 +4340,11 @@ def __init__( class ManagedClusterSKU(msrest.serialization.Model): """The SKU of a Managed Cluster. - :ivar name: The name of a managed cluster SKU. Possible values include: "Basic". + :ivar name: The name of a managed cluster SKU. Known values are: "Basic". :vartype name: str or ~azure.mgmt.containerservice.v2021_10_01.models.ManagedClusterSKUName :ivar tier: If not specified, the default is 'Free'. See `uptime SLA - `_ for more details. Possible values include: - "Paid", "Free". + `_ for more details. Known values are: "Paid", + "Free". :vartype tier: str or ~azure.mgmt.containerservice.v2021_10_01.models.ManagedClusterSKUTier """ @@ -4362,16 +4356,16 @@ class ManagedClusterSKU(msrest.serialization.Model): def __init__( self, *, - name: Optional[Union[str, "ManagedClusterSKUName"]] = None, - tier: Optional[Union[str, "ManagedClusterSKUTier"]] = None, + name: Optional[Union[str, "_models.ManagedClusterSKUName"]] = None, + tier: Optional[Union[str, "_models.ManagedClusterSKUTier"]] = None, **kwargs ): """ - :keyword name: The name of a managed cluster SKU. Possible values include: "Basic". + :keyword name: The name of a managed cluster SKU. Known values are: "Basic". :paramtype name: str or ~azure.mgmt.containerservice.v2021_10_01.models.ManagedClusterSKUName :keyword tier: If not specified, the default is 'Free'. See `uptime SLA - `_ for more details. Possible values include: - "Paid", "Free". + `_ for more details. Known values are: "Paid", + "Free". :paramtype tier: str or ~azure.mgmt.containerservice.v2021_10_01.models.ManagedClusterSKUTier """ super(ManagedClusterSKU, self).__init__(**kwargs) @@ -4420,8 +4414,8 @@ class ManagedClusterUpgradeProfile(msrest.serialization.Model): def __init__( self, *, - control_plane_profile: "ManagedClusterPoolUpgradeProfile", - agent_pool_profiles: List["ManagedClusterPoolUpgradeProfile"], + control_plane_profile: "_models.ManagedClusterPoolUpgradeProfile", + agent_pool_profiles: List["_models.ManagedClusterPoolUpgradeProfile"], **kwargs ): """ @@ -4463,8 +4457,8 @@ class ManagedClusterWindowsProfile(msrest.serialization.Model): "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!". :vartype admin_password: str :ivar license_type: The license type to use for Windows VMs. See `Azure Hybrid User Benefits - `_ for more details. Possible values - include: "None", "Windows_Server". + `_ for more details. Known values are: + "None", "Windows_Server". :vartype license_type: str or ~azure.mgmt.containerservice.v2021_10_01.models.LicenseType :ivar enable_csi_proxy: For more details on CSI proxy, see the `CSI proxy GitHub repo `_. @@ -4490,9 +4484,9 @@ def __init__( *, admin_username: str, admin_password: Optional[str] = None, - license_type: Optional[Union[str, "LicenseType"]] = None, + license_type: Optional[Union[str, "_models.LicenseType"]] = None, enable_csi_proxy: Optional[bool] = None, - gmsa_profile: Optional["WindowsGmsaProfile"] = None, + gmsa_profile: Optional["_models.WindowsGmsaProfile"] = None, **kwargs ): """ @@ -4513,8 +4507,8 @@ def __init__( "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!". :paramtype admin_password: str :keyword license_type: The license type to use for Windows VMs. See `Azure Hybrid User Benefits - `_ for more details. Possible values - include: "None", "Windows_Server". + `_ for more details. Known values are: + "None", "Windows_Server". :paramtype license_type: str or ~azure.mgmt.containerservice.v2021_10_01.models.LicenseType :keyword enable_csi_proxy: For more details on CSI proxy, see the `CSI proxy GitHub repo `_. @@ -4676,7 +4670,7 @@ class OSOptionProfile(msrest.serialization.Model): def __init__( self, *, - os_option_property_list: List["OSOptionProperty"], + os_option_property_list: List["_models.OSOptionProperty"], **kwargs ): """ @@ -4749,7 +4743,7 @@ def __init__( self, *, category: Optional[str] = None, - endpoints: Optional[List["EndpointDependency"]] = None, + endpoints: Optional[List["_models.EndpointDependency"]] = None, **kwargs ): """ @@ -4791,7 +4785,7 @@ class OutboundEnvironmentEndpointCollection(msrest.serialization.Model): def __init__( self, *, - value: List["OutboundEnvironmentEndpoint"], + value: List["_models.OutboundEnvironmentEndpoint"], **kwargs ): """ @@ -4807,8 +4801,8 @@ def __init__( class PowerState(msrest.serialization.Model): """Describes the Power State of the cluster. - :ivar code: Tells whether the cluster is Running or Stopped. Possible values include: - "Running", "Stopped". + :ivar code: Tells whether the cluster is Running or Stopped. Known values are: "Running", + "Stopped". :vartype code: str or ~azure.mgmt.containerservice.v2021_10_01.models.Code """ @@ -4819,12 +4813,12 @@ class PowerState(msrest.serialization.Model): def __init__( self, *, - code: Optional[Union[str, "Code"]] = None, + code: Optional[Union[str, "_models.Code"]] = None, **kwargs ): """ - :keyword code: Tells whether the cluster is Running or Stopped. Possible values include: - "Running", "Stopped". + :keyword code: Tells whether the cluster is Running or Stopped. Known values are: "Running", + "Stopped". :paramtype code: str or ~azure.mgmt.containerservice.v2021_10_01.models.Code """ super(PowerState, self).__init__(**kwargs) @@ -4867,7 +4861,7 @@ class PrivateEndpointConnection(msrest.serialization.Model): :vartype name: str :ivar type: The resource type. :vartype type: str - :ivar provisioning_state: The current provisioning state. Possible values include: "Succeeded", + :ivar provisioning_state: The current provisioning state. Known values are: "Succeeded", "Creating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2021_10_01.models.PrivateEndpointConnectionProvisioningState @@ -4898,8 +4892,8 @@ class PrivateEndpointConnection(msrest.serialization.Model): def __init__( self, *, - private_endpoint: Optional["PrivateEndpoint"] = None, - private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, + private_endpoint: Optional["_models.PrivateEndpoint"] = None, + private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionState"] = None, **kwargs ): """ @@ -4933,7 +4927,7 @@ class PrivateEndpointConnectionListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["PrivateEndpointConnection"]] = None, + value: Optional[List["_models.PrivateEndpointConnection"]] = None, **kwargs ): """ @@ -5023,7 +5017,7 @@ class PrivateLinkResourcesListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["PrivateLinkResource"]] = None, + value: Optional[List["_models.PrivateLinkResource"]] = None, **kwargs ): """ @@ -5037,7 +5031,7 @@ def __init__( class PrivateLinkServiceConnectionState(msrest.serialization.Model): """The state of a private link service connection. - :ivar status: The private link service connection status. Possible values include: "Pending", + :ivar status: The private link service connection status. Known values are: "Pending", "Approved", "Rejected", "Disconnected". :vartype status: str or ~azure.mgmt.containerservice.v2021_10_01.models.ConnectionStatus :ivar description: The private link service connection description. @@ -5052,13 +5046,13 @@ class PrivateLinkServiceConnectionState(msrest.serialization.Model): def __init__( self, *, - status: Optional[Union[str, "ConnectionStatus"]] = None, + status: Optional[Union[str, "_models.ConnectionStatus"]] = None, description: Optional[str] = None, **kwargs ): """ - :keyword status: The private link service connection status. Possible values include: - "Pending", "Approved", "Rejected", "Disconnected". + :keyword status: The private link service connection status. Known values are: "Pending", + "Approved", "Rejected", "Disconnected". :paramtype status: str or ~azure.mgmt.containerservice.v2021_10_01.models.ConnectionStatus :keyword description: The private link service connection description. :paramtype description: str @@ -5217,18 +5211,18 @@ class Snapshot(Resource): :ivar creation_data: CreationData to be used to specify the source agent pool resource ID to create this snapshot. :vartype creation_data: ~azure.mgmt.containerservice.v2021_10_01.models.CreationData - :ivar snapshot_type: The type of a snapshot. The default is NodePool. Possible values include: + :ivar snapshot_type: The type of a snapshot. The default is NodePool. Known values are: "NodePool". Default value: "NodePool". :vartype snapshot_type: str or ~azure.mgmt.containerservice.v2021_10_01.models.SnapshotType :ivar kubernetes_version: The version of Kubernetes. :vartype kubernetes_version: str :ivar node_image_version: The version of node image. :vartype node_image_version: str - :ivar os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2021_10_01.models.OSType - :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Possible values include: "Ubuntu", "CBLMariner". + :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known + values are: "Ubuntu", "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2021_10_01.models.OSSKU :ivar vm_size: The size of the VM. :vartype vm_size: str @@ -5272,8 +5266,8 @@ def __init__( *, location: str, tags: Optional[Dict[str, str]] = None, - creation_data: Optional["CreationData"] = None, - snapshot_type: Optional[Union[str, "SnapshotType"]] = "NodePool", + creation_data: Optional["_models.CreationData"] = None, + snapshot_type: Optional[Union[str, "_models.SnapshotType"]] = "NodePool", **kwargs ): """ @@ -5284,8 +5278,8 @@ def __init__( :keyword creation_data: CreationData to be used to specify the source agent pool resource ID to create this snapshot. :paramtype creation_data: ~azure.mgmt.containerservice.v2021_10_01.models.CreationData - :keyword snapshot_type: The type of a snapshot. The default is NodePool. Possible values - include: "NodePool". Default value: "NodePool". + :keyword snapshot_type: The type of a snapshot. The default is NodePool. Known values are: + "NodePool". Default value: "NodePool". :paramtype snapshot_type: str or ~azure.mgmt.containerservice.v2021_10_01.models.SnapshotType """ super(Snapshot, self).__init__(location=location, tags=tags, **kwargs) @@ -5323,7 +5317,7 @@ class SnapshotListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["Snapshot"]] = None, + value: Optional[List["_models.Snapshot"]] = None, **kwargs ): """ @@ -5554,15 +5548,15 @@ class SystemData(msrest.serialization.Model): :ivar created_by: The identity that created the resource. :vartype created_by: str - :ivar created_by_type: The type of identity that created the resource. Possible values include: + :ivar created_by_type: The type of identity that created the resource. Known values are: "User", "Application", "ManagedIdentity", "Key". :vartype created_by_type: str or ~azure.mgmt.containerservice.v2021_10_01.models.CreatedByType :ivar created_at: The UTC timestamp of resource creation. :vartype created_at: ~datetime.datetime :ivar last_modified_by: The identity that last modified the resource. :vartype last_modified_by: str - :ivar last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". + :ivar last_modified_by_type: The type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", "Key". :vartype last_modified_by_type: str or ~azure.mgmt.containerservice.v2021_10_01.models.CreatedByType :ivar last_modified_at: The type of identity that last modified the resource. @@ -5582,26 +5576,26 @@ def __init__( self, *, created_by: Optional[str] = None, - created_by_type: Optional[Union[str, "CreatedByType"]] = None, + created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, created_at: Optional[datetime.datetime] = None, last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[Union[str, "CreatedByType"]] = None, + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, last_modified_at: Optional[datetime.datetime] = None, **kwargs ): """ :keyword created_by: The identity that created the resource. :paramtype created_by: str - :keyword created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". + :keyword created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", "Key". :paramtype created_by_type: str or ~azure.mgmt.containerservice.v2021_10_01.models.CreatedByType :keyword created_at: The UTC timestamp of resource creation. :paramtype created_at: ~datetime.datetime :keyword last_modified_by: The identity that last modified the resource. :paramtype last_modified_by: str - :keyword last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". + :keyword last_modified_by_type: The type of identity that last modified the resource. Known + values are: "User", "Application", "ManagedIdentity", "Key". :paramtype last_modified_by_type: str or ~azure.mgmt.containerservice.v2021_10_01.models.CreatedByType :keyword last_modified_at: The type of identity that last modified the resource. @@ -5644,8 +5638,8 @@ def __init__( class TimeInWeek(msrest.serialization.Model): """Time in a week. - :ivar day: The day of the week. Possible values include: "Sunday", "Monday", "Tuesday", - "Wednesday", "Thursday", "Friday", "Saturday". + :ivar day: The day of the week. Known values are: "Sunday", "Monday", "Tuesday", "Wednesday", + "Thursday", "Friday", "Saturday". :vartype day: str or ~azure.mgmt.containerservice.v2021_10_01.models.WeekDay :ivar hour_slots: Each integer hour represents a time range beginning at 0m after the hour ending at the next hour (non-inclusive). 0 corresponds to 00:00 UTC, 23 corresponds to 23:00 @@ -5661,12 +5655,12 @@ class TimeInWeek(msrest.serialization.Model): def __init__( self, *, - day: Optional[Union[str, "WeekDay"]] = None, + day: Optional[Union[str, "_models.WeekDay"]] = None, hour_slots: Optional[List[int]] = None, **kwargs ): """ - :keyword day: The day of the week. Possible values include: "Sunday", "Monday", "Tuesday", + :keyword day: The day of the week. Known values are: "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday". :paramtype day: str or ~azure.mgmt.containerservice.v2021_10_01.models.WeekDay :keyword hour_slots: Each integer hour represents a time range beginning at 0m after the hour diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/models/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/models/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/operations/__init__.py index 5e1e5e72fa59..e0748876288c 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/operations/__init__.py @@ -15,6 +15,9 @@ from ._resolve_private_link_service_id_operations import ResolvePrivateLinkServiceIdOperations from ._snapshots_operations import SnapshotsOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'Operations', 'ManagedClustersOperations', @@ -25,3 +28,5 @@ 'ResolvePrivateLinkServiceIdOperations', 'SnapshotsOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/operations/_agent_pools_operations.py index 661aad09e448..993f4cee3cf5 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/operations/_agent_pools_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -35,9 +35,12 @@ def build_list_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools") # pylint: disable=line-too-long path_format_arguments = { @@ -49,18 +52,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -72,9 +73,12 @@ def build_get_request( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -87,18 +91,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -109,14 +111,17 @@ def build_create_or_update_request_initial( resource_name: str, agent_pool_name: str, *, - json: JSONType = None, + json: Optional[_models.AgentPool] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -129,20 +134,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -156,9 +159,12 @@ def build_delete_request_initial( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -171,18 +177,16 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -194,9 +198,12 @@ def build_get_upgrade_profile_request( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default") # pylint: disable=line-too-long path_format_arguments = { @@ -209,18 +216,16 @@ def build_get_upgrade_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -231,9 +236,12 @@ def build_get_available_agent_pool_versions_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions") # pylint: disable=line-too-long path_format_arguments = { @@ -245,18 +253,16 @@ def build_get_available_agent_pool_versions_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -268,9 +274,12 @@ def build_upgrade_node_image_version_request_initial( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion") # pylint: disable=line-too-long path_format_arguments = { @@ -283,42 +292,38 @@ def build_upgrade_node_image_version_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class AgentPoolsOperations(object): - """AgentPoolsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class AgentPoolsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_10_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_10_01.ContainerServiceClient`'s + :attr:`agent_pools` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -326,7 +331,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Iterable["_models.AgentPoolListResult"]: + ) -> Iterable[_models.AgentPoolListResult]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. @@ -341,13 +346,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_10_01.models.AgentPoolListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -357,9 +365,11 @@ def prepare_request(next_link=None): resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -369,9 +379,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -411,7 +423,7 @@ def get( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPool": + ) -> _models.AgentPool: """Gets the specified managed cluster agent pool. Gets the specified managed cluster agent pool. @@ -427,13 +439,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.AgentPool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] request = build_get_request( @@ -443,11 +458,13 @@ def get( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -473,17 +490,20 @@ def _create_or_update_initial( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> "_models.AgentPool": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] + ) -> _models.AgentPool: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] _json = self._serialize.body(parameters, 'AgentPool') @@ -496,11 +516,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -531,9 +553,9 @@ def begin_create_or_update( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> LROPoller["_models.AgentPool"]: + ) -> LROPoller[_models.AgentPool]: """Creates or updates an agent pool in the specified managed cluster. Creates or updates an agent pool in the specified managed cluster. @@ -559,17 +581,20 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_10_01.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, @@ -577,20 +602,27 @@ def begin_create_or_update( 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): - response = pipeline_response.http_response deserialized = self._deserialize('AgentPool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -610,13 +642,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements agent_pool_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -626,11 +661,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -677,21 +714,26 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-10-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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) @@ -701,8 +743,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -722,7 +770,7 @@ def get_upgrade_profile( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPoolUpgradeProfile": + ) -> _models.AgentPoolUpgradeProfile: """Gets the upgrade profile for an agent pool. Gets the upgrade profile for an agent pool. @@ -738,13 +786,16 @@ def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.AgentPoolUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] request = build_get_upgrade_profile_request( @@ -754,11 +805,13 @@ def get_upgrade_profile( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -785,7 +838,7 @@ def get_available_agent_pool_versions( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.AgentPoolAvailableVersions": + ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported Kubernetes versions for the specified agent pool. See `supported Kubernetes versions @@ -801,13 +854,16 @@ def get_available_agent_pool_versions( :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.AgentPoolAvailableVersions :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolAvailableVersions"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] request = build_get_available_agent_pool_versions_request( @@ -816,11 +872,13 @@ def get_available_agent_pool_versions( resource_name=resource_name, api_version=api_version, template_url=self.get_available_agent_pool_versions.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -847,14 +905,17 @@ def _upgrade_node_image_version_initial( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> Optional["_models.AgentPool"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.AgentPool"]] + ) -> Optional[_models.AgentPool]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] request = build_upgrade_node_image_version_request_initial( @@ -864,11 +925,13 @@ def _upgrade_node_image_version_initial( agent_pool_name=agent_pool_name, api_version=api_version, template_url=self._upgrade_node_image_version_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -901,7 +964,7 @@ def begin_upgrade_node_image_version( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> LROPoller["_models.AgentPool"]: + ) -> LROPoller[_models.AgentPool]: """Upgrades the node image version of an agent pool to the latest. Upgrading the node image version of an agent pool applies the newest OS and runtime updates to @@ -927,21 +990,26 @@ def begin_upgrade_node_image_version( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_10_01.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._upgrade_node_image_version_initial( + raw_result = self._upgrade_node_image_version_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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) @@ -957,8 +1025,14 @@ def get_long_running_output(pipeline_response): return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/operations/_maintenance_configurations_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/operations/_maintenance_configurations_operations.py index c7a6b0b8c85a..355728263588 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/operations/_maintenance_configurations_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/operations/_maintenance_configurations_operations.py @@ -16,12 +16,12 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -33,9 +33,12 @@ def build_list_by_managed_cluster_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations") # pylint: disable=line-too-long path_format_arguments = { @@ -47,18 +50,16 @@ def build_list_by_managed_cluster_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -70,9 +71,12 @@ def build_get_request( config_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long path_format_arguments = { @@ -85,18 +89,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -107,14 +109,17 @@ def build_create_or_update_request( resource_name: str, config_name: str, *, - json: JSONType = None, + json: Optional[_models.MaintenanceConfiguration] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long path_format_arguments = { @@ -127,20 +132,18 @@ def build_create_or_update_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -154,9 +157,12 @@ def build_delete_request( config_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long path_format_arguments = { @@ -169,42 +175,38 @@ def build_delete_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class MaintenanceConfigurationsOperations(object): - """MaintenanceConfigurationsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class MaintenanceConfigurationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_10_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_10_01.ContainerServiceClient`'s + :attr:`maintenance_configurations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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_by_managed_cluster( @@ -212,7 +214,7 @@ def list_by_managed_cluster( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Iterable["_models.MaintenanceConfigurationListResult"]: + ) -> Iterable[_models.MaintenanceConfigurationListResult]: """Gets a list of maintenance configurations in the specified managed cluster. Gets a list of maintenance configurations in the specified managed cluster. @@ -228,13 +230,16 @@ def list_by_managed_cluster( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_10_01.models.MaintenanceConfigurationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfigurationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfigurationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -244,9 +249,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=self.list_by_managed_cluster.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -256,9 +263,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -298,7 +307,7 @@ def get( resource_name: str, config_name: str, **kwargs: Any - ) -> "_models.MaintenanceConfiguration": + ) -> _models.MaintenanceConfiguration: """Gets the specified maintenance configuration of a managed cluster. Gets the specified maintenance configuration of a managed cluster. @@ -314,13 +323,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.MaintenanceConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfiguration"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] request = build_get_request( @@ -330,11 +342,13 @@ def get( config_name=config_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -361,9 +375,9 @@ def create_or_update( resource_group_name: str, resource_name: str, config_name: str, - parameters: "_models.MaintenanceConfiguration", + parameters: _models.MaintenanceConfiguration, **kwargs: Any - ) -> "_models.MaintenanceConfiguration": + ) -> _models.MaintenanceConfiguration: """Creates or updates a maintenance configuration in the specified managed cluster. Creates or updates a maintenance configuration in the specified managed cluster. @@ -381,14 +395,17 @@ def create_or_update( :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.MaintenanceConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfiguration"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] _json = self._serialize.body(parameters, 'MaintenanceConfiguration') @@ -401,11 +418,13 @@ def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -449,13 +468,16 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -465,11 +487,13 @@ def delete( # pylint: disable=inconsistent-return-statements config_name=config_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/operations/_managed_clusters_operations.py index 15b2cc4dc02d..2e617aa06dc9 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/operations/_managed_clusters_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -36,9 +36,12 @@ def build_get_os_options_request( resource_type: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default") # pylint: disable=line-too-long path_format_arguments = { @@ -49,20 +52,18 @@ def build_get_os_options_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if resource_type is not None: - _query_parameters['resource-type'] = _SERIALIZER.query("resource_type", resource_type, 'str') + _params['resource-type'] = _SERIALIZER.query("resource_type", resource_type, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -71,9 +72,12 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters") path_format_arguments = { @@ -83,18 +87,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -104,9 +106,12 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters") # pylint: disable=line-too-long path_format_arguments = { @@ -117,18 +122,16 @@ def build_list_by_resource_group_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -139,9 +142,12 @@ def build_get_upgrade_profile_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default") # pylint: disable=line-too-long path_format_arguments = { @@ -153,18 +159,16 @@ def build_get_upgrade_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -176,9 +180,12 @@ def build_get_access_profile_request( role_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -191,18 +198,16 @@ def build_get_access_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -215,9 +220,12 @@ def build_list_cluster_admin_credentials_request( server_fqdn: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -229,20 +237,18 @@ def build_list_cluster_admin_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if server_fqdn is not None: - _query_parameters['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -255,9 +261,12 @@ def build_list_cluster_user_credentials_request( server_fqdn: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -269,20 +278,18 @@ def build_list_cluster_user_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if server_fqdn is not None: - _query_parameters['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -295,9 +302,12 @@ def build_list_cluster_monitoring_user_credentials_request( server_fqdn: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -309,20 +319,18 @@ def build_list_cluster_monitoring_user_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if server_fqdn is not None: - _query_parameters['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -333,9 +341,12 @@ def build_get_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -347,18 +358,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -368,14 +377,17 @@ def build_create_or_update_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedCluster] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -387,20 +399,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -412,14 +422,17 @@ def build_update_tags_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.TagsObject] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -431,20 +444,18 @@ def build_update_tags_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -457,9 +468,12 @@ def build_delete_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -471,18 +485,16 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -492,14 +504,17 @@ def build_reset_service_principal_profile_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedClusterServicePrincipalProfile] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile") # pylint: disable=line-too-long path_format_arguments = { @@ -511,20 +526,18 @@ def build_reset_service_principal_profile_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -536,14 +549,17 @@ def build_reset_aad_profile_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedClusterAADProfile] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile") # pylint: disable=line-too-long path_format_arguments = { @@ -555,20 +571,18 @@ def build_reset_aad_profile_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -581,9 +595,12 @@ def build_rotate_cluster_certificates_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates") # pylint: disable=line-too-long path_format_arguments = { @@ -595,18 +612,16 @@ def build_rotate_cluster_certificates_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -617,9 +632,12 @@ def build_stop_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop") # pylint: disable=line-too-long path_format_arguments = { @@ -631,18 +649,16 @@ def build_stop_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -653,9 +669,12 @@ def build_start_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start") # pylint: disable=line-too-long path_format_arguments = { @@ -667,18 +686,16 @@ def build_start_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -688,14 +705,17 @@ def build_run_command_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.RunCommandRequest] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand") # pylint: disable=line-too-long path_format_arguments = { @@ -707,20 +727,18 @@ def build_run_command_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -734,9 +752,12 @@ def build_get_command_result_request( command_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}") # pylint: disable=line-too-long path_format_arguments = { @@ -749,18 +770,16 @@ def build_get_command_result_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -771,9 +790,12 @@ def build_list_outbound_network_dependencies_endpoints_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints") # pylint: disable=line-too-long path_format_arguments = { @@ -785,42 +807,38 @@ def build_list_outbound_network_dependencies_endpoints_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class ManagedClustersOperations(object): # pylint: disable=too-many-public-methods - """ManagedClustersOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ManagedClustersOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_10_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_10_01.ContainerServiceClient`'s + :attr:`managed_clusters` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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_os_options( @@ -828,7 +846,7 @@ def get_os_options( location: str, resource_type: Optional[str] = None, **kwargs: Any - ) -> "_models.OSOptionProfile": + ) -> _models.OSOptionProfile: """Gets supported OS options in the specified subscription. Gets supported OS options in the specified subscription. @@ -843,13 +861,16 @@ def get_os_options( :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.OSOptionProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OSOptionProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OSOptionProfile] request = build_get_os_options_request( @@ -858,11 +879,13 @@ def get_os_options( api_version=api_version, resource_type=resource_type, template_url=self.get_os_options.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -887,7 +910,7 @@ def get_os_options( def list( self, **kwargs: Any - ) -> Iterable["_models.ManagedClusterListResult"]: + ) -> Iterable[_models.ManagedClusterListResult]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. @@ -899,13 +922,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_10_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -913,9 +939,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -923,9 +951,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -963,7 +993,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.ManagedClusterListResult"]: + ) -> Iterable[_models.ManagedClusterListResult]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. @@ -977,13 +1007,16 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_10_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -992,9 +1025,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -1003,9 +1038,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -1044,7 +1081,7 @@ def get_upgrade_profile( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedClusterUpgradeProfile": + ) -> _models.ManagedClusterUpgradeProfile: """Gets the upgrade profile of a managed cluster. Gets the upgrade profile of a managed cluster. @@ -1058,13 +1095,16 @@ def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.ManagedClusterUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] request = build_get_upgrade_profile_request( @@ -1073,11 +1113,13 @@ def get_upgrade_profile( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1105,7 +1147,7 @@ def get_access_profile( resource_name: str, role_name: str, **kwargs: Any - ) -> "_models.ManagedClusterAccessProfile": + ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. **WARNING**\ : This API will be deprecated. Instead use `ListClusterUserCredentials @@ -1124,13 +1166,16 @@ def get_access_profile( :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.ManagedClusterAccessProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterAccessProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] request = build_get_access_profile_request( @@ -1140,11 +1185,13 @@ def get_access_profile( role_name=role_name, api_version=api_version, template_url=self.get_access_profile.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1172,7 +1219,7 @@ def list_cluster_admin_credentials( resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Lists the admin credentials of a managed cluster. Lists the admin credentials of a managed cluster. @@ -1188,13 +1235,16 @@ def list_cluster_admin_credentials( :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_admin_credentials_request( @@ -1204,11 +1254,13 @@ def list_cluster_admin_credentials( api_version=api_version, server_fqdn=server_fqdn, template_url=self.list_cluster_admin_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1236,7 +1288,7 @@ def list_cluster_user_credentials( resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Lists the user credentials of a managed cluster. Lists the user credentials of a managed cluster. @@ -1252,13 +1304,16 @@ def list_cluster_user_credentials( :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_user_credentials_request( @@ -1268,11 +1323,13 @@ def list_cluster_user_credentials( api_version=api_version, server_fqdn=server_fqdn, template_url=self.list_cluster_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1300,7 +1357,7 @@ def list_cluster_monitoring_user_credentials( resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Lists the cluster monitoring user credentials of a managed cluster. Lists the cluster monitoring user credentials of a managed cluster. @@ -1316,13 +1373,16 @@ def list_cluster_monitoring_user_credentials( :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_monitoring_user_credentials_request( @@ -1332,11 +1392,13 @@ def list_cluster_monitoring_user_credentials( api_version=api_version, server_fqdn=server_fqdn, template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1363,7 +1425,7 @@ def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedCluster": + ) -> _models.ManagedCluster: """Gets a managed cluster. Gets a managed cluster. @@ -1377,13 +1439,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.ManagedCluster :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] request = build_get_request( @@ -1392,11 +1457,13 @@ def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1421,17 +1488,20 @@ def _create_or_update_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'ManagedCluster') @@ -1443,11 +1513,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1477,9 +1549,9 @@ def begin_create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> LROPoller["_models.ManagedCluster"]: + ) -> LROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. Creates or updates a managed cluster. @@ -1504,37 +1576,47 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_10_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1551,17 +1633,20 @@ def _update_tags_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'TagsObject') @@ -1573,11 +1658,13 @@ def _update_tags_initial( content_type=content_type, json=_json, template_url=self._update_tags_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1603,9 +1690,9 @@ def begin_update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> LROPoller["_models.ManagedCluster"]: + ) -> LROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates tags on a managed cluster. @@ -1630,37 +1717,47 @@ def begin_update_tags( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_10_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._update_tags_initial( + raw_result = self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1679,13 +1776,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -1694,11 +1794,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1742,20 +1844,25 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-10-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_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) @@ -1765,8 +1872,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1783,17 +1896,20 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') @@ -1805,11 +1921,13 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re content_type=content_type, json=_json, template_url=self._reset_service_principal_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1831,7 +1949,7 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> LROPoller[None]: """Reset the Service Principal Profile of a managed cluster. @@ -1857,23 +1975,28 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._reset_service_principal_profile_initial( + raw_result = self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1883,8 +2006,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1901,17 +2030,20 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') @@ -1923,11 +2055,13 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement content_type=content_type, json=_json, template_url=self._reset_aad_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1949,7 +2083,7 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> LROPoller[None]: """Reset the AAD Profile of a managed cluster. @@ -1974,23 +2108,28 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._reset_aad_profile_initial( + raw_result = self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -2000,8 +2139,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2020,13 +2165,16 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_rotate_cluster_certificates_request_initial( @@ -2035,11 +2183,13 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return resource_name=resource_name, api_version=api_version, template_url=self._rotate_cluster_certificates_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2084,20 +2234,25 @@ def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-st :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-10-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._rotate_cluster_certificates_initial( + raw_result = self._rotate_cluster_certificates_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) @@ -2107,8 +2262,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2127,13 +2288,16 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_stop_request_initial( @@ -2142,11 +2306,13 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_name, api_version=api_version, template_url=self._stop_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2194,20 +2360,25 @@ def begin_stop( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-10-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._stop_initial( + raw_result = self._stop_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) @@ -2217,8 +2388,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2237,13 +2414,16 @@ def _start_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_start_request_initial( @@ -2252,11 +2432,13 @@ def _start_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_name, api_version=api_version, template_url=self._start_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2301,20 +2483,25 @@ def begin_start( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-10-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._start_initial( + raw_result = self._start_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) @@ -2324,8 +2511,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2342,17 +2535,20 @@ def _run_command_initial( self, resource_group_name: str, resource_name: str, - request_payload: "_models.RunCommandRequest", + request_payload: _models.RunCommandRequest, **kwargs: Any - ) -> Optional["_models.RunCommandResult"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RunCommandResult"]] + ) -> Optional[_models.RunCommandResult]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] _json = self._serialize.body(request_payload, 'RunCommandRequest') @@ -2364,11 +2560,13 @@ def _run_command_initial( content_type=content_type, json=_json, template_url=self._run_command_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2396,9 +2594,9 @@ def begin_run_command( self, resource_group_name: str, resource_name: str, - request_payload: "_models.RunCommandRequest", + request_payload: _models.RunCommandRequest, **kwargs: Any - ) -> LROPoller["_models.RunCommandResult"]: + ) -> LROPoller[_models.RunCommandResult]: """Submits a command to run against the Managed Cluster. AKS will create a pod to run the command. This is primarily useful for private clusters. For @@ -2425,37 +2623,47 @@ def begin_run_command( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_10_01.models.RunCommandResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.RunCommandResult] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._run_command_initial( + raw_result = self._run_command_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, request_payload=request_payload, 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): - response = pipeline_response.http_response deserialized = self._deserialize('RunCommandResult', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2475,7 +2683,7 @@ def get_command_result( resource_name: str, command_id: str, **kwargs: Any - ) -> Optional["_models.RunCommandResult"]: + ) -> Optional[_models.RunCommandResult]: """Gets the results of a command which has been run on the Managed Cluster. Gets the results of a command which has been run on the Managed Cluster. @@ -2491,13 +2699,16 @@ def get_command_result( :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.RunCommandResult or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RunCommandResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] request = build_get_command_result_request( @@ -2507,11 +2718,13 @@ def get_command_result( command_id=command_id, api_version=api_version, template_url=self.get_command_result.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2540,7 +2753,7 @@ def list_outbound_network_dependencies_endpoints( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Iterable["_models.OutboundEnvironmentEndpointCollection"]: + ) -> Iterable[_models.OutboundEnvironmentEndpointCollection]: """Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. @@ -2558,13 +2771,16 @@ def list_outbound_network_dependencies_endpoints( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_10_01.models.OutboundEnvironmentEndpointCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OutboundEnvironmentEndpointCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -2574,9 +2790,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=self.list_outbound_network_dependencies_endpoints.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -2586,9 +2804,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/operations/_operations.py index 91e9ff2e20ef..8f999943a400 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/operations/_operations.py @@ -16,6 +16,7 @@ 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 @@ -29,55 +30,54 @@ def build_list_request( **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.ContainerService/operations") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class Operations(object): - """Operations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_10_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_10_01.ContainerServiceClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> Iterable["_models.OperationListResult"]: + ) -> Iterable[_models.OperationListResult]: """Gets a list of operations. Gets a list of operations. @@ -88,31 +88,38 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_10_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/operations/_private_endpoint_connections_operations.py index 96579451cd81..26b8d394c6b5 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/operations/_private_endpoint_connections_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast from msrest import Serializer @@ -16,13 +16,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -34,9 +34,12 @@ def build_list_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections") # pylint: disable=line-too-long path_format_arguments = { @@ -48,18 +51,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -71,9 +72,12 @@ def build_get_request( private_endpoint_connection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -86,18 +90,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -108,14 +110,17 @@ def build_update_request( resource_name: str, private_endpoint_connection_name: str, *, - json: JSONType = None, + json: Optional[_models.PrivateEndpointConnection] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -128,20 +133,18 @@ def build_update_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -155,9 +158,12 @@ def build_delete_request_initial( private_endpoint_connection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -170,42 +176,38 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class PrivateEndpointConnectionsOperations(object): - """PrivateEndpointConnectionsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class PrivateEndpointConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_10_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_10_01.ContainerServiceClient`'s + :attr:`private_endpoint_connections` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -213,7 +215,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnectionListResult": + ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. To learn more about private clusters, see: @@ -228,13 +230,16 @@ def list( :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.PrivateEndpointConnectionListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] request = build_list_request( @@ -243,11 +248,13 @@ def list( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -275,7 +282,7 @@ def get( resource_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Gets the specified private endpoint connection. To learn more about private clusters, see: @@ -292,13 +299,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] request = build_get_request( @@ -308,11 +318,13 @@ def get( private_endpoint_connection_name=private_endpoint_connection_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -339,9 +351,9 @@ def update( resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - parameters: "_models.PrivateEndpointConnection", + parameters: _models.PrivateEndpointConnection, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. Updates a private endpoint connection. @@ -359,14 +371,17 @@ def update( :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] _json = self._serialize.body(parameters, 'PrivateEndpointConnection') @@ -379,11 +394,13 @@ def update( content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -411,13 +428,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -427,11 +447,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name=private_endpoint_connection_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -478,21 +500,26 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-10-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -502,8 +529,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/operations/_private_link_resources_operations.py index 874b5c311098..0ff5e5c92b7d 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/operations/_private_link_resources_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/operations/_private_link_resources_operations.py @@ -15,6 +15,7 @@ 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 @@ -31,9 +32,12 @@ def build_list_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources") # pylint: disable=line-too-long path_format_arguments = { @@ -45,42 +49,38 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class PrivateLinkResourcesOperations(object): - """PrivateLinkResourcesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class PrivateLinkResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_10_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_10_01.ContainerServiceClient`'s + :attr:`private_link_resources` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -88,7 +88,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.PrivateLinkResourcesListResult": + ) -> _models.PrivateLinkResourcesListResult: """Gets a list of private link resources in the specified managed cluster. To learn more about private clusters, see: @@ -103,13 +103,16 @@ def list( :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.PrivateLinkResourcesListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourcesListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] request = build_list_request( @@ -118,11 +121,13 @@ def list( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/operations/_resolve_private_link_service_id_operations.py index 76a30854b0c3..248da1b9e55d 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/operations/_resolve_private_link_service_id_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/operations/_resolve_private_link_service_id_operations.py @@ -15,12 +15,12 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -31,14 +31,17 @@ def build_post_request( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.PrivateLinkResource] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId") # pylint: disable=line-too-long path_format_arguments = { @@ -50,55 +53,51 @@ def build_post_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs ) -class ResolvePrivateLinkServiceIdOperations(object): - """ResolvePrivateLinkServiceIdOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ResolvePrivateLinkServiceIdOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_10_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_10_01.ContainerServiceClient`'s + :attr:`resolve_private_link_service_id` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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 post( self, resource_group_name: str, resource_name: str, - parameters: "_models.PrivateLinkResource", + parameters: _models.PrivateLinkResource, **kwargs: Any - ) -> "_models.PrivateLinkResource": + ) -> _models.PrivateLinkResource: """Gets the private link service ID for the specified managed cluster. Gets the private link service ID for the specified managed cluster. @@ -114,14 +113,17 @@ def post( :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.PrivateLinkResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] _json = self._serialize.body(parameters, 'PrivateLinkResource') @@ -133,11 +135,13 @@ def post( content_type=content_type, json=_json, template_url=self.post.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/operations/_snapshots_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/operations/_snapshots_operations.py index 1cadb3f0c162..b97b3d781f76 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/operations/_snapshots_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_10_01/operations/_snapshots_operations.py @@ -16,12 +16,12 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -31,9 +31,12 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots") path_format_arguments = { @@ -43,18 +46,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -64,9 +65,12 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots") # pylint: disable=line-too-long path_format_arguments = { @@ -77,18 +81,16 @@ def build_list_by_resource_group_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -99,9 +101,12 @@ def build_get_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -113,18 +118,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -134,14 +137,17 @@ def build_create_or_update_request( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.Snapshot] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -153,20 +159,18 @@ def build_create_or_update_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -178,14 +182,17 @@ def build_update_tags_request( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.TagsObject] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -197,20 +204,18 @@ def build_update_tags_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -223,9 +228,12 @@ def build_delete_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -237,48 +245,44 @@ def build_delete_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class SnapshotsOperations(object): - """SnapshotsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class SnapshotsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_10_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_10_01.ContainerServiceClient`'s + :attr:`snapshots` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> Iterable["_models.SnapshotListResult"]: + ) -> Iterable[_models.SnapshotListResult]: """Gets a list of snapshots in the specified subscription. Gets a list of snapshots in the specified subscription. @@ -289,13 +293,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_10_01.models.SnapshotListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -303,9 +310,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -313,9 +322,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -353,7 +364,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.SnapshotListResult"]: + ) -> Iterable[_models.SnapshotListResult]: """Lists snapshots in the specified subscription and resource group. Lists snapshots in the specified subscription and resource group. @@ -366,13 +377,16 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_10_01.models.SnapshotListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -381,9 +395,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -392,9 +408,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -433,7 +451,7 @@ def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.Snapshot": + ) -> _models.Snapshot: """Gets a snapshot. Gets a snapshot. @@ -447,13 +465,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.Snapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] request = build_get_request( @@ -462,11 +483,13 @@ def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -492,9 +515,9 @@ def create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.Snapshot", + parameters: _models.Snapshot, **kwargs: Any - ) -> "_models.Snapshot": + ) -> _models.Snapshot: """Creates or updates a snapshot. Creates or updates a snapshot. @@ -510,14 +533,17 @@ def create_or_update( :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.Snapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] _json = self._serialize.body(parameters, 'Snapshot') @@ -529,11 +555,13 @@ def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -563,9 +591,9 @@ def update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.Snapshot": + ) -> _models.Snapshot: """Updates tags on a snapshot. Updates tags on a snapshot. @@ -581,14 +609,17 @@ def update_tags( :rtype: ~azure.mgmt.containerservice.v2021_10_01.models.Snapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] _json = self._serialize.body(parameters, 'TagsObject') @@ -600,11 +631,13 @@ def update_tags( content_type=content_type, json=_json, template_url=self.update_tags.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -645,13 +678,16 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -660,11 +696,13 @@ def delete( # pylint: disable=inconsistent-return-statements resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/__init__.py index 53c675bd95e2..37a5f9e02e6f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._container_service_client import ContainerServiceClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['ContainerServiceClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/_container_service_client.py index 07d41fc88aa5..34843360bf09 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/_container_service_client.py @@ -76,14 +76,30 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.managed_clusters = ManagedClustersOperations(self._client, self._config, self._serialize, self._deserialize) - self.maintenance_configurations = MaintenanceConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) - self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) - self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations(self._client, self._config, self._serialize, self._deserialize) - self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_clusters = ManagedClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.maintenance_configurations = MaintenanceConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.agent_pools = AgentPoolsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.snapshots = SnapshotsOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/__init__.py index 53c675bd95e2..37a5f9e02e6f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._container_service_client import ContainerServiceClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['ContainerServiceClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/_container_service_client.py index 2727beeda0fd..f9fbf2dfcc02 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/_container_service_client.py @@ -76,14 +76,30 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.managed_clusters = ManagedClustersOperations(self._client, self._config, self._serialize, self._deserialize) - self.maintenance_configurations = MaintenanceConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) - self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) - self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations(self._client, self._config, self._serialize, self._deserialize) - self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_clusters = ManagedClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.maintenance_configurations = MaintenanceConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.agent_pools = AgentPoolsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.snapshots = SnapshotsOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/operations/__init__.py index 5e1e5e72fa59..e0748876288c 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/operations/__init__.py @@ -15,6 +15,9 @@ from ._resolve_private_link_service_id_operations import ResolvePrivateLinkServiceIdOperations from ._snapshots_operations import SnapshotsOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'Operations', 'ManagedClustersOperations', @@ -25,3 +28,5 @@ 'ResolvePrivateLinkServiceIdOperations', 'SnapshotsOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/operations/_agent_pools_operations.py index 19194c445b65..e9c62ee11d84 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/operations/_agent_pools_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. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ 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 @@ -26,26 +27,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class AgentPoolsOperations: - """AgentPoolsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_11_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_11_01_preview.aio.ContainerServiceClient`'s + :attr:`agent_pools` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -53,7 +52,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> AsyncIterable["_models.AgentPoolListResult"]: + ) -> AsyncIterable[_models.AgentPoolListResult]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. @@ -68,13 +67,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_11_01_preview.models.AgentPoolListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -84,9 +86,11 @@ def prepare_request(next_link=None): resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -96,9 +100,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -138,7 +144,7 @@ async def get( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPool": + ) -> _models.AgentPool: """Gets the specified managed cluster agent pool. Gets the specified managed cluster agent pool. @@ -154,13 +160,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.AgentPool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] request = build_get_request( @@ -170,11 +179,13 @@ async def get( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -200,17 +211,20 @@ async def _create_or_update_initial( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> "_models.AgentPool": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] + ) -> _models.AgentPool: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] _json = self._serialize.body(parameters, 'AgentPool') @@ -223,11 +237,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -258,9 +274,9 @@ async def begin_create_or_update( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> AsyncLROPoller["_models.AgentPool"]: + ) -> AsyncLROPoller[_models.AgentPool]: """Creates or updates an agent pool in the specified managed cluster. Creates or updates an agent pool in the specified managed cluster. @@ -287,17 +303,20 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_11_01_preview.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, @@ -305,20 +324,27 @@ async def begin_create_or_update( 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): - response = pipeline_response.http_response deserialized = self._deserialize('AgentPool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -338,13 +364,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements agent_pool_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -354,11 +383,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -405,21 +436,26 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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) @@ -429,8 +465,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -450,7 +492,7 @@ async def get_upgrade_profile( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPoolUpgradeProfile": + ) -> _models.AgentPoolUpgradeProfile: """Gets the upgrade profile for an agent pool. Gets the upgrade profile for an agent pool. @@ -466,13 +508,16 @@ async def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.AgentPoolUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] request = build_get_upgrade_profile_request( @@ -482,11 +527,13 @@ async def get_upgrade_profile( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -513,7 +560,7 @@ async def get_available_agent_pool_versions( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.AgentPoolAvailableVersions": + ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported Kubernetes versions for the specified agent pool. See `supported Kubernetes versions @@ -529,13 +576,16 @@ async def get_available_agent_pool_versions( :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.AgentPoolAvailableVersions :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolAvailableVersions"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] request = build_get_available_agent_pool_versions_request( @@ -544,11 +594,13 @@ async def get_available_agent_pool_versions( resource_name=resource_name, api_version=api_version, template_url=self.get_available_agent_pool_versions.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -575,14 +627,17 @@ async def _upgrade_node_image_version_initial( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> Optional["_models.AgentPool"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.AgentPool"]] + ) -> Optional[_models.AgentPool]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] request = build_upgrade_node_image_version_request_initial( @@ -592,11 +647,13 @@ async def _upgrade_node_image_version_initial( agent_pool_name=agent_pool_name, api_version=api_version, template_url=self._upgrade_node_image_version_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -629,7 +686,7 @@ async def begin_upgrade_node_image_version( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> AsyncLROPoller["_models.AgentPool"]: + ) -> AsyncLROPoller[_models.AgentPool]: """Upgrades the node image version of an agent pool to the latest. Upgrading the node image version of an agent pool applies the newest OS and runtime updates to @@ -656,21 +713,26 @@ async def begin_upgrade_node_image_version( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_11_01_preview.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._upgrade_node_image_version_initial( + raw_result = await self._upgrade_node_image_version_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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) @@ -686,8 +748,14 @@ def get_long_running_output(pipeline_response): return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/operations/_maintenance_configurations_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/operations/_maintenance_configurations_operations.py index b4cf4a891a24..32fe791a20bb 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/operations/_maintenance_configurations_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/operations/_maintenance_configurations_operations.py @@ -15,6 +15,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -24,26 +25,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class MaintenanceConfigurationsOperations: - """MaintenanceConfigurationsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_11_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_11_01_preview.aio.ContainerServiceClient`'s + :attr:`maintenance_configurations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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_by_managed_cluster( @@ -51,7 +50,7 @@ def list_by_managed_cluster( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> AsyncIterable["_models.MaintenanceConfigurationListResult"]: + ) -> AsyncIterable[_models.MaintenanceConfigurationListResult]: """Gets a list of maintenance configurations in the specified managed cluster. Gets a list of maintenance configurations in the specified managed cluster. @@ -67,13 +66,16 @@ def list_by_managed_cluster( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_11_01_preview.models.MaintenanceConfigurationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfigurationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfigurationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -83,9 +85,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=self.list_by_managed_cluster.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -95,9 +99,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -137,7 +143,7 @@ async def get( resource_name: str, config_name: str, **kwargs: Any - ) -> "_models.MaintenanceConfiguration": + ) -> _models.MaintenanceConfiguration: """Gets the specified maintenance configuration of a managed cluster. Gets the specified maintenance configuration of a managed cluster. @@ -153,13 +159,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.MaintenanceConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfiguration"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] request = build_get_request( @@ -169,11 +178,13 @@ async def get( config_name=config_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -200,9 +211,9 @@ async def create_or_update( resource_group_name: str, resource_name: str, config_name: str, - parameters: "_models.MaintenanceConfiguration", + parameters: _models.MaintenanceConfiguration, **kwargs: Any - ) -> "_models.MaintenanceConfiguration": + ) -> _models.MaintenanceConfiguration: """Creates or updates a maintenance configuration in the specified managed cluster. Creates or updates a maintenance configuration in the specified managed cluster. @@ -221,14 +232,17 @@ async def create_or_update( :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.MaintenanceConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfiguration"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] _json = self._serialize.body(parameters, 'MaintenanceConfiguration') @@ -241,11 +255,13 @@ async def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -289,13 +305,16 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -305,11 +324,13 @@ async def delete( # pylint: disable=inconsistent-return-statements config_name=config_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/operations/_managed_clusters_operations.py index a8f5fb8a7111..ab219076d55e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/operations/_managed_clusters_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. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ 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 @@ -26,26 +27,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ManagedClustersOperations: # pylint: disable=too-many-public-methods - """ManagedClustersOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_11_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_11_01_preview.aio.ContainerServiceClient`'s + :attr:`managed_clusters` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace_async async def get_os_options( @@ -53,7 +52,7 @@ async def get_os_options( location: str, resource_type: Optional[str] = None, **kwargs: Any - ) -> "_models.OSOptionProfile": + ) -> _models.OSOptionProfile: """Gets supported OS options in the specified subscription. Gets supported OS options in the specified subscription. @@ -68,13 +67,16 @@ async def get_os_options( :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.OSOptionProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OSOptionProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OSOptionProfile] request = build_get_os_options_request( @@ -83,11 +85,13 @@ async def get_os_options( api_version=api_version, resource_type=resource_type, template_url=self.get_os_options.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -112,7 +116,7 @@ async def get_os_options( def list( self, **kwargs: Any - ) -> AsyncIterable["_models.ManagedClusterListResult"]: + ) -> AsyncIterable[_models.ManagedClusterListResult]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. @@ -124,13 +128,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_11_01_preview.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -138,9 +145,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -148,9 +157,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -188,7 +199,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ManagedClusterListResult"]: + ) -> AsyncIterable[_models.ManagedClusterListResult]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. @@ -202,13 +213,16 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_11_01_preview.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -217,9 +231,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -228,9 +244,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -269,7 +287,7 @@ async def get_upgrade_profile( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedClusterUpgradeProfile": + ) -> _models.ManagedClusterUpgradeProfile: """Gets the upgrade profile of a managed cluster. Gets the upgrade profile of a managed cluster. @@ -283,13 +301,16 @@ async def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.ManagedClusterUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] request = build_get_upgrade_profile_request( @@ -298,11 +319,13 @@ async def get_upgrade_profile( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -330,7 +353,7 @@ async def get_access_profile( resource_name: str, role_name: str, **kwargs: Any - ) -> "_models.ManagedClusterAccessProfile": + ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. **WARNING**\ : This API will be deprecated. Instead use `ListClusterUserCredentials @@ -349,13 +372,16 @@ async def get_access_profile( :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.ManagedClusterAccessProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterAccessProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] request = build_get_access_profile_request( @@ -365,11 +391,13 @@ async def get_access_profile( role_name=role_name, api_version=api_version, template_url=self.get_access_profile.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -397,7 +425,7 @@ async def list_cluster_admin_credentials( resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Lists the admin credentials of a managed cluster. Lists the admin credentials of a managed cluster. @@ -413,13 +441,16 @@ async def list_cluster_admin_credentials( :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_admin_credentials_request( @@ -429,11 +460,13 @@ async def list_cluster_admin_credentials( api_version=api_version, server_fqdn=server_fqdn, template_url=self.list_cluster_admin_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -461,7 +494,7 @@ async def list_cluster_user_credentials( resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Lists the user credentials of a managed cluster. Lists the user credentials of a managed cluster. @@ -477,13 +510,16 @@ async def list_cluster_user_credentials( :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_user_credentials_request( @@ -493,11 +529,13 @@ async def list_cluster_user_credentials( api_version=api_version, server_fqdn=server_fqdn, template_url=self.list_cluster_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -525,7 +563,7 @@ async def list_cluster_monitoring_user_credentials( resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Lists the cluster monitoring user credentials of a managed cluster. Lists the cluster monitoring user credentials of a managed cluster. @@ -541,13 +579,16 @@ async def list_cluster_monitoring_user_credentials( :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_monitoring_user_credentials_request( @@ -557,11 +598,13 @@ async def list_cluster_monitoring_user_credentials( api_version=api_version, server_fqdn=server_fqdn, template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -588,7 +631,7 @@ async def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedCluster": + ) -> _models.ManagedCluster: """Gets a managed cluster. Gets a managed cluster. @@ -602,13 +645,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.ManagedCluster :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] request = build_get_request( @@ -617,11 +663,13 @@ async def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -646,17 +694,20 @@ async def _create_or_update_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'ManagedCluster') @@ -668,11 +719,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -702,9 +755,9 @@ async def begin_create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> AsyncLROPoller["_models.ManagedCluster"]: + ) -> AsyncLROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. Creates or updates a managed cluster. @@ -729,37 +782,47 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_11_01_preview.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -776,17 +839,20 @@ async def _update_tags_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'TagsObject') @@ -798,11 +864,13 @@ async def _update_tags_initial( content_type=content_type, json=_json, template_url=self._update_tags_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -828,9 +896,9 @@ async def begin_update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> AsyncLROPoller["_models.ManagedCluster"]: + ) -> AsyncLROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates tags on a managed cluster. @@ -855,37 +923,47 @@ async def begin_update_tags( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_11_01_preview.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._update_tags_initial( + raw_result = await self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -904,13 +982,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -919,11 +1000,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -967,20 +1050,25 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_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) @@ -990,8 +1078,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1008,17 +1102,20 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') @@ -1030,11 +1127,13 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist content_type=content_type, json=_json, template_url=self._reset_service_principal_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1056,7 +1155,7 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> AsyncLROPoller[None]: """Reset the Service Principal Profile of a managed cluster. @@ -1082,23 +1181,28 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._reset_service_principal_profile_initial( + raw_result = await self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1108,8 +1212,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1126,17 +1236,20 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') @@ -1148,11 +1261,13 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta content_type=content_type, json=_json, template_url=self._reset_aad_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1174,7 +1289,7 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> AsyncLROPoller[None]: """Reset the AAD Profile of a managed cluster. @@ -1200,23 +1315,28 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._reset_aad_profile_initial( + raw_result = await self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1226,8 +1346,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1246,13 +1372,16 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_rotate_cluster_certificates_request_initial( @@ -1261,11 +1390,13 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- resource_name=resource_name, api_version=api_version, template_url=self._rotate_cluster_certificates_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1310,20 +1441,25 @@ async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-ret :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._rotate_cluster_certificates_initial( + raw_result = await self._rotate_cluster_certificates_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) @@ -1333,8 +1469,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1353,13 +1495,16 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_stop_request_initial( @@ -1368,11 +1513,13 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_name, api_version=api_version, template_url=self._stop_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1420,20 +1567,25 @@ async def begin_stop( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._stop_initial( + raw_result = await self._stop_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) @@ -1443,8 +1595,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1463,13 +1621,16 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_start_request_initial( @@ -1478,11 +1639,13 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_name, api_version=api_version, template_url=self._start_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1527,20 +1690,25 @@ async def begin_start( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._start_initial( + raw_result = await self._start_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) @@ -1550,8 +1718,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1568,17 +1742,20 @@ async def _run_command_initial( self, resource_group_name: str, resource_name: str, - request_payload: "_models.RunCommandRequest", + request_payload: _models.RunCommandRequest, **kwargs: Any - ) -> Optional["_models.RunCommandResult"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RunCommandResult"]] + ) -> Optional[_models.RunCommandResult]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] _json = self._serialize.body(request_payload, 'RunCommandRequest') @@ -1590,11 +1767,13 @@ async def _run_command_initial( content_type=content_type, json=_json, template_url=self._run_command_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1622,9 +1801,9 @@ async def begin_run_command( self, resource_group_name: str, resource_name: str, - request_payload: "_models.RunCommandRequest", + request_payload: _models.RunCommandRequest, **kwargs: Any - ) -> AsyncLROPoller["_models.RunCommandResult"]: + ) -> AsyncLROPoller[_models.RunCommandResult]: """Submits a command to run against the Managed Cluster. AKS will create a pod to run the command. This is primarily useful for private clusters. For @@ -1652,37 +1831,47 @@ async def begin_run_command( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2021_11_01_preview.models.RunCommandResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.RunCommandResult] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._run_command_initial( + raw_result = await self._run_command_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, request_payload=request_payload, 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): - response = pipeline_response.http_response deserialized = self._deserialize('RunCommandResult', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1702,7 +1891,7 @@ async def get_command_result( resource_name: str, command_id: str, **kwargs: Any - ) -> Optional["_models.RunCommandResult"]: + ) -> Optional[_models.RunCommandResult]: """Gets the results of a command which has been run on the Managed Cluster. Gets the results of a command which has been run on the Managed Cluster. @@ -1718,13 +1907,16 @@ async def get_command_result( :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.RunCommandResult or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RunCommandResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] request = build_get_command_result_request( @@ -1734,11 +1926,13 @@ async def get_command_result( command_id=command_id, api_version=api_version, template_url=self.get_command_result.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1767,7 +1961,7 @@ def list_outbound_network_dependencies_endpoints( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> AsyncIterable["_models.OutboundEnvironmentEndpointCollection"]: + ) -> AsyncIterable[_models.OutboundEnvironmentEndpointCollection]: """Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. @@ -1785,13 +1979,16 @@ def list_outbound_network_dependencies_endpoints( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_11_01_preview.models.OutboundEnvironmentEndpointCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OutboundEnvironmentEndpointCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -1801,9 +1998,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=self.list_outbound_network_dependencies_endpoints.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -1813,9 +2012,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/operations/_operations.py index 049ea7083911..9be9cf1ca2fc 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/operations/_operations.py @@ -14,6 +14,7 @@ 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 @@ -23,32 +24,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class Operations: - """Operations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_11_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_11_01_preview.aio.ContainerServiceClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.OperationListResult"]: + ) -> AsyncIterable[_models.OperationListResult]: """Gets a list of operations. Gets a list of operations. @@ -59,31 +58,38 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_11_01_preview.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/operations/_private_endpoint_connections_operations.py index 4931a848e982..065ee6086726 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/operations/_private_endpoint_connections_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -14,6 +14,7 @@ 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 @@ -24,26 +25,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class PrivateEndpointConnectionsOperations: - """PrivateEndpointConnectionsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_11_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_11_01_preview.aio.ContainerServiceClient`'s + :attr:`private_endpoint_connections` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -51,7 +50,7 @@ async def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnectionListResult": + ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. To learn more about private clusters, see: @@ -67,13 +66,16 @@ async def list( ~azure.mgmt.containerservice.v2021_11_01_preview.models.PrivateEndpointConnectionListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] request = build_list_request( @@ -82,11 +84,13 @@ async def list( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -114,7 +118,7 @@ async def get( resource_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Gets the specified private endpoint connection. To learn more about private clusters, see: @@ -131,13 +135,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] request = build_get_request( @@ -147,11 +154,13 @@ async def get( private_endpoint_connection_name=private_endpoint_connection_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -178,9 +187,9 @@ async def update( resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - parameters: "_models.PrivateEndpointConnection", + parameters: _models.PrivateEndpointConnection, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. Updates a private endpoint connection. @@ -199,14 +208,17 @@ async def update( :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] _json = self._serialize.body(parameters, 'PrivateEndpointConnection') @@ -219,11 +231,13 @@ async def update( content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -251,13 +265,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -267,11 +284,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name=private_endpoint_connection_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -318,21 +337,26 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -342,8 +366,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/operations/_private_link_resources_operations.py index 060b08e058af..01c9e62a1541 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/operations/_private_link_resources_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/operations/_private_link_resources_operations.py @@ -13,6 +13,7 @@ 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 @@ -22,26 +23,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class PrivateLinkResourcesOperations: - """PrivateLinkResourcesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_11_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_11_01_preview.aio.ContainerServiceClient`'s + :attr:`private_link_resources` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -49,7 +48,7 @@ async def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.PrivateLinkResourcesListResult": + ) -> _models.PrivateLinkResourcesListResult: """Gets a list of private link resources in the specified managed cluster. To learn more about private clusters, see: @@ -64,13 +63,16 @@ async def list( :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.PrivateLinkResourcesListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourcesListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] request = build_list_request( @@ -79,11 +81,13 @@ async def list( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/operations/_resolve_private_link_service_id_operations.py index ec51c7fb5fcf..33adceb1f94f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/operations/_resolve_private_link_service_id_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/operations/_resolve_private_link_service_id_operations.py @@ -13,6 +13,7 @@ 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 @@ -22,35 +23,33 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ResolvePrivateLinkServiceIdOperations: - """ResolvePrivateLinkServiceIdOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_11_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_11_01_preview.aio.ContainerServiceClient`'s + :attr:`resolve_private_link_service_id` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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 post( self, resource_group_name: str, resource_name: str, - parameters: "_models.PrivateLinkResource", + parameters: _models.PrivateLinkResource, **kwargs: Any - ) -> "_models.PrivateLinkResource": + ) -> _models.PrivateLinkResource: """Gets the private link service ID for the specified managed cluster. Gets the private link service ID for the specified managed cluster. @@ -66,14 +65,17 @@ async def post( :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.PrivateLinkResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] _json = self._serialize.body(parameters, 'PrivateLinkResource') @@ -85,11 +87,13 @@ async def post( content_type=content_type, json=_json, template_url=self.post.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/operations/_snapshots_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/operations/_snapshots_operations.py index 19d5fa6ee635..e2ec46e2f1c6 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/operations/_snapshots_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/aio/operations/_snapshots_operations.py @@ -15,6 +15,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -24,32 +25,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class SnapshotsOperations: - """SnapshotsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_11_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_11_01_preview.aio.ContainerServiceClient`'s + :attr:`snapshots` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.SnapshotListResult"]: + ) -> AsyncIterable[_models.SnapshotListResult]: """Gets a list of snapshots in the specified subscription. Gets a list of snapshots in the specified subscription. @@ -60,13 +59,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_11_01_preview.models.SnapshotListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -74,9 +76,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -84,9 +88,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -124,7 +130,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.SnapshotListResult"]: + ) -> AsyncIterable[_models.SnapshotListResult]: """Lists snapshots in the specified subscription and resource group. Lists snapshots in the specified subscription and resource group. @@ -137,13 +143,16 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2021_11_01_preview.models.SnapshotListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -152,9 +161,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -163,9 +174,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -204,7 +217,7 @@ async def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.Snapshot": + ) -> _models.Snapshot: """Gets a snapshot. Gets a snapshot. @@ -218,13 +231,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.Snapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] request = build_get_request( @@ -233,11 +249,13 @@ async def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -263,9 +281,9 @@ async def create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.Snapshot", + parameters: _models.Snapshot, **kwargs: Any - ) -> "_models.Snapshot": + ) -> _models.Snapshot: """Creates or updates a snapshot. Creates or updates a snapshot. @@ -281,14 +299,17 @@ async def create_or_update( :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.Snapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] _json = self._serialize.body(parameters, 'Snapshot') @@ -300,11 +321,13 @@ async def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -334,9 +357,9 @@ async def update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.Snapshot": + ) -> _models.Snapshot: """Updates tags on a snapshot. Updates tags on a snapshot. @@ -352,14 +375,17 @@ async def update_tags( :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.Snapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] _json = self._serialize.body(parameters, 'TagsObject') @@ -371,11 +397,13 @@ async def update_tags( content_type=content_type, json=_json, template_url=self.update_tags.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -416,13 +444,16 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -431,11 +462,13 @@ async def delete( # pylint: disable=inconsistent-return-statements resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/models/__init__.py index 4729140ec1d7..a21f3f514121 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/models/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/models/__init__.py @@ -132,7 +132,9 @@ WeekDay, WorkloadRuntime, ) - +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'AgentPool', 'AgentPoolAvailableVersions', @@ -257,3 +259,5 @@ 'WeekDay', 'WorkloadRuntime', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/models/_container_service_client_enums.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/models/_container_service_client_enums.py index feacacdf3147..145f90c5ecca 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/models/_container_service_client_enums.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/models/_container_service_client_enums.py @@ -7,11 +7,10 @@ # -------------------------------------------------------------------------- from enum import Enum -from six import with_metaclass from azure.core import CaseInsensitiveEnumMeta -class AgentPoolMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class AgentPoolMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: https://docs.microsoft.com/azure/aks/use-system-pools @@ -24,7 +23,7 @@ class AgentPoolMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: User agent pools are primarily for hosting your application pods. USER = "User" -class AgentPoolType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class AgentPoolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of Agent Pool. """ @@ -33,7 +32,7 @@ class AgentPoolType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Use of this is strongly discouraged. AVAILABILITY_SET = "AvailabilitySet" -class Code(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class Code(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Tells whether the cluster is Running or Stopped """ @@ -42,7 +41,7 @@ class Code(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: The cluster is stopped. STOPPED = "Stopped" -class ConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The private link service connection status. """ @@ -51,7 +50,7 @@ class ConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): REJECTED = "Rejected" DISCONNECTED = "Disconnected" -class ContainerServiceStorageProfileTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Specifies what kind of storage to use. If omitted, the default will be chosen on your behalf based on the choice of orchestrator. """ @@ -59,7 +58,7 @@ class ContainerServiceStorageProfileTypes(with_metaclass(CaseInsensitiveEnumMeta STORAGE_ACCOUNT = "StorageAccount" MANAGED_DISKS = "ManagedDisks" -class ContainerServiceVMSizeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Size of agent VMs. Note: This is no longer maintained. """ @@ -238,7 +237,7 @@ class ContainerServiceVMSizeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, E STANDARD_NV24 = "Standard_NV24" STANDARD_NV6 = "Standard_NV6" -class Count(with_metaclass(CaseInsensitiveEnumMeta, int, Enum)): +class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): """Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, and 5. The default value is 1. """ @@ -247,7 +246,7 @@ class Count(with_metaclass(CaseInsensitiveEnumMeta, int, Enum)): THREE = 3 FIVE = 5 -class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of identity that created the resource. """ @@ -256,7 +255,7 @@ class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class Expander(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class Expander(str, Enum, metaclass=CaseInsensitiveEnumMeta): """If not specified, the default is 'random'. See `expanders `_ for more information. @@ -279,13 +278,13 @@ class Expander(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Used when you don't have a particular need for the node groups to scale differently. RANDOM = "random" -class ExtendedLocationTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ExtendedLocationTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of extendedLocation. """ EDGE_ZONE = "EdgeZone" -class GPUInstanceProfile(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class GPUInstanceProfile(str, Enum, metaclass=CaseInsensitiveEnumMeta): """GPUInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU. """ @@ -295,14 +294,14 @@ class GPUInstanceProfile(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MIG4_G = "MIG4g" MIG7_G = "MIG7g" -class IpFamily(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class IpFamily(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The IP version to use for cluster networking and IP assignment. """ I_PV4 = "IPv4" I_PV6 = "IPv6" -class KubeletDiskType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class KubeletDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. """ @@ -312,7 +311,7 @@ class KubeletDiskType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Kubelet will use the temporary disk for its data. TEMPORARY = "Temporary" -class LicenseType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class LicenseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The license type to use for Windows VMs. See `Azure Hybrid User Benefits `_ for more details. """ @@ -322,7 +321,7 @@ class LicenseType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Enables Azure Hybrid User Benefits for Windows VMs. WINDOWS_SERVER = "Windows_Server" -class LoadBalancerSku(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class LoadBalancerSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the differences between load balancer SKUs. @@ -335,7 +334,7 @@ class LoadBalancerSku(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Use a basic Load Balancer with limited functionality. BASIC = "basic" -class ManagedClusterPodIdentityProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ManagedClusterPodIdentityProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The current provisioning state of the pod identity. """ @@ -344,13 +343,13 @@ class ManagedClusterPodIdentityProvisioningState(with_metaclass(CaseInsensitiveE DELETING = "Deleting" FAILED = "Failed" -class ManagedClusterSKUName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ManagedClusterSKUName(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The name of a managed cluster SKU. """ BASIC = "Basic" -class ManagedClusterSKUTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ManagedClusterSKUTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): """If not specified, the default is 'Free'. See `uptime SLA `_ for more details. """ @@ -361,7 +360,7 @@ class ManagedClusterSKUTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: No guaranteed SLA, no additional charges. Free tier clusters have an SLO of 99.5%. FREE = "Free" -class NetworkMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """This cannot be specified if networkPlugin is anything other than 'azure'. """ @@ -372,7 +371,7 @@ class NetworkMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: This is no longer supported. BRIDGE = "bridge" -class NetworkPlugin(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkPlugin(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Network plugin used for building the Kubernetes network. """ @@ -385,7 +384,7 @@ class NetworkPlugin(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: information. KUBENET = "kubenet" -class NetworkPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Network policy used for building the Kubernetes network. """ @@ -398,7 +397,7 @@ class NetworkPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: for more information. AZURE = "azure" -class OSDiskType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OSDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS @@ -414,14 +413,14 @@ class OSDiskType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: provides lower read/write latency, along with faster node scaling and cluster upgrades. EPHEMERAL = "Ephemeral" -class OSSKU(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OSSKU(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Specifies an OS SKU. This value must not be specified if OSType is Windows. """ UBUNTU = "Ubuntu" CBL_MARINER = "CBLMariner" -class OSType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The operating system type. The default is Linux. """ @@ -430,7 +429,7 @@ class OSType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Use Windows. WINDOWS = "Windows" -class OutboundType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OutboundType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type `_. """ @@ -450,7 +449,7 @@ class OutboundType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: advanced scenario and requires proper network configuration. USER_ASSIGNED_NAT_GATEWAY = "userAssignedNATGateway" -class PrivateEndpointConnectionProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class PrivateEndpointConnectionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The current provisioning state. """ @@ -459,14 +458,14 @@ class PrivateEndpointConnectionProvisioningState(with_metaclass(CaseInsensitiveE DELETING = "Deleting" FAILED = "Failed" -class PublicNetworkAccess(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class PublicNetworkAccess(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Allow or deny public network access for AKS """ ENABLED = "Enabled" DISABLED = "Disabled" -class ResourceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """For more information see `use managed identities in AKS `_. """ @@ -482,7 +481,7 @@ class ResourceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Do not use a managed identity for the Managed Cluster, service principal will be used instead. NONE = "None" -class ScaleDownMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ScaleDownMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Describes how VMs are added to or removed from Agent Pools. See `billing states `_. """ @@ -493,7 +492,7 @@ class ScaleDownMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: during scale down. DEALLOCATE = "Deallocate" -class ScaleSetEvictionPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The eviction policy specifies what to do with the VM when it is evicted. The default is Delete. For more information about eviction see `spot VMs `_ @@ -506,7 +505,7 @@ class ScaleSetEvictionPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)) #: cause issues with cluster scaling or upgrading. DEALLOCATE = "Deallocate" -class ScaleSetPriority(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ScaleSetPriority(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The Virtual Machine Scale Set priority. """ @@ -516,14 +515,14 @@ class ScaleSetPriority(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Regular VMs will be used. REGULAR = "Regular" -class SnapshotType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SnapshotType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of a snapshot. The default is NodePool. """ #: The snapshot is a snapshot of a node pool. NODE_POOL = "NodePool" -class UpgradeChannel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class UpgradeChannel(str, Enum, metaclass=CaseInsensitiveEnumMeta): """For more information see `setting the AKS cluster auto-upgrade channel `_. """ @@ -553,7 +552,7 @@ class UpgradeChannel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Disables auto-upgrades and keeps the cluster at its current version of Kubernetes. NONE = "none" -class WeekDay(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class WeekDay(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The weekday enum. """ @@ -565,7 +564,7 @@ class WeekDay(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): FRIDAY = "Friday" SATURDAY = "Saturday" -class WorkloadRuntime(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class WorkloadRuntime(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Determines the type of workload a node can run. """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/models/_models_py3.py index 2f8ad968608a..da3b220050e9 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/models/_models_py3.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/models/_models_py3.py @@ -7,11 +7,13 @@ # -------------------------------------------------------------------------- import datetime -from typing import Dict, List, Optional, Union +from typing import Dict, List, Optional, TYPE_CHECKING, Union import msrest.serialization -from ._container_service_client_enums import * +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + import __init__ as _models class SubResource(msrest.serialization.Model): @@ -79,16 +81,16 @@ class AgentPool(SubResource): :ivar os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS - `_. Possible values - include: "Managed", "Ephemeral". + `_. Known values are: + "Managed", "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Possible values include: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.KubeletDiskType - :ivar workload_runtime: Determines the type of workload a node can run. Possible values - include: "OCIContainer", "WasmWasi". + :ivar workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer", "WasmWasi". :vartype workload_runtime: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.WorkloadRuntime :ivar message_of_the_day: A base64-encoded string which will be written to /etc/motd after @@ -107,11 +109,11 @@ class AgentPool(SubResource): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.OSType - :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Possible values include: "Ubuntu", "CBLMariner". + :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known + values are: "Ubuntu", "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. :vartype max_count: int @@ -120,17 +122,16 @@ class AgentPool(SubResource): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it - defaults to Delete. Possible values include: "Delete", "Deallocate". + defaults to Delete. Known values are: "Delete", "Deallocate". :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.ScaleDownMode - :ivar type_properties_type: The type of Agent Pool. Possible values include: + :ivar type_properties_type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :vartype type_properties_type: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Possible values include: "System", - "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". :vartype mode: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.AgentPoolMode :ivar orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -165,12 +166,12 @@ class AgentPool(SubResource): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Possible values include: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Possible values include: "Delete", - "Deallocate". Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which @@ -202,7 +203,7 @@ class AgentPool(SubResource): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.GPUInstanceProfile :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool @@ -275,41 +276,41 @@ def __init__( count: Optional[int] = None, vm_size: Optional[str] = None, os_disk_size_gb: Optional[int] = None, - os_disk_type: Optional[Union[str, "OSDiskType"]] = None, - kubelet_disk_type: Optional[Union[str, "KubeletDiskType"]] = None, - workload_runtime: Optional[Union[str, "WorkloadRuntime"]] = None, + os_disk_type: Optional[Union[str, "_models.OSDiskType"]] = None, + kubelet_disk_type: Optional[Union[str, "_models.KubeletDiskType"]] = None, + workload_runtime: Optional[Union[str, "_models.WorkloadRuntime"]] = None, message_of_the_day: Optional[str] = None, vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", - os_sku: Optional[Union[str, "OSSKU"]] = None, + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - scale_down_mode: Optional[Union[str, "ScaleDownMode"]] = None, - type_properties_type: Optional[Union[str, "AgentPoolType"]] = None, - mode: Optional[Union[str, "AgentPoolMode"]] = None, + scale_down_mode: Optional[Union[str, "_models.ScaleDownMode"]] = None, + type_properties_type: Optional[Union[str, "_models.AgentPoolType"]] = None, + mode: Optional[Union[str, "_models.AgentPoolMode"]] = None, orchestrator_version: Optional[str] = None, - upgrade_settings: Optional["AgentPoolUpgradeSettings"] = None, - power_state: Optional["PowerState"] = None, + upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, + power_state: Optional["_models.PowerState"] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", spot_max_price: Optional[float] = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, proximity_placement_group_id: Optional[str] = None, - kubelet_config: Optional["KubeletConfig"] = None, - linux_os_config: Optional["LinuxOSConfig"] = None, + kubelet_config: Optional["_models.KubeletConfig"] = None, + linux_os_config: Optional["_models.LinuxOSConfig"] = None, enable_encryption_at_host: Optional[bool] = None, enable_ultra_ssd: Optional[bool] = None, enable_fips: Optional[bool] = None, - gpu_instance_profile: Optional[Union[str, "GPUInstanceProfile"]] = None, - creation_data: Optional["CreationData"] = None, + gpu_instance_profile: Optional[Union[str, "_models.GPUInstanceProfile"]] = None, + creation_data: Optional["_models.CreationData"] = None, capacity_reservation_group_id: Optional[str] = None, **kwargs ): @@ -329,16 +330,16 @@ def __init__( :keyword os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS - `_. Possible values - include: "Managed", "Ephemeral". + `_. Known values are: + "Managed", "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Possible values include: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.KubeletDiskType - :keyword workload_runtime: Determines the type of workload a node can run. Possible values - include: "OCIContainer", "WasmWasi". + :keyword workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer", "WasmWasi". :paramtype workload_runtime: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.WorkloadRuntime :keyword message_of_the_day: A base64-encoded string which will be written to /etc/motd after @@ -357,11 +358,11 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.OSType :keyword os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Possible values include: "Ubuntu", "CBLMariner". + Known values are: "Ubuntu", "CBLMariner". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -370,17 +371,16 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, - it defaults to Delete. Possible values include: "Delete", "Deallocate". + it defaults to Delete. Known values are: "Delete", "Deallocate". :paramtype scale_down_mode: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.ScaleDownMode - :keyword type_properties_type: The type of Agent Pool. Possible values include: + :keyword type_properties_type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type_properties_type: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Possible values include: "System", - "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.AgentPoolMode :keyword orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -411,12 +411,12 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Possible values include: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Possible values include: "Delete", - "Deallocate". Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which @@ -450,7 +450,7 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.GPUInstanceProfile @@ -537,7 +537,7 @@ class AgentPoolAvailableVersions(msrest.serialization.Model): def __init__( self, *, - agent_pool_versions: Optional[List["AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem"]] = None, + agent_pool_versions: Optional[List["_models.AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem"]] = None, **kwargs ): """ @@ -614,7 +614,7 @@ class AgentPoolListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["AgentPool"]] = None, + value: Optional[List["_models.AgentPool"]] = None, **kwargs ): """ @@ -641,8 +641,8 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): :vartype type: str :ivar kubernetes_version: Required. The Kubernetes version (major.minor.patch). :vartype kubernetes_version: str - :ivar os_type: Required. The operating system type. The default is Linux. Possible values - include: "Linux", "Windows". Default value: "Linux". + :ivar os_type: Required. The operating system type. The default is Linux. Known values are: + "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -673,16 +673,16 @@ def __init__( self, *, kubernetes_version: str, - os_type: Union[str, "OSType"] = "Linux", - upgrades: Optional[List["AgentPoolUpgradeProfilePropertiesUpgradesItem"]] = None, + os_type: Union[str, "_models.OSType"] = "Linux", + upgrades: Optional[List["_models.AgentPoolUpgradeProfilePropertiesUpgradesItem"]] = None, latest_node_image_version: Optional[str] = None, **kwargs ): """ :keyword kubernetes_version: Required. The Kubernetes version (major.minor.patch). :paramtype kubernetes_version: str - :keyword os_type: Required. The operating system type. The default is Linux. Possible values - include: "Linux", "Windows". Default value: "Linux". + :keyword os_type: Required. The operating system type. The default is Linux. Known values are: + "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: @@ -794,7 +794,7 @@ def __init__( code: Optional[str] = None, message: Optional[str] = None, target: Optional[str] = None, - details: Optional[List["CloudErrorBody"]] = None, + details: Optional[List["_models.CloudErrorBody"]] = None, **kwargs ): """ @@ -839,7 +839,7 @@ class ContainerServiceDiagnosticsProfile(msrest.serialization.Model): def __init__( self, *, - vm_diagnostics: "ContainerServiceVMDiagnostics", + vm_diagnostics: "_models.ContainerServiceVMDiagnostics", **kwargs ): """ @@ -877,7 +877,7 @@ def __init__( self, *, admin_username: str, - ssh: "ContainerServiceSshConfiguration", + ssh: "_models.ContainerServiceSshConfiguration", **kwargs ): """ @@ -900,17 +900,17 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar count: Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, - and 5. The default value is 1. Possible values include: 1, 3, 5. Default value: "1". + and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". :vartype count: int or ~azure.mgmt.containerservice.v2021_11_01_preview.models.Count :ivar dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. :vartype dns_prefix: str - :ivar vm_size: Required. Size of agent VMs. Possible values include: "Standard_A1", - "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", - "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", - "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", - "Standard_A8m_v2", "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", - "Standard_B8ms", "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", - "Standard_D12", "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", + :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", + "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", + "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", + "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", "Standard_B8ms", + "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", "Standard_D12", + "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", "Standard_D13_v2_Promo", "Standard_D14", "Standard_D14_v2", "Standard_D14_v2_Promo", "Standard_D15_v2", "Standard_D16_v3", "Standard_D16s_v3", "Standard_D1_v2", "Standard_D2", "Standard_D2_v2", "Standard_D2_v2_Promo", "Standard_D2_v3", "Standard_D2s_v3", "Standard_D3", @@ -955,7 +955,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): :vartype first_consecutive_static_ip: str :ivar storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Possible values include: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". :vartype storage_profile: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.ContainerServiceStorageProfileTypes :ivar fqdn: FQDN for the master pool. @@ -984,27 +984,27 @@ def __init__( self, *, dns_prefix: str, - vm_size: Union[str, "ContainerServiceVMSizeTypes"], - count: Optional[Union[int, "Count"]] = 1, + vm_size: Union[str, "_models.ContainerServiceVMSizeTypes"], + count: Optional[Union[int, "_models.Count"]] = 1, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, first_consecutive_static_ip: Optional[str] = "10.240.255.5", - storage_profile: Optional[Union[str, "ContainerServiceStorageProfileTypes"]] = None, + storage_profile: Optional[Union[str, "_models.ContainerServiceStorageProfileTypes"]] = None, **kwargs ): """ :keyword count: Number of masters (VMs) in the container service cluster. Allowed values are 1, - 3, and 5. The default value is 1. Possible values include: 1, 3, 5. Default value: "1". + 3, and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". :paramtype count: int or ~azure.mgmt.containerservice.v2021_11_01_preview.models.Count :keyword dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. :paramtype dns_prefix: str - :keyword vm_size: Required. Size of agent VMs. Possible values include: "Standard_A1", - "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", - "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", - "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", - "Standard_A8m_v2", "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", - "Standard_B8ms", "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", - "Standard_D12", "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", + :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", + "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", + "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", + "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", "Standard_B8ms", + "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", "Standard_D12", + "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", "Standard_D13_v2_Promo", "Standard_D14", "Standard_D14_v2", "Standard_D14_v2_Promo", "Standard_D15_v2", "Standard_D16_v3", "Standard_D16s_v3", "Standard_D1_v2", "Standard_D2", "Standard_D2_v2", "Standard_D2_v2_Promo", "Standard_D2_v3", "Standard_D2s_v3", "Standard_D3", @@ -1049,7 +1049,7 @@ def __init__( :paramtype first_consecutive_static_ip: str :keyword storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Possible values include: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". :paramtype storage_profile: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.ContainerServiceStorageProfileTypes """ @@ -1067,16 +1067,16 @@ def __init__( class ContainerServiceNetworkProfile(msrest.serialization.Model): """Profile of network configuration. - :ivar network_plugin: Network plugin used for building the Kubernetes network. Possible values - include: "azure", "kubenet". Default value: "kubenet". + :ivar network_plugin: Network plugin used for building the Kubernetes network. Known values + are: "azure", "kubenet". Default value: "kubenet". :vartype network_plugin: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.NetworkPlugin - :ivar network_policy: Network policy used for building the Kubernetes network. Possible values - include: "calico", "azure". + :ivar network_policy: Network policy used for building the Kubernetes network. Known values + are: "calico", "azure". :vartype network_policy: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.NetworkPolicy :ivar network_mode: This cannot be specified if networkPlugin is anything other than 'azure'. - Possible values include: "transparent", "bridge". + Known values are: "transparent", "bridge". :vartype network_mode: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.NetworkMode :ivar pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. @@ -1092,14 +1092,14 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): :vartype docker_bridge_cidr: str :ivar outbound_type: This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type - `_. Possible values include: - "loadBalancer", "userDefinedRouting", "managedNATGateway", "userAssignedNATGateway". Default - value: "loadBalancer". + `_. Known values are: "loadBalancer", + "userDefinedRouting", "managedNATGateway", "userAssignedNATGateway". Default value: + "loadBalancer". :vartype outbound_type: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.OutboundType :ivar load_balancer_sku: The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the - differences between load balancer SKUs. Possible values include: "standard", "basic". + differences between load balancer SKUs. Known values are: "standard", "basic". :vartype load_balancer_sku: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.LoadBalancerSku :ivar load_balancer_profile: Profile of the cluster load balancer. @@ -1149,33 +1149,33 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): def __init__( self, *, - network_plugin: Optional[Union[str, "NetworkPlugin"]] = "kubenet", - network_policy: Optional[Union[str, "NetworkPolicy"]] = None, - network_mode: Optional[Union[str, "NetworkMode"]] = None, + network_plugin: Optional[Union[str, "_models.NetworkPlugin"]] = "kubenet", + network_policy: Optional[Union[str, "_models.NetworkPolicy"]] = None, + network_mode: Optional[Union[str, "_models.NetworkMode"]] = None, pod_cidr: Optional[str] = "10.244.0.0/16", service_cidr: Optional[str] = "10.0.0.0/16", dns_service_ip: Optional[str] = "10.0.0.10", docker_bridge_cidr: Optional[str] = "172.17.0.1/16", - outbound_type: Optional[Union[str, "OutboundType"]] = "loadBalancer", - load_balancer_sku: Optional[Union[str, "LoadBalancerSku"]] = None, - load_balancer_profile: Optional["ManagedClusterLoadBalancerProfile"] = None, - nat_gateway_profile: Optional["ManagedClusterNATGatewayProfile"] = None, + outbound_type: Optional[Union[str, "_models.OutboundType"]] = "loadBalancer", + load_balancer_sku: Optional[Union[str, "_models.LoadBalancerSku"]] = None, + load_balancer_profile: Optional["_models.ManagedClusterLoadBalancerProfile"] = None, + nat_gateway_profile: Optional["_models.ManagedClusterNATGatewayProfile"] = None, pod_cidrs: Optional[List[str]] = None, service_cidrs: Optional[List[str]] = None, - ip_families: Optional[List[Union[str, "IpFamily"]]] = None, + ip_families: Optional[List[Union[str, "_models.IpFamily"]]] = None, **kwargs ): """ - :keyword network_plugin: Network plugin used for building the Kubernetes network. Possible - values include: "azure", "kubenet". Default value: "kubenet". + :keyword network_plugin: Network plugin used for building the Kubernetes network. Known values + are: "azure", "kubenet". Default value: "kubenet". :paramtype network_plugin: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.NetworkPlugin - :keyword network_policy: Network policy used for building the Kubernetes network. Possible - values include: "calico", "azure". + :keyword network_policy: Network policy used for building the Kubernetes network. Known values + are: "calico", "azure". :paramtype network_policy: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.NetworkPolicy :keyword network_mode: This cannot be specified if networkPlugin is anything other than - 'azure'. Possible values include: "transparent", "bridge". + 'azure'. Known values are: "transparent", "bridge". :paramtype network_mode: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.NetworkMode :keyword pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. @@ -1191,14 +1191,14 @@ def __init__( :paramtype docker_bridge_cidr: str :keyword outbound_type: This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type - `_. Possible values include: - "loadBalancer", "userDefinedRouting", "managedNATGateway", "userAssignedNATGateway". Default - value: "loadBalancer". + `_. Known values are: "loadBalancer", + "userDefinedRouting", "managedNATGateway", "userAssignedNATGateway". Default value: + "loadBalancer". :paramtype outbound_type: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.OutboundType :keyword load_balancer_sku: The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the - differences between load balancer SKUs. Possible values include: "standard", "basic". + differences between load balancer SKUs. Known values are: "standard", "basic". :paramtype load_balancer_sku: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.LoadBalancerSku :keyword load_balancer_profile: Profile of the cluster load balancer. @@ -1259,7 +1259,7 @@ class ContainerServiceSshConfiguration(msrest.serialization.Model): def __init__( self, *, - public_keys: List["ContainerServiceSshPublicKey"], + public_keys: List["_models.ContainerServiceSshPublicKey"], **kwargs ): """ @@ -1449,7 +1449,7 @@ def __init__( self, *, domain_name: Optional[str] = None, - endpoint_details: Optional[List["EndpointDetail"]] = None, + endpoint_details: Optional[List["_models.EndpointDetail"]] = None, **kwargs ): """ @@ -1515,7 +1515,7 @@ class ExtendedLocation(msrest.serialization.Model): :ivar name: The name of the extended location. :vartype name: str - :ivar type: The type of the extended location. Possible values include: "EdgeZone". + :ivar type: The type of the extended location. Known values are: "EdgeZone". :vartype type: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.ExtendedLocationTypes """ @@ -1529,13 +1529,13 @@ def __init__( self, *, name: Optional[str] = None, - type: Optional[Union[str, "ExtendedLocationTypes"]] = None, + type: Optional[Union[str, "_models.ExtendedLocationTypes"]] = None, **kwargs ): """ :keyword name: The name of the extended location. :paramtype name: str - :keyword type: The type of the extended location. Possible values include: "EdgeZone". + :keyword type: The type of the extended location. Known values are: "EdgeZone". :paramtype type: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.ExtendedLocationTypes """ @@ -1695,7 +1695,7 @@ class LinuxOSConfig(msrest.serialization.Model): def __init__( self, *, - sysctls: Optional["SysctlConfig"] = None, + sysctls: Optional["_models.SysctlConfig"] = None, transparent_huge_page_enabled: Optional[str] = None, transparent_huge_page_defrag: Optional[str] = None, swap_file_size_mb: Optional[int] = None, @@ -1764,8 +1764,8 @@ class MaintenanceConfiguration(SubResource): def __init__( self, *, - time_in_week: Optional[List["TimeInWeek"]] = None, - not_allowed_time: Optional[List["TimeSpan"]] = None, + time_in_week: Optional[List["_models.TimeInWeek"]] = None, + not_allowed_time: Optional[List["_models.TimeSpan"]] = None, **kwargs ): """ @@ -1807,7 +1807,7 @@ class MaintenanceConfigurationListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["MaintenanceConfiguration"]] = None, + value: Optional[List["_models.MaintenanceConfiguration"]] = None, **kwargs ): """ @@ -1997,8 +1997,8 @@ class ManagedCluster(Resource): :ivar security_profile: Security profile for the managed cluster. :vartype security_profile: ~azure.mgmt.containerservice.v2021_11_01_preview.models.ManagedClusterSecurityProfile - :ivar public_network_access: Allow or deny public network access for AKS. Possible values - include: "Enabled", "Disabled". + :ivar public_network_access: Allow or deny public network access for AKS. Known values are: + "Enabled", "Disabled". :vartype public_network_access: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.PublicNetworkAccess """ @@ -2066,35 +2066,35 @@ def __init__( *, location: str, tags: Optional[Dict[str, str]] = None, - sku: Optional["ManagedClusterSKU"] = None, - extended_location: Optional["ExtendedLocation"] = None, - identity: Optional["ManagedClusterIdentity"] = None, + sku: Optional["_models.ManagedClusterSKU"] = None, + extended_location: Optional["_models.ExtendedLocation"] = None, + identity: Optional["_models.ManagedClusterIdentity"] = None, kubernetes_version: Optional[str] = None, dns_prefix: Optional[str] = None, fqdn_subdomain: Optional[str] = None, - agent_pool_profiles: Optional[List["ManagedClusterAgentPoolProfile"]] = None, - linux_profile: Optional["ContainerServiceLinuxProfile"] = None, - windows_profile: Optional["ManagedClusterWindowsProfile"] = None, - service_principal_profile: Optional["ManagedClusterServicePrincipalProfile"] = None, - addon_profiles: Optional[Dict[str, "ManagedClusterAddonProfile"]] = None, - pod_identity_profile: Optional["ManagedClusterPodIdentityProfile"] = None, - oidc_issuer_profile: Optional["ManagedClusterOIDCIssuerProfile"] = None, + agent_pool_profiles: Optional[List["_models.ManagedClusterAgentPoolProfile"]] = None, + linux_profile: Optional["_models.ContainerServiceLinuxProfile"] = None, + windows_profile: Optional["_models.ManagedClusterWindowsProfile"] = None, + service_principal_profile: Optional["_models.ManagedClusterServicePrincipalProfile"] = None, + addon_profiles: Optional[Dict[str, "_models.ManagedClusterAddonProfile"]] = None, + pod_identity_profile: Optional["_models.ManagedClusterPodIdentityProfile"] = None, + oidc_issuer_profile: Optional["_models.ManagedClusterOIDCIssuerProfile"] = None, node_resource_group: Optional[str] = None, enable_rbac: Optional[bool] = None, enable_pod_security_policy: Optional[bool] = None, enable_namespace_resources: Optional[bool] = None, - network_profile: Optional["ContainerServiceNetworkProfile"] = None, - aad_profile: Optional["ManagedClusterAADProfile"] = None, - auto_upgrade_profile: Optional["ManagedClusterAutoUpgradeProfile"] = None, - auto_scaler_profile: Optional["ManagedClusterPropertiesAutoScalerProfile"] = None, - api_server_access_profile: Optional["ManagedClusterAPIServerAccessProfile"] = None, + network_profile: Optional["_models.ContainerServiceNetworkProfile"] = None, + aad_profile: Optional["_models.ManagedClusterAADProfile"] = None, + auto_upgrade_profile: Optional["_models.ManagedClusterAutoUpgradeProfile"] = None, + auto_scaler_profile: Optional["_models.ManagedClusterPropertiesAutoScalerProfile"] = None, + api_server_access_profile: Optional["_models.ManagedClusterAPIServerAccessProfile"] = None, disk_encryption_set_id: Optional[str] = None, - identity_profile: Optional[Dict[str, "UserAssignedIdentity"]] = None, - private_link_resources: Optional[List["PrivateLinkResource"]] = None, + identity_profile: Optional[Dict[str, "_models.UserAssignedIdentity"]] = None, + private_link_resources: Optional[List["_models.PrivateLinkResource"]] = None, disable_local_accounts: Optional[bool] = None, - http_proxy_config: Optional["ManagedClusterHTTPProxyConfig"] = None, - security_profile: Optional["ManagedClusterSecurityProfile"] = None, - public_network_access: Optional[Union[str, "PublicNetworkAccess"]] = None, + http_proxy_config: Optional["_models.ManagedClusterHTTPProxyConfig"] = None, + security_profile: Optional["_models.ManagedClusterSecurityProfile"] = None, + public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None, **kwargs ): """ @@ -2192,8 +2192,8 @@ def __init__( :keyword security_profile: Security profile for the managed cluster. :paramtype security_profile: ~azure.mgmt.containerservice.v2021_11_01_preview.models.ManagedClusterSecurityProfile - :keyword public_network_access: Allow or deny public network access for AKS. Possible values - include: "Enabled", "Disabled". + :keyword public_network_access: Allow or deny public network access for AKS. Known values are: + "Enabled", "Disabled". :paramtype public_network_access: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.PublicNetworkAccess """ @@ -2505,16 +2505,16 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS - `_. Possible values - include: "Managed", "Ephemeral". + `_. Known values are: + "Managed", "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Possible values include: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.KubeletDiskType - :ivar workload_runtime: Determines the type of workload a node can run. Possible values - include: "OCIContainer", "WasmWasi". + :ivar workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer", "WasmWasi". :vartype workload_runtime: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.WorkloadRuntime :ivar message_of_the_day: A base64-encoded string which will be written to /etc/motd after @@ -2533,11 +2533,11 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.OSType - :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Possible values include: "Ubuntu", "CBLMariner". + :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known + values are: "Ubuntu", "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. :vartype max_count: int @@ -2546,16 +2546,15 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it - defaults to Delete. Possible values include: "Delete", "Deallocate". + defaults to Delete. Known values are: "Delete", "Deallocate". :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.ScaleDownMode - :ivar type: The type of Agent Pool. Possible values include: "VirtualMachineScaleSets", + :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Possible values include: "System", - "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". :vartype mode: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.AgentPoolMode :ivar orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -2590,12 +2589,12 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Possible values include: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Possible values include: "Delete", - "Deallocate". Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which @@ -2627,7 +2626,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.GPUInstanceProfile :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool @@ -2694,41 +2693,41 @@ def __init__( count: Optional[int] = None, vm_size: Optional[str] = None, os_disk_size_gb: Optional[int] = None, - os_disk_type: Optional[Union[str, "OSDiskType"]] = None, - kubelet_disk_type: Optional[Union[str, "KubeletDiskType"]] = None, - workload_runtime: Optional[Union[str, "WorkloadRuntime"]] = None, + os_disk_type: Optional[Union[str, "_models.OSDiskType"]] = None, + kubelet_disk_type: Optional[Union[str, "_models.KubeletDiskType"]] = None, + workload_runtime: Optional[Union[str, "_models.WorkloadRuntime"]] = None, message_of_the_day: Optional[str] = None, vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", - os_sku: Optional[Union[str, "OSSKU"]] = None, + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - scale_down_mode: Optional[Union[str, "ScaleDownMode"]] = None, - type: Optional[Union[str, "AgentPoolType"]] = None, - mode: Optional[Union[str, "AgentPoolMode"]] = None, + scale_down_mode: Optional[Union[str, "_models.ScaleDownMode"]] = None, + type: Optional[Union[str, "_models.AgentPoolType"]] = None, + mode: Optional[Union[str, "_models.AgentPoolMode"]] = None, orchestrator_version: Optional[str] = None, - upgrade_settings: Optional["AgentPoolUpgradeSettings"] = None, - power_state: Optional["PowerState"] = None, + upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, + power_state: Optional["_models.PowerState"] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", spot_max_price: Optional[float] = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, proximity_placement_group_id: Optional[str] = None, - kubelet_config: Optional["KubeletConfig"] = None, - linux_os_config: Optional["LinuxOSConfig"] = None, + kubelet_config: Optional["_models.KubeletConfig"] = None, + linux_os_config: Optional["_models.LinuxOSConfig"] = None, enable_encryption_at_host: Optional[bool] = None, enable_ultra_ssd: Optional[bool] = None, enable_fips: Optional[bool] = None, - gpu_instance_profile: Optional[Union[str, "GPUInstanceProfile"]] = None, - creation_data: Optional["CreationData"] = None, + gpu_instance_profile: Optional[Union[str, "_models.GPUInstanceProfile"]] = None, + creation_data: Optional["_models.CreationData"] = None, capacity_reservation_group_id: Optional[str] = None, **kwargs ): @@ -2748,16 +2747,16 @@ def __init__( :keyword os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS - `_. Possible values - include: "Managed", "Ephemeral". + `_. Known values are: + "Managed", "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Possible values include: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.KubeletDiskType - :keyword workload_runtime: Determines the type of workload a node can run. Possible values - include: "OCIContainer", "WasmWasi". + :keyword workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer", "WasmWasi". :paramtype workload_runtime: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.WorkloadRuntime :keyword message_of_the_day: A base64-encoded string which will be written to /etc/motd after @@ -2776,11 +2775,11 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.OSType :keyword os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Possible values include: "Ubuntu", "CBLMariner". + Known values are: "Ubuntu", "CBLMariner". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -2789,16 +2788,15 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, - it defaults to Delete. Possible values include: "Delete", "Deallocate". + it defaults to Delete. Known values are: "Delete", "Deallocate". :paramtype scale_down_mode: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.ScaleDownMode - :keyword type: The type of Agent Pool. Possible values include: "VirtualMachineScaleSets", + :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Possible values include: "System", - "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.AgentPoolMode :keyword orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -2829,12 +2827,12 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Possible values include: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Possible values include: "Delete", - "Deallocate". Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which @@ -2868,7 +2866,7 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.GPUInstanceProfile @@ -2945,16 +2943,16 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS - `_. Possible values - include: "Managed", "Ephemeral". + `_. Known values are: + "Managed", "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Possible values include: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.KubeletDiskType - :ivar workload_runtime: Determines the type of workload a node can run. Possible values - include: "OCIContainer", "WasmWasi". + :ivar workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer", "WasmWasi". :vartype workload_runtime: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.WorkloadRuntime :ivar message_of_the_day: A base64-encoded string which will be written to /etc/motd after @@ -2973,11 +2971,11 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.OSType - :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Possible values include: "Ubuntu", "CBLMariner". + :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known + values are: "Ubuntu", "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. :vartype max_count: int @@ -2986,16 +2984,15 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it - defaults to Delete. Possible values include: "Delete", "Deallocate". + defaults to Delete. Known values are: "Delete", "Deallocate". :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.ScaleDownMode - :ivar type: The type of Agent Pool. Possible values include: "VirtualMachineScaleSets", + :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Possible values include: "System", - "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". :vartype mode: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.AgentPoolMode :ivar orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -3030,12 +3027,12 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Possible values include: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Possible values include: "Delete", - "Deallocate". Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which @@ -3067,7 +3064,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.GPUInstanceProfile :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool @@ -3139,41 +3136,41 @@ def __init__( count: Optional[int] = None, vm_size: Optional[str] = None, os_disk_size_gb: Optional[int] = None, - os_disk_type: Optional[Union[str, "OSDiskType"]] = None, - kubelet_disk_type: Optional[Union[str, "KubeletDiskType"]] = None, - workload_runtime: Optional[Union[str, "WorkloadRuntime"]] = None, + os_disk_type: Optional[Union[str, "_models.OSDiskType"]] = None, + kubelet_disk_type: Optional[Union[str, "_models.KubeletDiskType"]] = None, + workload_runtime: Optional[Union[str, "_models.WorkloadRuntime"]] = None, message_of_the_day: Optional[str] = None, vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", - os_sku: Optional[Union[str, "OSSKU"]] = None, + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - scale_down_mode: Optional[Union[str, "ScaleDownMode"]] = None, - type: Optional[Union[str, "AgentPoolType"]] = None, - mode: Optional[Union[str, "AgentPoolMode"]] = None, + scale_down_mode: Optional[Union[str, "_models.ScaleDownMode"]] = None, + type: Optional[Union[str, "_models.AgentPoolType"]] = None, + mode: Optional[Union[str, "_models.AgentPoolMode"]] = None, orchestrator_version: Optional[str] = None, - upgrade_settings: Optional["AgentPoolUpgradeSettings"] = None, - power_state: Optional["PowerState"] = None, + upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, + power_state: Optional["_models.PowerState"] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", spot_max_price: Optional[float] = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, proximity_placement_group_id: Optional[str] = None, - kubelet_config: Optional["KubeletConfig"] = None, - linux_os_config: Optional["LinuxOSConfig"] = None, + kubelet_config: Optional["_models.KubeletConfig"] = None, + linux_os_config: Optional["_models.LinuxOSConfig"] = None, enable_encryption_at_host: Optional[bool] = None, enable_ultra_ssd: Optional[bool] = None, enable_fips: Optional[bool] = None, - gpu_instance_profile: Optional[Union[str, "GPUInstanceProfile"]] = None, - creation_data: Optional["CreationData"] = None, + gpu_instance_profile: Optional[Union[str, "_models.GPUInstanceProfile"]] = None, + creation_data: Optional["_models.CreationData"] = None, capacity_reservation_group_id: Optional[str] = None, **kwargs ): @@ -3193,16 +3190,16 @@ def __init__( :keyword os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS - `_. Possible values - include: "Managed", "Ephemeral". + `_. Known values are: + "Managed", "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Possible values include: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.KubeletDiskType - :keyword workload_runtime: Determines the type of workload a node can run. Possible values - include: "OCIContainer", "WasmWasi". + :keyword workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer", "WasmWasi". :paramtype workload_runtime: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.WorkloadRuntime :keyword message_of_the_day: A base64-encoded string which will be written to /etc/motd after @@ -3221,11 +3218,11 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.OSType :keyword os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Possible values include: "Ubuntu", "CBLMariner". + Known values are: "Ubuntu", "CBLMariner". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -3234,16 +3231,15 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, - it defaults to Delete. Possible values include: "Delete", "Deallocate". + it defaults to Delete. Known values are: "Delete", "Deallocate". :paramtype scale_down_mode: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.ScaleDownMode - :keyword type: The type of Agent Pool. Possible values include: "VirtualMachineScaleSets", + :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Possible values include: "System", - "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.AgentPoolMode :keyword orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -3274,12 +3270,12 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Possible values include: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Possible values include: "Delete", - "Deallocate". Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which @@ -3313,7 +3309,7 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.GPUInstanceProfile @@ -3401,8 +3397,8 @@ class ManagedClusterAutoUpgradeProfile(msrest.serialization.Model): """Auto upgrade profile for a managed cluster. :ivar upgrade_channel: For more information see `setting the AKS cluster auto-upgrade channel - `_. Possible - values include: "rapid", "stable", "patch", "node-image", "none". + `_. Known values + are: "rapid", "stable", "patch", "node-image", "none". :vartype upgrade_channel: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.UpgradeChannel """ @@ -3414,13 +3410,13 @@ class ManagedClusterAutoUpgradeProfile(msrest.serialization.Model): def __init__( self, *, - upgrade_channel: Optional[Union[str, "UpgradeChannel"]] = None, + upgrade_channel: Optional[Union[str, "_models.UpgradeChannel"]] = None, **kwargs ): """ :keyword upgrade_channel: For more information see `setting the AKS cluster auto-upgrade channel `_. - Possible values include: "rapid", "stable", "patch", "node-image", "none". + Known values are: "rapid", "stable", "patch", "node-image", "none". :paramtype upgrade_channel: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.UpgradeChannel """ @@ -3486,7 +3482,7 @@ class ManagedClusterIdentity(msrest.serialization.Model): components. :vartype tenant_id: str :ivar type: For more information see `use managed identities in AKS - `_. Possible values include: + `_. Known values are: "SystemAssigned", "UserAssigned", "None". :vartype type: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.ResourceIdentityType @@ -3511,13 +3507,13 @@ class ManagedClusterIdentity(msrest.serialization.Model): def __init__( self, *, - type: Optional[Union[str, "ResourceIdentityType"]] = None, - user_assigned_identities: Optional[Dict[str, "ManagedServiceIdentityUserAssignedIdentitiesValue"]] = None, + type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, + user_assigned_identities: Optional[Dict[str, "_models.ManagedServiceIdentityUserAssignedIdentitiesValue"]] = None, **kwargs ): """ :keyword type: For more information see `use managed identities in AKS - `_. Possible values include: + `_. Known values are: "SystemAssigned", "UserAssigned", "None". :paramtype type: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.ResourceIdentityType @@ -3556,7 +3552,7 @@ class ManagedClusterListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["ManagedCluster"]] = None, + value: Optional[List["_models.ManagedCluster"]] = None, **kwargs ): """ @@ -3614,10 +3610,10 @@ class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): def __init__( self, *, - managed_outbound_i_ps: Optional["ManagedClusterLoadBalancerProfileManagedOutboundIPs"] = None, - outbound_ip_prefixes: Optional["ManagedClusterLoadBalancerProfileOutboundIPPrefixes"] = None, - outbound_i_ps: Optional["ManagedClusterLoadBalancerProfileOutboundIPs"] = None, - effective_outbound_i_ps: Optional[List["ResourceReference"]] = None, + managed_outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileManagedOutboundIPs"] = None, + outbound_ip_prefixes: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPPrefixes"] = None, + outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPs"] = None, + effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, allocated_outbound_ports: Optional[int] = 0, idle_timeout_in_minutes: Optional[int] = 30, enable_multiple_standard_load_balancers: Optional[bool] = None, @@ -3719,7 +3715,7 @@ class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.M def __init__( self, *, - public_ip_prefixes: Optional[List["ResourceReference"]] = None, + public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, **kwargs ): """ @@ -3746,7 +3742,7 @@ class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): def __init__( self, *, - public_i_ps: Optional[List["ResourceReference"]] = None, + public_i_ps: Optional[List["_models.ResourceReference"]] = None, **kwargs ): """ @@ -3817,8 +3813,8 @@ class ManagedClusterNATGatewayProfile(msrest.serialization.Model): def __init__( self, *, - managed_outbound_ip_profile: Optional["ManagedClusterManagedOutboundIPProfile"] = None, - effective_outbound_i_ps: Optional[List["ResourceReference"]] = None, + managed_outbound_ip_profile: Optional["_models.ManagedClusterManagedOutboundIPProfile"] = None, + effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, idle_timeout_in_minutes: Optional[int] = 4, **kwargs ): @@ -3891,8 +3887,8 @@ class ManagedClusterPodIdentity(msrest.serialization.Model): :vartype binding_selector: str :ivar identity: Required. The user assigned identity details. :vartype identity: ~azure.mgmt.containerservice.v2021_11_01_preview.models.UserAssignedIdentity - :ivar provisioning_state: The current provisioning state of the pod identity. Possible values - include: "Assigned", "Updating", "Deleting", "Failed". + :ivar provisioning_state: The current provisioning state of the pod identity. Known values are: + "Assigned", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.ManagedClusterPodIdentityProvisioningState :ivar provisioning_info: @@ -3922,7 +3918,7 @@ def __init__( *, name: str, namespace: str, - identity: "UserAssignedIdentity", + identity: "_models.UserAssignedIdentity", binding_selector: Optional[str] = None, **kwargs ): @@ -4024,8 +4020,8 @@ def __init__( *, enabled: Optional[bool] = None, allow_network_plugin_kubenet: Optional[bool] = None, - user_assigned_identities: Optional[List["ManagedClusterPodIdentity"]] = None, - user_assigned_identity_exceptions: Optional[List["ManagedClusterPodIdentityException"]] = None, + user_assigned_identities: Optional[List["_models.ManagedClusterPodIdentity"]] = None, + user_assigned_identity_exceptions: Optional[List["_models.ManagedClusterPodIdentityException"]] = None, **kwargs ): """ @@ -4066,7 +4062,7 @@ class ManagedClusterPodIdentityProvisioningError(msrest.serialization.Model): def __init__( self, *, - error: Optional["ManagedClusterPodIdentityProvisioningErrorBody"] = None, + error: Optional["_models.ManagedClusterPodIdentityProvisioningErrorBody"] = None, **kwargs ): """ @@ -4108,7 +4104,7 @@ def __init__( code: Optional[str] = None, message: Optional[str] = None, target: Optional[str] = None, - details: Optional[List["ManagedClusterPodIdentityProvisioningErrorBody"]] = None, + details: Optional[List["_models.ManagedClusterPodIdentityProvisioningErrorBody"]] = None, **kwargs ): """ @@ -4147,7 +4143,7 @@ class ManagedClusterPodIdentityProvisioningInfo(msrest.serialization.Model): def __init__( self, *, - error: Optional["ManagedClusterPodIdentityProvisioningError"] = None, + error: Optional["_models.ManagedClusterPodIdentityProvisioningError"] = None, **kwargs ): """ @@ -4168,8 +4164,8 @@ class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): :vartype kubernetes_version: str :ivar name: The Agent Pool name. :vartype name: str - :ivar os_type: Required. The operating system type. The default is Linux. Possible values - include: "Linux", "Windows". Default value: "Linux". + :ivar os_type: Required. The operating system type. The default is Linux. Known values are: + "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -4192,9 +4188,9 @@ def __init__( self, *, kubernetes_version: str, - os_type: Union[str, "OSType"] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", name: Optional[str] = None, - upgrades: Optional[List["ManagedClusterPoolUpgradeProfileUpgradesItem"]] = None, + upgrades: Optional[List["_models.ManagedClusterPoolUpgradeProfileUpgradesItem"]] = None, **kwargs ): """ @@ -4202,8 +4198,8 @@ def __init__( :paramtype kubernetes_version: str :keyword name: The Agent Pool name. :paramtype name: str - :keyword os_type: Required. The operating system type. The default is Linux. Possible values - include: "Linux", "Windows". Default value: "Linux". + :keyword os_type: Required. The operating system type. The default is Linux. Known values are: + "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: @@ -4255,8 +4251,7 @@ class ManagedClusterPropertiesAutoScalerProfile(msrest.serialization.Model): :vartype balance_similar_node_groups: str :ivar expander: If not specified, the default is 'random'. See `expanders `_ - for more information. Possible values include: "least-waste", "most-pods", "priority", - "random". + for more information. Known values are: "least-waste", "most-pods", "priority", "random". :vartype expander: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.Expander :ivar max_empty_bulk_delete: The default is 10. :vartype max_empty_bulk_delete: str @@ -4323,7 +4318,7 @@ def __init__( self, *, balance_similar_node_groups: Optional[str] = None, - expander: Optional[Union[str, "Expander"]] = None, + expander: Optional[Union[str, "_models.Expander"]] = None, max_empty_bulk_delete: Optional[str] = None, max_graceful_termination_sec: Optional[str] = None, max_node_provision_time: Optional[str] = None, @@ -4346,8 +4341,7 @@ def __init__( :paramtype balance_similar_node_groups: str :keyword expander: If not specified, the default is 'random'. See `expanders `_ - for more information. Possible values include: "least-waste", "most-pods", "priority", - "random". + for more information. Known values are: "least-waste", "most-pods", "priority", "random". :paramtype expander: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.Expander :keyword max_empty_bulk_delete: The default is 10. :paramtype max_empty_bulk_delete: str @@ -4425,7 +4419,7 @@ class ManagedClusterSecurityProfile(msrest.serialization.Model): def __init__( self, *, - azure_defender: Optional["ManagedClusterSecurityProfileAzureDefender"] = None, + azure_defender: Optional["_models.ManagedClusterSecurityProfileAzureDefender"] = None, **kwargs ): """ @@ -4514,12 +4508,12 @@ def __init__( class ManagedClusterSKU(msrest.serialization.Model): """The SKU of a Managed Cluster. - :ivar name: The name of a managed cluster SKU. Possible values include: "Basic". + :ivar name: The name of a managed cluster SKU. Known values are: "Basic". :vartype name: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.ManagedClusterSKUName :ivar tier: If not specified, the default is 'Free'. See `uptime SLA - `_ for more details. Possible values include: - "Paid", "Free". + `_ for more details. Known values are: "Paid", + "Free". :vartype tier: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.ManagedClusterSKUTier """ @@ -4532,17 +4526,17 @@ class ManagedClusterSKU(msrest.serialization.Model): def __init__( self, *, - name: Optional[Union[str, "ManagedClusterSKUName"]] = None, - tier: Optional[Union[str, "ManagedClusterSKUTier"]] = None, + name: Optional[Union[str, "_models.ManagedClusterSKUName"]] = None, + tier: Optional[Union[str, "_models.ManagedClusterSKUTier"]] = None, **kwargs ): """ - :keyword name: The name of a managed cluster SKU. Possible values include: "Basic". + :keyword name: The name of a managed cluster SKU. Known values are: "Basic". :paramtype name: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.ManagedClusterSKUName :keyword tier: If not specified, the default is 'Free'. See `uptime SLA - `_ for more details. Possible values include: - "Paid", "Free". + `_ for more details. Known values are: "Paid", + "Free". :paramtype tier: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.ManagedClusterSKUTier """ @@ -4592,8 +4586,8 @@ class ManagedClusterUpgradeProfile(msrest.serialization.Model): def __init__( self, *, - control_plane_profile: "ManagedClusterPoolUpgradeProfile", - agent_pool_profiles: List["ManagedClusterPoolUpgradeProfile"], + control_plane_profile: "_models.ManagedClusterPoolUpgradeProfile", + agent_pool_profiles: List["_models.ManagedClusterPoolUpgradeProfile"], **kwargs ): """ @@ -4635,8 +4629,8 @@ class ManagedClusterWindowsProfile(msrest.serialization.Model): "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!". :vartype admin_password: str :ivar license_type: The license type to use for Windows VMs. See `Azure Hybrid User Benefits - `_ for more details. Possible values - include: "None", "Windows_Server". + `_ for more details. Known values are: + "None", "Windows_Server". :vartype license_type: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.LicenseType :ivar enable_csi_proxy: For more details on CSI proxy, see the `CSI proxy GitHub repo @@ -4664,9 +4658,9 @@ def __init__( *, admin_username: str, admin_password: Optional[str] = None, - license_type: Optional[Union[str, "LicenseType"]] = None, + license_type: Optional[Union[str, "_models.LicenseType"]] = None, enable_csi_proxy: Optional[bool] = None, - gmsa_profile: Optional["WindowsGmsaProfile"] = None, + gmsa_profile: Optional["_models.WindowsGmsaProfile"] = None, **kwargs ): """ @@ -4687,8 +4681,8 @@ def __init__( "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!". :paramtype admin_password: str :keyword license_type: The license type to use for Windows VMs. See `Azure Hybrid User Benefits - `_ for more details. Possible values - include: "None", "Windows_Server". + `_ for more details. Known values are: + "None", "Windows_Server". :paramtype license_type: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.LicenseType :keyword enable_csi_proxy: For more details on CSI proxy, see the `CSI proxy GitHub repo @@ -4852,7 +4846,7 @@ class OSOptionProfile(msrest.serialization.Model): def __init__( self, *, - os_option_property_list: List["OSOptionProperty"], + os_option_property_list: List["_models.OSOptionProperty"], **kwargs ): """ @@ -4926,7 +4920,7 @@ def __init__( self, *, category: Optional[str] = None, - endpoints: Optional[List["EndpointDependency"]] = None, + endpoints: Optional[List["_models.EndpointDependency"]] = None, **kwargs ): """ @@ -4969,7 +4963,7 @@ class OutboundEnvironmentEndpointCollection(msrest.serialization.Model): def __init__( self, *, - value: List["OutboundEnvironmentEndpoint"], + value: List["_models.OutboundEnvironmentEndpoint"], **kwargs ): """ @@ -4985,8 +4979,8 @@ def __init__( class PowerState(msrest.serialization.Model): """Describes the Power State of the cluster. - :ivar code: Tells whether the cluster is Running or Stopped. Possible values include: - "Running", "Stopped". + :ivar code: Tells whether the cluster is Running or Stopped. Known values are: "Running", + "Stopped". :vartype code: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.Code """ @@ -4997,12 +4991,12 @@ class PowerState(msrest.serialization.Model): def __init__( self, *, - code: Optional[Union[str, "Code"]] = None, + code: Optional[Union[str, "_models.Code"]] = None, **kwargs ): """ - :keyword code: Tells whether the cluster is Running or Stopped. Possible values include: - "Running", "Stopped". + :keyword code: Tells whether the cluster is Running or Stopped. Known values are: "Running", + "Stopped". :paramtype code: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.Code """ super(PowerState, self).__init__(**kwargs) @@ -5045,7 +5039,7 @@ class PrivateEndpointConnection(msrest.serialization.Model): :vartype name: str :ivar type: The resource type. :vartype type: str - :ivar provisioning_state: The current provisioning state. Possible values include: "Succeeded", + :ivar provisioning_state: The current provisioning state. Known values are: "Succeeded", "Creating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.PrivateEndpointConnectionProvisioningState @@ -5077,8 +5071,8 @@ class PrivateEndpointConnection(msrest.serialization.Model): def __init__( self, *, - private_endpoint: Optional["PrivateEndpoint"] = None, - private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, + private_endpoint: Optional["_models.PrivateEndpoint"] = None, + private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionState"] = None, **kwargs ): """ @@ -5114,7 +5108,7 @@ class PrivateEndpointConnectionListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["PrivateEndpointConnection"]] = None, + value: Optional[List["_models.PrivateEndpointConnection"]] = None, **kwargs ): """ @@ -5205,7 +5199,7 @@ class PrivateLinkResourcesListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["PrivateLinkResource"]] = None, + value: Optional[List["_models.PrivateLinkResource"]] = None, **kwargs ): """ @@ -5220,7 +5214,7 @@ def __init__( class PrivateLinkServiceConnectionState(msrest.serialization.Model): """The state of a private link service connection. - :ivar status: The private link service connection status. Possible values include: "Pending", + :ivar status: The private link service connection status. Known values are: "Pending", "Approved", "Rejected", "Disconnected". :vartype status: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.ConnectionStatus @@ -5236,13 +5230,13 @@ class PrivateLinkServiceConnectionState(msrest.serialization.Model): def __init__( self, *, - status: Optional[Union[str, "ConnectionStatus"]] = None, + status: Optional[Union[str, "_models.ConnectionStatus"]] = None, description: Optional[str] = None, **kwargs ): """ - :keyword status: The private link service connection status. Possible values include: - "Pending", "Approved", "Rejected", "Disconnected". + :keyword status: The private link service connection status. Known values are: "Pending", + "Approved", "Rejected", "Disconnected". :paramtype status: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.ConnectionStatus :keyword description: The private link service connection description. @@ -5402,7 +5396,7 @@ class Snapshot(Resource): :ivar creation_data: CreationData to be used to specify the source agent pool resource ID to create this snapshot. :vartype creation_data: ~azure.mgmt.containerservice.v2021_11_01_preview.models.CreationData - :ivar snapshot_type: The type of a snapshot. The default is NodePool. Possible values include: + :ivar snapshot_type: The type of a snapshot. The default is NodePool. Known values are: "NodePool". Default value: "NodePool". :vartype snapshot_type: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.SnapshotType @@ -5410,11 +5404,11 @@ class Snapshot(Resource): :vartype kubernetes_version: str :ivar node_image_version: The version of node image. :vartype node_image_version: str - :ivar os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.OSType - :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Possible values include: "Ubuntu", "CBLMariner". + :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known + values are: "Ubuntu", "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.OSSKU :ivar vm_size: The size of the VM. :vartype vm_size: str @@ -5458,8 +5452,8 @@ def __init__( *, location: str, tags: Optional[Dict[str, str]] = None, - creation_data: Optional["CreationData"] = None, - snapshot_type: Optional[Union[str, "SnapshotType"]] = "NodePool", + creation_data: Optional["_models.CreationData"] = None, + snapshot_type: Optional[Union[str, "_models.SnapshotType"]] = "NodePool", **kwargs ): """ @@ -5470,8 +5464,8 @@ def __init__( :keyword creation_data: CreationData to be used to specify the source agent pool resource ID to create this snapshot. :paramtype creation_data: ~azure.mgmt.containerservice.v2021_11_01_preview.models.CreationData - :keyword snapshot_type: The type of a snapshot. The default is NodePool. Possible values - include: "NodePool". Default value: "NodePool". + :keyword snapshot_type: The type of a snapshot. The default is NodePool. Known values are: + "NodePool". Default value: "NodePool". :paramtype snapshot_type: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.SnapshotType """ @@ -5510,7 +5504,7 @@ class SnapshotListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["Snapshot"]] = None, + value: Optional[List["_models.Snapshot"]] = None, **kwargs ): """ @@ -5741,7 +5735,7 @@ class SystemData(msrest.serialization.Model): :ivar created_by: The identity that created the resource. :vartype created_by: str - :ivar created_by_type: The type of identity that created the resource. Possible values include: + :ivar created_by_type: The type of identity that created the resource. Known values are: "User", "Application", "ManagedIdentity", "Key". :vartype created_by_type: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.CreatedByType @@ -5749,8 +5743,8 @@ class SystemData(msrest.serialization.Model): :vartype created_at: ~datetime.datetime :ivar last_modified_by: The identity that last modified the resource. :vartype last_modified_by: str - :ivar last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". + :ivar last_modified_by_type: The type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", "Key". :vartype last_modified_by_type: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.CreatedByType :ivar last_modified_at: The type of identity that last modified the resource. @@ -5770,26 +5764,26 @@ def __init__( self, *, created_by: Optional[str] = None, - created_by_type: Optional[Union[str, "CreatedByType"]] = None, + created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, created_at: Optional[datetime.datetime] = None, last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[Union[str, "CreatedByType"]] = None, + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, last_modified_at: Optional[datetime.datetime] = None, **kwargs ): """ :keyword created_by: The identity that created the resource. :paramtype created_by: str - :keyword created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". + :keyword created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", "Key". :paramtype created_by_type: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.CreatedByType :keyword created_at: The UTC timestamp of resource creation. :paramtype created_at: ~datetime.datetime :keyword last_modified_by: The identity that last modified the resource. :paramtype last_modified_by: str - :keyword last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". + :keyword last_modified_by_type: The type of identity that last modified the resource. Known + values are: "User", "Application", "ManagedIdentity", "Key". :paramtype last_modified_by_type: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.CreatedByType :keyword last_modified_at: The type of identity that last modified the resource. @@ -5832,8 +5826,8 @@ def __init__( class TimeInWeek(msrest.serialization.Model): """Time in a week. - :ivar day: The day of the week. Possible values include: "Sunday", "Monday", "Tuesday", - "Wednesday", "Thursday", "Friday", "Saturday". + :ivar day: The day of the week. Known values are: "Sunday", "Monday", "Tuesday", "Wednesday", + "Thursday", "Friday", "Saturday". :vartype day: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.WeekDay :ivar hour_slots: Each integer hour represents a time range beginning at 0m after the hour ending at the next hour (non-inclusive). 0 corresponds to 00:00 UTC, 23 corresponds to 23:00 @@ -5849,12 +5843,12 @@ class TimeInWeek(msrest.serialization.Model): def __init__( self, *, - day: Optional[Union[str, "WeekDay"]] = None, + day: Optional[Union[str, "_models.WeekDay"]] = None, hour_slots: Optional[List[int]] = None, **kwargs ): """ - :keyword day: The day of the week. Possible values include: "Sunday", "Monday", "Tuesday", + :keyword day: The day of the week. Known values are: "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday". :paramtype day: str or ~azure.mgmt.containerservice.v2021_11_01_preview.models.WeekDay :keyword hour_slots: Each integer hour represents a time range beginning at 0m after the hour diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/models/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/models/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/operations/__init__.py index 5e1e5e72fa59..e0748876288c 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/operations/__init__.py @@ -15,6 +15,9 @@ from ._resolve_private_link_service_id_operations import ResolvePrivateLinkServiceIdOperations from ._snapshots_operations import SnapshotsOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'Operations', 'ManagedClustersOperations', @@ -25,3 +28,5 @@ 'ResolvePrivateLinkServiceIdOperations', 'SnapshotsOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/operations/_agent_pools_operations.py index 91af019fa375..9a53fd417dfa 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/operations/_agent_pools_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -35,9 +35,12 @@ def build_list_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools") # pylint: disable=line-too-long path_format_arguments = { @@ -49,18 +52,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -72,9 +73,12 @@ def build_get_request( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -87,18 +91,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -109,14 +111,17 @@ def build_create_or_update_request_initial( resource_name: str, agent_pool_name: str, *, - json: JSONType = None, + json: Optional[_models.AgentPool] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -129,20 +134,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -156,9 +159,12 @@ def build_delete_request_initial( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -171,18 +177,16 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -194,9 +198,12 @@ def build_get_upgrade_profile_request( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default") # pylint: disable=line-too-long path_format_arguments = { @@ -209,18 +216,16 @@ def build_get_upgrade_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -231,9 +236,12 @@ def build_get_available_agent_pool_versions_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions") # pylint: disable=line-too-long path_format_arguments = { @@ -245,18 +253,16 @@ def build_get_available_agent_pool_versions_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -268,9 +274,12 @@ def build_upgrade_node_image_version_request_initial( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion") # pylint: disable=line-too-long path_format_arguments = { @@ -283,42 +292,38 @@ def build_upgrade_node_image_version_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class AgentPoolsOperations(object): - """AgentPoolsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class AgentPoolsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_11_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_11_01_preview.ContainerServiceClient`'s + :attr:`agent_pools` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -326,7 +331,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Iterable["_models.AgentPoolListResult"]: + ) -> Iterable[_models.AgentPoolListResult]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. @@ -341,13 +346,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_11_01_preview.models.AgentPoolListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -357,9 +365,11 @@ def prepare_request(next_link=None): resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -369,9 +379,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -411,7 +423,7 @@ def get( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPool": + ) -> _models.AgentPool: """Gets the specified managed cluster agent pool. Gets the specified managed cluster agent pool. @@ -427,13 +439,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.AgentPool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] request = build_get_request( @@ -443,11 +458,13 @@ def get( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -473,17 +490,20 @@ def _create_or_update_initial( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> "_models.AgentPool": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] + ) -> _models.AgentPool: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] _json = self._serialize.body(parameters, 'AgentPool') @@ -496,11 +516,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -531,9 +553,9 @@ def begin_create_or_update( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> LROPoller["_models.AgentPool"]: + ) -> LROPoller[_models.AgentPool]: """Creates or updates an agent pool in the specified managed cluster. Creates or updates an agent pool in the specified managed cluster. @@ -559,17 +581,20 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_11_01_preview.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, @@ -577,20 +602,27 @@ def begin_create_or_update( 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): - response = pipeline_response.http_response deserialized = self._deserialize('AgentPool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -610,13 +642,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements agent_pool_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -626,11 +661,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -677,21 +714,26 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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) @@ -701,8 +743,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -722,7 +770,7 @@ def get_upgrade_profile( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPoolUpgradeProfile": + ) -> _models.AgentPoolUpgradeProfile: """Gets the upgrade profile for an agent pool. Gets the upgrade profile for an agent pool. @@ -738,13 +786,16 @@ def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.AgentPoolUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] request = build_get_upgrade_profile_request( @@ -754,11 +805,13 @@ def get_upgrade_profile( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -785,7 +838,7 @@ def get_available_agent_pool_versions( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.AgentPoolAvailableVersions": + ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported Kubernetes versions for the specified agent pool. See `supported Kubernetes versions @@ -801,13 +854,16 @@ def get_available_agent_pool_versions( :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.AgentPoolAvailableVersions :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolAvailableVersions"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] request = build_get_available_agent_pool_versions_request( @@ -816,11 +872,13 @@ def get_available_agent_pool_versions( resource_name=resource_name, api_version=api_version, template_url=self.get_available_agent_pool_versions.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -847,14 +905,17 @@ def _upgrade_node_image_version_initial( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> Optional["_models.AgentPool"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.AgentPool"]] + ) -> Optional[_models.AgentPool]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] request = build_upgrade_node_image_version_request_initial( @@ -864,11 +925,13 @@ def _upgrade_node_image_version_initial( agent_pool_name=agent_pool_name, api_version=api_version, template_url=self._upgrade_node_image_version_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -901,7 +964,7 @@ def begin_upgrade_node_image_version( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> LROPoller["_models.AgentPool"]: + ) -> LROPoller[_models.AgentPool]: """Upgrades the node image version of an agent pool to the latest. Upgrading the node image version of an agent pool applies the newest OS and runtime updates to @@ -927,21 +990,26 @@ def begin_upgrade_node_image_version( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_11_01_preview.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._upgrade_node_image_version_initial( + raw_result = self._upgrade_node_image_version_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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) @@ -957,8 +1025,14 @@ def get_long_running_output(pipeline_response): return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/operations/_maintenance_configurations_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/operations/_maintenance_configurations_operations.py index 54637bbca5ae..3c94225e5e51 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/operations/_maintenance_configurations_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/operations/_maintenance_configurations_operations.py @@ -16,12 +16,12 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -33,9 +33,12 @@ def build_list_by_managed_cluster_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations") # pylint: disable=line-too-long path_format_arguments = { @@ -47,18 +50,16 @@ def build_list_by_managed_cluster_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -70,9 +71,12 @@ def build_get_request( config_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long path_format_arguments = { @@ -85,18 +89,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -107,14 +109,17 @@ def build_create_or_update_request( resource_name: str, config_name: str, *, - json: JSONType = None, + json: Optional[_models.MaintenanceConfiguration] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long path_format_arguments = { @@ -127,20 +132,18 @@ def build_create_or_update_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -154,9 +157,12 @@ def build_delete_request( config_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long path_format_arguments = { @@ -169,42 +175,38 @@ def build_delete_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class MaintenanceConfigurationsOperations(object): - """MaintenanceConfigurationsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class MaintenanceConfigurationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_11_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_11_01_preview.ContainerServiceClient`'s + :attr:`maintenance_configurations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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_by_managed_cluster( @@ -212,7 +214,7 @@ def list_by_managed_cluster( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Iterable["_models.MaintenanceConfigurationListResult"]: + ) -> Iterable[_models.MaintenanceConfigurationListResult]: """Gets a list of maintenance configurations in the specified managed cluster. Gets a list of maintenance configurations in the specified managed cluster. @@ -228,13 +230,16 @@ def list_by_managed_cluster( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_11_01_preview.models.MaintenanceConfigurationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfigurationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfigurationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -244,9 +249,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=self.list_by_managed_cluster.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -256,9 +263,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -298,7 +307,7 @@ def get( resource_name: str, config_name: str, **kwargs: Any - ) -> "_models.MaintenanceConfiguration": + ) -> _models.MaintenanceConfiguration: """Gets the specified maintenance configuration of a managed cluster. Gets the specified maintenance configuration of a managed cluster. @@ -314,13 +323,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.MaintenanceConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfiguration"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] request = build_get_request( @@ -330,11 +342,13 @@ def get( config_name=config_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -361,9 +375,9 @@ def create_or_update( resource_group_name: str, resource_name: str, config_name: str, - parameters: "_models.MaintenanceConfiguration", + parameters: _models.MaintenanceConfiguration, **kwargs: Any - ) -> "_models.MaintenanceConfiguration": + ) -> _models.MaintenanceConfiguration: """Creates or updates a maintenance configuration in the specified managed cluster. Creates or updates a maintenance configuration in the specified managed cluster. @@ -382,14 +396,17 @@ def create_or_update( :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.MaintenanceConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfiguration"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] _json = self._serialize.body(parameters, 'MaintenanceConfiguration') @@ -402,11 +419,13 @@ def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -450,13 +469,16 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -466,11 +488,13 @@ def delete( # pylint: disable=inconsistent-return-statements config_name=config_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/operations/_managed_clusters_operations.py index 7003393f0cef..5a72d77a0123 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/operations/_managed_clusters_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -36,9 +36,12 @@ def build_get_os_options_request( resource_type: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default") # pylint: disable=line-too-long path_format_arguments = { @@ -49,20 +52,18 @@ def build_get_os_options_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if resource_type is not None: - _query_parameters['resource-type'] = _SERIALIZER.query("resource_type", resource_type, 'str') + _params['resource-type'] = _SERIALIZER.query("resource_type", resource_type, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -71,9 +72,12 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters") path_format_arguments = { @@ -83,18 +87,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -104,9 +106,12 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters") # pylint: disable=line-too-long path_format_arguments = { @@ -117,18 +122,16 @@ def build_list_by_resource_group_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -139,9 +142,12 @@ def build_get_upgrade_profile_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default") # pylint: disable=line-too-long path_format_arguments = { @@ -153,18 +159,16 @@ def build_get_upgrade_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -176,9 +180,12 @@ def build_get_access_profile_request( role_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -191,18 +198,16 @@ def build_get_access_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -215,9 +220,12 @@ def build_list_cluster_admin_credentials_request( server_fqdn: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -229,20 +237,18 @@ def build_list_cluster_admin_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if server_fqdn is not None: - _query_parameters['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -255,9 +261,12 @@ def build_list_cluster_user_credentials_request( server_fqdn: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -269,20 +278,18 @@ def build_list_cluster_user_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if server_fqdn is not None: - _query_parameters['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -295,9 +302,12 @@ def build_list_cluster_monitoring_user_credentials_request( server_fqdn: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -309,20 +319,18 @@ def build_list_cluster_monitoring_user_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if server_fqdn is not None: - _query_parameters['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -333,9 +341,12 @@ def build_get_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -347,18 +358,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -368,14 +377,17 @@ def build_create_or_update_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedCluster] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -387,20 +399,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -412,14 +422,17 @@ def build_update_tags_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.TagsObject] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -431,20 +444,18 @@ def build_update_tags_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -457,9 +468,12 @@ def build_delete_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -471,18 +485,16 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -492,14 +504,17 @@ def build_reset_service_principal_profile_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedClusterServicePrincipalProfile] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile") # pylint: disable=line-too-long path_format_arguments = { @@ -511,20 +526,18 @@ def build_reset_service_principal_profile_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -536,14 +549,17 @@ def build_reset_aad_profile_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedClusterAADProfile] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile") # pylint: disable=line-too-long path_format_arguments = { @@ -555,20 +571,18 @@ def build_reset_aad_profile_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -581,9 +595,12 @@ def build_rotate_cluster_certificates_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates") # pylint: disable=line-too-long path_format_arguments = { @@ -595,18 +612,16 @@ def build_rotate_cluster_certificates_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -617,9 +632,12 @@ def build_stop_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop") # pylint: disable=line-too-long path_format_arguments = { @@ -631,18 +649,16 @@ def build_stop_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -653,9 +669,12 @@ def build_start_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start") # pylint: disable=line-too-long path_format_arguments = { @@ -667,18 +686,16 @@ def build_start_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -688,14 +705,17 @@ def build_run_command_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.RunCommandRequest] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand") # pylint: disable=line-too-long path_format_arguments = { @@ -707,20 +727,18 @@ def build_run_command_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -734,9 +752,12 @@ def build_get_command_result_request( command_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}") # pylint: disable=line-too-long path_format_arguments = { @@ -749,18 +770,16 @@ def build_get_command_result_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -771,9 +790,12 @@ def build_list_outbound_network_dependencies_endpoints_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints") # pylint: disable=line-too-long path_format_arguments = { @@ -785,42 +807,38 @@ def build_list_outbound_network_dependencies_endpoints_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class ManagedClustersOperations(object): # pylint: disable=too-many-public-methods - """ManagedClustersOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ManagedClustersOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_11_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_11_01_preview.ContainerServiceClient`'s + :attr:`managed_clusters` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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_os_options( @@ -828,7 +846,7 @@ def get_os_options( location: str, resource_type: Optional[str] = None, **kwargs: Any - ) -> "_models.OSOptionProfile": + ) -> _models.OSOptionProfile: """Gets supported OS options in the specified subscription. Gets supported OS options in the specified subscription. @@ -843,13 +861,16 @@ def get_os_options( :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.OSOptionProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OSOptionProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OSOptionProfile] request = build_get_os_options_request( @@ -858,11 +879,13 @@ def get_os_options( api_version=api_version, resource_type=resource_type, template_url=self.get_os_options.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -887,7 +910,7 @@ def get_os_options( def list( self, **kwargs: Any - ) -> Iterable["_models.ManagedClusterListResult"]: + ) -> Iterable[_models.ManagedClusterListResult]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. @@ -899,13 +922,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_11_01_preview.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -913,9 +939,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -923,9 +951,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -963,7 +993,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.ManagedClusterListResult"]: + ) -> Iterable[_models.ManagedClusterListResult]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. @@ -977,13 +1007,16 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_11_01_preview.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -992,9 +1025,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -1003,9 +1038,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -1044,7 +1081,7 @@ def get_upgrade_profile( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedClusterUpgradeProfile": + ) -> _models.ManagedClusterUpgradeProfile: """Gets the upgrade profile of a managed cluster. Gets the upgrade profile of a managed cluster. @@ -1058,13 +1095,16 @@ def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.ManagedClusterUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] request = build_get_upgrade_profile_request( @@ -1073,11 +1113,13 @@ def get_upgrade_profile( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1105,7 +1147,7 @@ def get_access_profile( resource_name: str, role_name: str, **kwargs: Any - ) -> "_models.ManagedClusterAccessProfile": + ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. **WARNING**\ : This API will be deprecated. Instead use `ListClusterUserCredentials @@ -1124,13 +1166,16 @@ def get_access_profile( :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.ManagedClusterAccessProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterAccessProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] request = build_get_access_profile_request( @@ -1140,11 +1185,13 @@ def get_access_profile( role_name=role_name, api_version=api_version, template_url=self.get_access_profile.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1172,7 +1219,7 @@ def list_cluster_admin_credentials( resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Lists the admin credentials of a managed cluster. Lists the admin credentials of a managed cluster. @@ -1188,13 +1235,16 @@ def list_cluster_admin_credentials( :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_admin_credentials_request( @@ -1204,11 +1254,13 @@ def list_cluster_admin_credentials( api_version=api_version, server_fqdn=server_fqdn, template_url=self.list_cluster_admin_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1236,7 +1288,7 @@ def list_cluster_user_credentials( resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Lists the user credentials of a managed cluster. Lists the user credentials of a managed cluster. @@ -1252,13 +1304,16 @@ def list_cluster_user_credentials( :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_user_credentials_request( @@ -1268,11 +1323,13 @@ def list_cluster_user_credentials( api_version=api_version, server_fqdn=server_fqdn, template_url=self.list_cluster_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1300,7 +1357,7 @@ def list_cluster_monitoring_user_credentials( resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Lists the cluster monitoring user credentials of a managed cluster. Lists the cluster monitoring user credentials of a managed cluster. @@ -1316,13 +1373,16 @@ def list_cluster_monitoring_user_credentials( :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_monitoring_user_credentials_request( @@ -1332,11 +1392,13 @@ def list_cluster_monitoring_user_credentials( api_version=api_version, server_fqdn=server_fqdn, template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1363,7 +1425,7 @@ def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedCluster": + ) -> _models.ManagedCluster: """Gets a managed cluster. Gets a managed cluster. @@ -1377,13 +1439,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.ManagedCluster :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] request = build_get_request( @@ -1392,11 +1457,13 @@ def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1421,17 +1488,20 @@ def _create_or_update_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'ManagedCluster') @@ -1443,11 +1513,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1477,9 +1549,9 @@ def begin_create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> LROPoller["_models.ManagedCluster"]: + ) -> LROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. Creates or updates a managed cluster. @@ -1504,37 +1576,47 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_11_01_preview.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1551,17 +1633,20 @@ def _update_tags_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'TagsObject') @@ -1573,11 +1658,13 @@ def _update_tags_initial( content_type=content_type, json=_json, template_url=self._update_tags_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1603,9 +1690,9 @@ def begin_update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> LROPoller["_models.ManagedCluster"]: + ) -> LROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates tags on a managed cluster. @@ -1630,37 +1717,47 @@ def begin_update_tags( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_11_01_preview.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._update_tags_initial( + raw_result = self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1679,13 +1776,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -1694,11 +1794,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1742,20 +1844,25 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_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) @@ -1765,8 +1872,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1783,17 +1896,20 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') @@ -1805,11 +1921,13 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re content_type=content_type, json=_json, template_url=self._reset_service_principal_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1831,7 +1949,7 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> LROPoller[None]: """Reset the Service Principal Profile of a managed cluster. @@ -1857,23 +1975,28 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._reset_service_principal_profile_initial( + raw_result = self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1883,8 +2006,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1901,17 +2030,20 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') @@ -1923,11 +2055,13 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement content_type=content_type, json=_json, template_url=self._reset_aad_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1949,7 +2083,7 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> LROPoller[None]: """Reset the AAD Profile of a managed cluster. @@ -1975,23 +2109,28 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._reset_aad_profile_initial( + raw_result = self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -2001,8 +2140,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2021,13 +2166,16 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_rotate_cluster_certificates_request_initial( @@ -2036,11 +2184,13 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return resource_name=resource_name, api_version=api_version, template_url=self._rotate_cluster_certificates_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2085,20 +2235,25 @@ def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-st :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._rotate_cluster_certificates_initial( + raw_result = self._rotate_cluster_certificates_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) @@ -2108,8 +2263,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2128,13 +2289,16 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_stop_request_initial( @@ -2143,11 +2307,13 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_name, api_version=api_version, template_url=self._stop_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2195,20 +2361,25 @@ def begin_stop( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._stop_initial( + raw_result = self._stop_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) @@ -2218,8 +2389,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2238,13 +2415,16 @@ def _start_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_start_request_initial( @@ -2253,11 +2433,13 @@ def _start_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_name, api_version=api_version, template_url=self._start_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2302,20 +2484,25 @@ def begin_start( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._start_initial( + raw_result = self._start_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) @@ -2325,8 +2512,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2343,17 +2536,20 @@ def _run_command_initial( self, resource_group_name: str, resource_name: str, - request_payload: "_models.RunCommandRequest", + request_payload: _models.RunCommandRequest, **kwargs: Any - ) -> Optional["_models.RunCommandResult"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RunCommandResult"]] + ) -> Optional[_models.RunCommandResult]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] _json = self._serialize.body(request_payload, 'RunCommandRequest') @@ -2365,11 +2561,13 @@ def _run_command_initial( content_type=content_type, json=_json, template_url=self._run_command_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2397,9 +2595,9 @@ def begin_run_command( self, resource_group_name: str, resource_name: str, - request_payload: "_models.RunCommandRequest", + request_payload: _models.RunCommandRequest, **kwargs: Any - ) -> LROPoller["_models.RunCommandResult"]: + ) -> LROPoller[_models.RunCommandResult]: """Submits a command to run against the Managed Cluster. AKS will create a pod to run the command. This is primarily useful for private clusters. For @@ -2427,37 +2625,47 @@ def begin_run_command( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2021_11_01_preview.models.RunCommandResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.RunCommandResult] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._run_command_initial( + raw_result = self._run_command_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, request_payload=request_payload, 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): - response = pipeline_response.http_response deserialized = self._deserialize('RunCommandResult', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2477,7 +2685,7 @@ def get_command_result( resource_name: str, command_id: str, **kwargs: Any - ) -> Optional["_models.RunCommandResult"]: + ) -> Optional[_models.RunCommandResult]: """Gets the results of a command which has been run on the Managed Cluster. Gets the results of a command which has been run on the Managed Cluster. @@ -2493,13 +2701,16 @@ def get_command_result( :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.RunCommandResult or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RunCommandResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] request = build_get_command_result_request( @@ -2509,11 +2720,13 @@ def get_command_result( command_id=command_id, api_version=api_version, template_url=self.get_command_result.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2542,7 +2755,7 @@ def list_outbound_network_dependencies_endpoints( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Iterable["_models.OutboundEnvironmentEndpointCollection"]: + ) -> Iterable[_models.OutboundEnvironmentEndpointCollection]: """Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. @@ -2560,13 +2773,16 @@ def list_outbound_network_dependencies_endpoints( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_11_01_preview.models.OutboundEnvironmentEndpointCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OutboundEnvironmentEndpointCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -2576,9 +2792,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=self.list_outbound_network_dependencies_endpoints.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -2588,9 +2806,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/operations/_operations.py index eeb65ddb7f16..03d779d1927e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/operations/_operations.py @@ -16,6 +16,7 @@ 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 @@ -29,55 +30,54 @@ def build_list_request( **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.ContainerService/operations") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class Operations(object): - """Operations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_11_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_11_01_preview.ContainerServiceClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> Iterable["_models.OperationListResult"]: + ) -> Iterable[_models.OperationListResult]: """Gets a list of operations. Gets a list of operations. @@ -88,31 +88,38 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_11_01_preview.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/operations/_private_endpoint_connections_operations.py index 0215dd25630a..73b704530092 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/operations/_private_endpoint_connections_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast from msrest import Serializer @@ -16,13 +16,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -34,9 +34,12 @@ def build_list_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections") # pylint: disable=line-too-long path_format_arguments = { @@ -48,18 +51,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -71,9 +72,12 @@ def build_get_request( private_endpoint_connection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -86,18 +90,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -108,14 +110,17 @@ def build_update_request( resource_name: str, private_endpoint_connection_name: str, *, - json: JSONType = None, + json: Optional[_models.PrivateEndpointConnection] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -128,20 +133,18 @@ def build_update_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -155,9 +158,12 @@ def build_delete_request_initial( private_endpoint_connection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -170,42 +176,38 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class PrivateEndpointConnectionsOperations(object): - """PrivateEndpointConnectionsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class PrivateEndpointConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_11_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_11_01_preview.ContainerServiceClient`'s + :attr:`private_endpoint_connections` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -213,7 +215,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnectionListResult": + ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. To learn more about private clusters, see: @@ -229,13 +231,16 @@ def list( ~azure.mgmt.containerservice.v2021_11_01_preview.models.PrivateEndpointConnectionListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] request = build_list_request( @@ -244,11 +249,13 @@ def list( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -276,7 +283,7 @@ def get( resource_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Gets the specified private endpoint connection. To learn more about private clusters, see: @@ -293,13 +300,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] request = build_get_request( @@ -309,11 +319,13 @@ def get( private_endpoint_connection_name=private_endpoint_connection_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -340,9 +352,9 @@ def update( resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - parameters: "_models.PrivateEndpointConnection", + parameters: _models.PrivateEndpointConnection, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. Updates a private endpoint connection. @@ -361,14 +373,17 @@ def update( :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] _json = self._serialize.body(parameters, 'PrivateEndpointConnection') @@ -381,11 +396,13 @@ def update( content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -413,13 +430,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -429,11 +449,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name=private_endpoint_connection_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -480,21 +502,26 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -504,8 +531,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/operations/_private_link_resources_operations.py index 5867c45cab91..0a3882908953 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/operations/_private_link_resources_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/operations/_private_link_resources_operations.py @@ -15,6 +15,7 @@ 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 @@ -31,9 +32,12 @@ def build_list_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources") # pylint: disable=line-too-long path_format_arguments = { @@ -45,42 +49,38 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class PrivateLinkResourcesOperations(object): - """PrivateLinkResourcesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class PrivateLinkResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_11_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_11_01_preview.ContainerServiceClient`'s + :attr:`private_link_resources` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -88,7 +88,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.PrivateLinkResourcesListResult": + ) -> _models.PrivateLinkResourcesListResult: """Gets a list of private link resources in the specified managed cluster. To learn more about private clusters, see: @@ -103,13 +103,16 @@ def list( :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.PrivateLinkResourcesListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourcesListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] request = build_list_request( @@ -118,11 +121,13 @@ def list( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/operations/_resolve_private_link_service_id_operations.py index 5524a1f31289..0c61f5553650 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/operations/_resolve_private_link_service_id_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/operations/_resolve_private_link_service_id_operations.py @@ -15,12 +15,12 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -31,14 +31,17 @@ def build_post_request( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.PrivateLinkResource] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId") # pylint: disable=line-too-long path_format_arguments = { @@ -50,55 +53,51 @@ def build_post_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs ) -class ResolvePrivateLinkServiceIdOperations(object): - """ResolvePrivateLinkServiceIdOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ResolvePrivateLinkServiceIdOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_11_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_11_01_preview.ContainerServiceClient`'s + :attr:`resolve_private_link_service_id` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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 post( self, resource_group_name: str, resource_name: str, - parameters: "_models.PrivateLinkResource", + parameters: _models.PrivateLinkResource, **kwargs: Any - ) -> "_models.PrivateLinkResource": + ) -> _models.PrivateLinkResource: """Gets the private link service ID for the specified managed cluster. Gets the private link service ID for the specified managed cluster. @@ -114,14 +113,17 @@ def post( :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.PrivateLinkResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] _json = self._serialize.body(parameters, 'PrivateLinkResource') @@ -133,11 +135,13 @@ def post( content_type=content_type, json=_json, template_url=self.post.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/operations/_snapshots_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/operations/_snapshots_operations.py index 82721ea50396..0f88e9a37407 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/operations/_snapshots_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2021_11_01_preview/operations/_snapshots_operations.py @@ -16,12 +16,12 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -31,9 +31,12 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots") path_format_arguments = { @@ -43,18 +46,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -64,9 +65,12 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots") # pylint: disable=line-too-long path_format_arguments = { @@ -77,18 +81,16 @@ def build_list_by_resource_group_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -99,9 +101,12 @@ def build_get_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -113,18 +118,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -134,14 +137,17 @@ def build_create_or_update_request( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.Snapshot] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -153,20 +159,18 @@ def build_create_or_update_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -178,14 +182,17 @@ def build_update_tags_request( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.TagsObject] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -197,20 +204,18 @@ def build_update_tags_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -223,9 +228,12 @@ def build_delete_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -237,48 +245,44 @@ def build_delete_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class SnapshotsOperations(object): - """SnapshotsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class SnapshotsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2021_11_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2021_11_01_preview.ContainerServiceClient`'s + :attr:`snapshots` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> Iterable["_models.SnapshotListResult"]: + ) -> Iterable[_models.SnapshotListResult]: """Gets a list of snapshots in the specified subscription. Gets a list of snapshots in the specified subscription. @@ -289,13 +293,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_11_01_preview.models.SnapshotListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -303,9 +310,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -313,9 +322,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -353,7 +364,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.SnapshotListResult"]: + ) -> Iterable[_models.SnapshotListResult]: """Lists snapshots in the specified subscription and resource group. Lists snapshots in the specified subscription and resource group. @@ -366,13 +377,16 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2021_11_01_preview.models.SnapshotListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -381,9 +395,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -392,9 +408,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -433,7 +451,7 @@ def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.Snapshot": + ) -> _models.Snapshot: """Gets a snapshot. Gets a snapshot. @@ -447,13 +465,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.Snapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] request = build_get_request( @@ -462,11 +483,13 @@ def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -492,9 +515,9 @@ def create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.Snapshot", + parameters: _models.Snapshot, **kwargs: Any - ) -> "_models.Snapshot": + ) -> _models.Snapshot: """Creates or updates a snapshot. Creates or updates a snapshot. @@ -510,14 +533,17 @@ def create_or_update( :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.Snapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] _json = self._serialize.body(parameters, 'Snapshot') @@ -529,11 +555,13 @@ def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -563,9 +591,9 @@ def update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.Snapshot": + ) -> _models.Snapshot: """Updates tags on a snapshot. Updates tags on a snapshot. @@ -581,14 +609,17 @@ def update_tags( :rtype: ~azure.mgmt.containerservice.v2021_11_01_preview.models.Snapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] _json = self._serialize.body(parameters, 'TagsObject') @@ -600,11 +631,13 @@ def update_tags( content_type=content_type, json=_json, template_url=self.update_tags.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -645,13 +678,16 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-11-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-11-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -660,11 +696,13 @@ def delete( # pylint: disable=inconsistent-return-statements resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/__init__.py index 53c675bd95e2..37a5f9e02e6f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._container_service_client import ContainerServiceClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['ContainerServiceClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/_container_service_client.py index 1e33ea2dbd36..8be30540f524 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/_container_service_client.py @@ -74,14 +74,30 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.managed_clusters = ManagedClustersOperations(self._client, self._config, self._serialize, self._deserialize) - self.maintenance_configurations = MaintenanceConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) - self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) - self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations(self._client, self._config, self._serialize, self._deserialize) - self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_clusters = ManagedClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.maintenance_configurations = MaintenanceConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.agent_pools = AgentPoolsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.snapshots = SnapshotsOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/__init__.py index 53c675bd95e2..37a5f9e02e6f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._container_service_client import ContainerServiceClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['ContainerServiceClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/_container_service_client.py index bd3d0758606e..1e9776871620 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/_container_service_client.py @@ -75,14 +75,30 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.managed_clusters = ManagedClustersOperations(self._client, self._config, self._serialize, self._deserialize) - self.maintenance_configurations = MaintenanceConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) - self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) - self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations(self._client, self._config, self._serialize, self._deserialize) - self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_clusters = ManagedClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.maintenance_configurations = MaintenanceConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.agent_pools = AgentPoolsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.snapshots = SnapshotsOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/operations/__init__.py index 5e1e5e72fa59..e0748876288c 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/operations/__init__.py @@ -15,6 +15,9 @@ from ._resolve_private_link_service_id_operations import ResolvePrivateLinkServiceIdOperations from ._snapshots_operations import SnapshotsOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'Operations', 'ManagedClustersOperations', @@ -25,3 +28,5 @@ 'ResolvePrivateLinkServiceIdOperations', 'SnapshotsOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/operations/_agent_pools_operations.py index e02dd2ef56cc..e03f43a21963 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/operations/_agent_pools_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. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ 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 @@ -26,26 +27,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class AgentPoolsOperations: - """AgentPoolsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_01_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_01_01.aio.ContainerServiceClient`'s + :attr:`agent_pools` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -53,7 +52,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> AsyncIterable["_models.AgentPoolListResult"]: + ) -> AsyncIterable[_models.AgentPoolListResult]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. @@ -68,13 +67,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_01_01.models.AgentPoolListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -84,9 +86,11 @@ def prepare_request(next_link=None): resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -96,9 +100,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -138,7 +144,7 @@ async def get( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPool": + ) -> _models.AgentPool: """Gets the specified managed cluster agent pool. Gets the specified managed cluster agent pool. @@ -154,13 +160,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.AgentPool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] request = build_get_request( @@ -170,11 +179,13 @@ async def get( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -200,17 +211,20 @@ async def _create_or_update_initial( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> "_models.AgentPool": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] + ) -> _models.AgentPool: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-01-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] _json = self._serialize.body(parameters, 'AgentPool') @@ -223,11 +237,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -258,9 +274,9 @@ async def begin_create_or_update( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> AsyncLROPoller["_models.AgentPool"]: + ) -> AsyncLROPoller[_models.AgentPool]: """Creates or updates an agent pool in the specified managed cluster. Creates or updates an agent pool in the specified managed cluster. @@ -287,17 +303,20 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_01_01.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, @@ -305,20 +324,27 @@ async def begin_create_or_update( 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): - response = pipeline_response.http_response deserialized = self._deserialize('AgentPool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -338,13 +364,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements agent_pool_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -354,11 +383,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -405,21 +436,26 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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) @@ -429,8 +465,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -450,7 +492,7 @@ async def get_upgrade_profile( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPoolUpgradeProfile": + ) -> _models.AgentPoolUpgradeProfile: """Gets the upgrade profile for an agent pool. Gets the upgrade profile for an agent pool. @@ -466,13 +508,16 @@ async def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.AgentPoolUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] request = build_get_upgrade_profile_request( @@ -482,11 +527,13 @@ async def get_upgrade_profile( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -513,7 +560,7 @@ async def get_available_agent_pool_versions( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.AgentPoolAvailableVersions": + ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported Kubernetes versions for the specified agent pool. See `supported Kubernetes versions @@ -529,13 +576,16 @@ async def get_available_agent_pool_versions( :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.AgentPoolAvailableVersions :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolAvailableVersions"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] request = build_get_available_agent_pool_versions_request( @@ -544,11 +594,13 @@ async def get_available_agent_pool_versions( resource_name=resource_name, api_version=api_version, template_url=self.get_available_agent_pool_versions.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -575,14 +627,17 @@ async def _upgrade_node_image_version_initial( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> Optional["_models.AgentPool"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.AgentPool"]] + ) -> Optional[_models.AgentPool]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] request = build_upgrade_node_image_version_request_initial( @@ -592,11 +647,13 @@ async def _upgrade_node_image_version_initial( agent_pool_name=agent_pool_name, api_version=api_version, template_url=self._upgrade_node_image_version_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -629,7 +686,7 @@ async def begin_upgrade_node_image_version( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> AsyncLROPoller["_models.AgentPool"]: + ) -> AsyncLROPoller[_models.AgentPool]: """Upgrades the node image version of an agent pool to the latest. Upgrading the node image version of an agent pool applies the newest OS and runtime updates to @@ -656,21 +713,26 @@ async def begin_upgrade_node_image_version( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_01_01.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._upgrade_node_image_version_initial( + raw_result = await self._upgrade_node_image_version_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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) @@ -686,8 +748,14 @@ def get_long_running_output(pipeline_response): return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/operations/_maintenance_configurations_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/operations/_maintenance_configurations_operations.py index c878bbf5a640..6fc3f0ac9cc2 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/operations/_maintenance_configurations_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/operations/_maintenance_configurations_operations.py @@ -15,6 +15,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -24,26 +25,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class MaintenanceConfigurationsOperations: - """MaintenanceConfigurationsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_01_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_01_01.aio.ContainerServiceClient`'s + :attr:`maintenance_configurations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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_by_managed_cluster( @@ -51,7 +50,7 @@ def list_by_managed_cluster( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> AsyncIterable["_models.MaintenanceConfigurationListResult"]: + ) -> AsyncIterable[_models.MaintenanceConfigurationListResult]: """Gets a list of maintenance configurations in the specified managed cluster. Gets a list of maintenance configurations in the specified managed cluster. @@ -67,13 +66,16 @@ def list_by_managed_cluster( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_01_01.models.MaintenanceConfigurationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfigurationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfigurationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -83,9 +85,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=self.list_by_managed_cluster.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -95,9 +99,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -137,7 +143,7 @@ async def get( resource_name: str, config_name: str, **kwargs: Any - ) -> "_models.MaintenanceConfiguration": + ) -> _models.MaintenanceConfiguration: """Gets the specified maintenance configuration of a managed cluster. Gets the specified maintenance configuration of a managed cluster. @@ -153,13 +159,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.MaintenanceConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfiguration"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] request = build_get_request( @@ -169,11 +178,13 @@ async def get( config_name=config_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -200,9 +211,9 @@ async def create_or_update( resource_group_name: str, resource_name: str, config_name: str, - parameters: "_models.MaintenanceConfiguration", + parameters: _models.MaintenanceConfiguration, **kwargs: Any - ) -> "_models.MaintenanceConfiguration": + ) -> _models.MaintenanceConfiguration: """Creates or updates a maintenance configuration in the specified managed cluster. Creates or updates a maintenance configuration in the specified managed cluster. @@ -220,14 +231,17 @@ async def create_or_update( :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.MaintenanceConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfiguration"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] _json = self._serialize.body(parameters, 'MaintenanceConfiguration') @@ -240,11 +254,13 @@ async def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -288,13 +304,16 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -304,11 +323,13 @@ async def delete( # pylint: disable=inconsistent-return-statements config_name=config_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/operations/_managed_clusters_operations.py index 479254435dd6..822051dbf7ba 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/operations/_managed_clusters_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. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ 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 @@ -26,26 +27,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ManagedClustersOperations: # pylint: disable=too-many-public-methods - """ManagedClustersOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_01_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_01_01.aio.ContainerServiceClient`'s + :attr:`managed_clusters` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace_async async def get_os_options( @@ -53,7 +52,7 @@ async def get_os_options( location: str, resource_type: Optional[str] = None, **kwargs: Any - ) -> "_models.OSOptionProfile": + ) -> _models.OSOptionProfile: """Gets supported OS options in the specified subscription. Gets supported OS options in the specified subscription. @@ -68,13 +67,16 @@ async def get_os_options( :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.OSOptionProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OSOptionProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OSOptionProfile] request = build_get_os_options_request( @@ -83,11 +85,13 @@ async def get_os_options( api_version=api_version, resource_type=resource_type, template_url=self.get_os_options.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -112,7 +116,7 @@ async def get_os_options( def list( self, **kwargs: Any - ) -> AsyncIterable["_models.ManagedClusterListResult"]: + ) -> AsyncIterable[_models.ManagedClusterListResult]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. @@ -124,13 +128,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_01_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -138,9 +145,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -148,9 +157,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -188,7 +199,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ManagedClusterListResult"]: + ) -> AsyncIterable[_models.ManagedClusterListResult]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. @@ -202,13 +213,16 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_01_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -217,9 +231,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -228,9 +244,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -269,7 +287,7 @@ async def get_upgrade_profile( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedClusterUpgradeProfile": + ) -> _models.ManagedClusterUpgradeProfile: """Gets the upgrade profile of a managed cluster. Gets the upgrade profile of a managed cluster. @@ -283,13 +301,16 @@ async def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.ManagedClusterUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] request = build_get_upgrade_profile_request( @@ -298,11 +319,13 @@ async def get_upgrade_profile( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -330,7 +353,7 @@ async def get_access_profile( resource_name: str, role_name: str, **kwargs: Any - ) -> "_models.ManagedClusterAccessProfile": + ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. **WARNING**\ : This API will be deprecated. Instead use `ListClusterUserCredentials @@ -349,13 +372,16 @@ async def get_access_profile( :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.ManagedClusterAccessProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterAccessProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] request = build_get_access_profile_request( @@ -365,11 +391,13 @@ async def get_access_profile( role_name=role_name, api_version=api_version, template_url=self.get_access_profile.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -397,7 +425,7 @@ async def list_cluster_admin_credentials( resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Lists the admin credentials of a managed cluster. Lists the admin credentials of a managed cluster. @@ -413,13 +441,16 @@ async def list_cluster_admin_credentials( :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_admin_credentials_request( @@ -429,11 +460,13 @@ async def list_cluster_admin_credentials( api_version=api_version, server_fqdn=server_fqdn, template_url=self.list_cluster_admin_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -462,7 +495,7 @@ async def list_cluster_user_credentials( server_fqdn: Optional[str] = None, format: Optional[Union[str, "_models.Format"]] = None, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Lists the user credentials of a managed cluster. Lists the user credentials of a managed cluster. @@ -482,13 +515,16 @@ async def list_cluster_user_credentials( :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_user_credentials_request( @@ -499,11 +535,13 @@ async def list_cluster_user_credentials( server_fqdn=server_fqdn, format=format, template_url=self.list_cluster_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -531,7 +569,7 @@ async def list_cluster_monitoring_user_credentials( resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Lists the cluster monitoring user credentials of a managed cluster. Lists the cluster monitoring user credentials of a managed cluster. @@ -547,13 +585,16 @@ async def list_cluster_monitoring_user_credentials( :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_monitoring_user_credentials_request( @@ -563,11 +604,13 @@ async def list_cluster_monitoring_user_credentials( api_version=api_version, server_fqdn=server_fqdn, template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -594,7 +637,7 @@ async def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedCluster": + ) -> _models.ManagedCluster: """Gets a managed cluster. Gets a managed cluster. @@ -608,13 +651,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.ManagedCluster :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] request = build_get_request( @@ -623,11 +669,13 @@ async def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -652,17 +700,20 @@ async def _create_or_update_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-01-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'ManagedCluster') @@ -674,11 +725,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -708,9 +761,9 @@ async def begin_create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> AsyncLROPoller["_models.ManagedCluster"]: + ) -> AsyncLROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. Creates or updates a managed cluster. @@ -735,37 +788,47 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_01_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -782,17 +845,20 @@ async def _update_tags_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-01-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'TagsObject') @@ -804,11 +870,13 @@ async def _update_tags_initial( content_type=content_type, json=_json, template_url=self._update_tags_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -834,9 +902,9 @@ async def begin_update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> AsyncLROPoller["_models.ManagedCluster"]: + ) -> AsyncLROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates tags on a managed cluster. @@ -861,37 +929,47 @@ async def begin_update_tags( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_01_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._update_tags_initial( + raw_result = await self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -910,13 +988,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -925,11 +1006,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -973,20 +1056,25 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_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) @@ -996,8 +1084,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1014,17 +1108,20 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-01-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') @@ -1036,11 +1133,13 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist content_type=content_type, json=_json, template_url=self._reset_service_principal_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1062,7 +1161,7 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> AsyncLROPoller[None]: """Reset the Service Principal Profile of a managed cluster. @@ -1088,23 +1187,28 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._reset_service_principal_profile_initial( + raw_result = await self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1114,8 +1218,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1132,17 +1242,20 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') @@ -1154,11 +1267,13 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta content_type=content_type, json=_json, template_url=self._reset_aad_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1180,7 +1295,7 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> AsyncLROPoller[None]: """Reset the AAD Profile of a managed cluster. @@ -1205,23 +1320,28 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._reset_aad_profile_initial( + raw_result = await self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1231,8 +1351,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1251,13 +1377,16 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_rotate_cluster_certificates_request_initial( @@ -1266,11 +1395,13 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- resource_name=resource_name, api_version=api_version, template_url=self._rotate_cluster_certificates_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1315,20 +1446,25 @@ async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-ret :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._rotate_cluster_certificates_initial( + raw_result = await self._rotate_cluster_certificates_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) @@ -1338,8 +1474,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1358,13 +1500,16 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_stop_request_initial( @@ -1373,11 +1518,13 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_name, api_version=api_version, template_url=self._stop_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1425,20 +1572,25 @@ async def begin_stop( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._stop_initial( + raw_result = await self._stop_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) @@ -1448,8 +1600,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1468,13 +1626,16 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_start_request_initial( @@ -1483,11 +1644,13 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_name, api_version=api_version, template_url=self._start_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1532,20 +1695,25 @@ async def begin_start( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._start_initial( + raw_result = await self._start_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) @@ -1555,8 +1723,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1573,17 +1747,20 @@ async def _run_command_initial( self, resource_group_name: str, resource_name: str, - request_payload: "_models.RunCommandRequest", + request_payload: _models.RunCommandRequest, **kwargs: Any - ) -> Optional["_models.RunCommandResult"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RunCommandResult"]] + ) -> Optional[_models.RunCommandResult]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-01-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] _json = self._serialize.body(request_payload, 'RunCommandRequest') @@ -1595,11 +1772,13 @@ async def _run_command_initial( content_type=content_type, json=_json, template_url=self._run_command_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1627,9 +1806,9 @@ async def begin_run_command( self, resource_group_name: str, resource_name: str, - request_payload: "_models.RunCommandRequest", + request_payload: _models.RunCommandRequest, **kwargs: Any - ) -> AsyncLROPoller["_models.RunCommandResult"]: + ) -> AsyncLROPoller[_models.RunCommandResult]: """Submits a command to run against the Managed Cluster. AKS will create a pod to run the command. This is primarily useful for private clusters. For @@ -1656,37 +1835,47 @@ async def begin_run_command( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_01_01.models.RunCommandResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.RunCommandResult] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._run_command_initial( + raw_result = await self._run_command_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, request_payload=request_payload, 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): - response = pipeline_response.http_response deserialized = self._deserialize('RunCommandResult', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1706,7 +1895,7 @@ async def get_command_result( resource_name: str, command_id: str, **kwargs: Any - ) -> Optional["_models.RunCommandResult"]: + ) -> Optional[_models.RunCommandResult]: """Gets the results of a command which has been run on the Managed Cluster. Gets the results of a command which has been run on the Managed Cluster. @@ -1722,13 +1911,16 @@ async def get_command_result( :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.RunCommandResult or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RunCommandResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] request = build_get_command_result_request( @@ -1738,11 +1930,13 @@ async def get_command_result( command_id=command_id, api_version=api_version, template_url=self.get_command_result.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1771,7 +1965,7 @@ def list_outbound_network_dependencies_endpoints( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> AsyncIterable["_models.OutboundEnvironmentEndpointCollection"]: + ) -> AsyncIterable[_models.OutboundEnvironmentEndpointCollection]: """Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. @@ -1789,13 +1983,16 @@ def list_outbound_network_dependencies_endpoints( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_01_01.models.OutboundEnvironmentEndpointCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OutboundEnvironmentEndpointCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -1805,9 +2002,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=self.list_outbound_network_dependencies_endpoints.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -1817,9 +2016,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/operations/_operations.py index 51a4a820acce..52baa8bb6e16 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/operations/_operations.py @@ -14,6 +14,7 @@ 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 @@ -23,32 +24,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class Operations: - """Operations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_01_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_01_01.aio.ContainerServiceClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.OperationListResult"]: + ) -> AsyncIterable[_models.OperationListResult]: """Gets a list of operations. Gets a list of operations. @@ -59,31 +58,38 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_01_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/operations/_private_endpoint_connections_operations.py index 21f75476a4f5..15492862f170 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/operations/_private_endpoint_connections_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -14,6 +14,7 @@ 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 @@ -24,26 +25,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class PrivateEndpointConnectionsOperations: - """PrivateEndpointConnectionsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_01_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_01_01.aio.ContainerServiceClient`'s + :attr:`private_endpoint_connections` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -51,7 +50,7 @@ async def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnectionListResult": + ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. To learn more about private clusters, see: @@ -66,13 +65,16 @@ async def list( :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.PrivateEndpointConnectionListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] request = build_list_request( @@ -81,11 +83,13 @@ async def list( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -113,7 +117,7 @@ async def get( resource_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Gets the specified private endpoint connection. To learn more about private clusters, see: @@ -130,13 +134,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] request = build_get_request( @@ -146,11 +153,13 @@ async def get( private_endpoint_connection_name=private_endpoint_connection_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -177,9 +186,9 @@ async def update( resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - parameters: "_models.PrivateEndpointConnection", + parameters: _models.PrivateEndpointConnection, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. Updates a private endpoint connection. @@ -197,14 +206,17 @@ async def update( :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-01-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] _json = self._serialize.body(parameters, 'PrivateEndpointConnection') @@ -217,11 +229,13 @@ async def update( content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -249,13 +263,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -265,11 +282,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name=private_endpoint_connection_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -316,21 +335,26 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -340,8 +364,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/operations/_private_link_resources_operations.py index 154838201b58..122f7c9551dc 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/operations/_private_link_resources_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/operations/_private_link_resources_operations.py @@ -13,6 +13,7 @@ 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 @@ -22,26 +23,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class PrivateLinkResourcesOperations: - """PrivateLinkResourcesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_01_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_01_01.aio.ContainerServiceClient`'s + :attr:`private_link_resources` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -49,7 +48,7 @@ async def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.PrivateLinkResourcesListResult": + ) -> _models.PrivateLinkResourcesListResult: """Gets a list of private link resources in the specified managed cluster. To learn more about private clusters, see: @@ -64,13 +63,16 @@ async def list( :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.PrivateLinkResourcesListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourcesListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] request = build_list_request( @@ -79,11 +81,13 @@ async def list( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/operations/_resolve_private_link_service_id_operations.py index 4b8de7f5cff8..396223dbee63 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/operations/_resolve_private_link_service_id_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/operations/_resolve_private_link_service_id_operations.py @@ -13,6 +13,7 @@ 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 @@ -22,35 +23,33 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ResolvePrivateLinkServiceIdOperations: - """ResolvePrivateLinkServiceIdOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_01_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_01_01.aio.ContainerServiceClient`'s + :attr:`resolve_private_link_service_id` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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 post( self, resource_group_name: str, resource_name: str, - parameters: "_models.PrivateLinkResource", + parameters: _models.PrivateLinkResource, **kwargs: Any - ) -> "_models.PrivateLinkResource": + ) -> _models.PrivateLinkResource: """Gets the private link service ID for the specified managed cluster. Gets the private link service ID for the specified managed cluster. @@ -66,14 +65,17 @@ async def post( :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.PrivateLinkResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-01-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] _json = self._serialize.body(parameters, 'PrivateLinkResource') @@ -85,11 +87,13 @@ async def post( content_type=content_type, json=_json, template_url=self.post.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/operations/_snapshots_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/operations/_snapshots_operations.py index 1488074b6bb5..42212f6f2bfc 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/operations/_snapshots_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/operations/_snapshots_operations.py @@ -15,6 +15,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -24,32 +25,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class SnapshotsOperations: - """SnapshotsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_01_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_01_01.aio.ContainerServiceClient`'s + :attr:`snapshots` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.SnapshotListResult"]: + ) -> AsyncIterable[_models.SnapshotListResult]: """Gets a list of snapshots in the specified subscription. Gets a list of snapshots in the specified subscription. @@ -60,13 +59,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_01_01.models.SnapshotListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -74,9 +76,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -84,9 +88,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -124,7 +130,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.SnapshotListResult"]: + ) -> AsyncIterable[_models.SnapshotListResult]: """Lists snapshots in the specified subscription and resource group. Lists snapshots in the specified subscription and resource group. @@ -137,13 +143,16 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_01_01.models.SnapshotListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -152,9 +161,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -163,9 +174,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -204,7 +217,7 @@ async def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.Snapshot": + ) -> _models.Snapshot: """Gets a snapshot. Gets a snapshot. @@ -218,13 +231,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.Snapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] request = build_get_request( @@ -233,11 +249,13 @@ async def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -263,9 +281,9 @@ async def create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.Snapshot", + parameters: _models.Snapshot, **kwargs: Any - ) -> "_models.Snapshot": + ) -> _models.Snapshot: """Creates or updates a snapshot. Creates or updates a snapshot. @@ -281,14 +299,17 @@ async def create_or_update( :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.Snapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] _json = self._serialize.body(parameters, 'Snapshot') @@ -300,11 +321,13 @@ async def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -334,9 +357,9 @@ async def update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.Snapshot": + ) -> _models.Snapshot: """Updates tags on a snapshot. Updates tags on a snapshot. @@ -352,14 +375,17 @@ async def update_tags( :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.Snapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-01-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] _json = self._serialize.body(parameters, 'TagsObject') @@ -371,11 +397,13 @@ async def update_tags( content_type=content_type, json=_json, template_url=self.update_tags.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -416,13 +444,16 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -431,11 +462,13 @@ async def delete( # pylint: disable=inconsistent-return-statements resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/models/__init__.py index ed24d714f832..1527884a3c86 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/models/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/models/__init__.py @@ -132,7 +132,9 @@ WeekDay, WorkloadRuntime, ) - +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'AgentPool', 'AgentPoolAvailableVersions', @@ -257,3 +259,5 @@ 'WeekDay', 'WorkloadRuntime', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/models/_container_service_client_enums.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/models/_container_service_client_enums.py index aa3de5ebe54e..cb066b7fffcc 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/models/_container_service_client_enums.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/models/_container_service_client_enums.py @@ -7,11 +7,10 @@ # -------------------------------------------------------------------------- from enum import Enum -from six import with_metaclass from azure.core import CaseInsensitiveEnumMeta -class AgentPoolMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class AgentPoolMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: https://docs.microsoft.com/azure/aks/use-system-pools @@ -24,7 +23,7 @@ class AgentPoolMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: User agent pools are primarily for hosting your application pods. USER = "User" -class AgentPoolType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class AgentPoolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of Agent Pool. """ @@ -33,7 +32,7 @@ class AgentPoolType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Use of this is strongly discouraged. AVAILABILITY_SET = "AvailabilitySet" -class Code(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class Code(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Tells whether the cluster is Running or Stopped """ @@ -42,7 +41,7 @@ class Code(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: The cluster is stopped. STOPPED = "Stopped" -class ConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The private link service connection status. """ @@ -51,7 +50,7 @@ class ConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): REJECTED = "Rejected" DISCONNECTED = "Disconnected" -class ContainerServiceStorageProfileTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Specifies what kind of storage to use. If omitted, the default will be chosen on your behalf based on the choice of orchestrator. """ @@ -59,7 +58,7 @@ class ContainerServiceStorageProfileTypes(with_metaclass(CaseInsensitiveEnumMeta STORAGE_ACCOUNT = "StorageAccount" MANAGED_DISKS = "ManagedDisks" -class ContainerServiceVMSizeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Size of agent VMs. Note: This is no longer maintained. """ @@ -238,7 +237,7 @@ class ContainerServiceVMSizeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, E STANDARD_NV24 = "Standard_NV24" STANDARD_NV6 = "Standard_NV6" -class Count(with_metaclass(CaseInsensitiveEnumMeta, int, Enum)): +class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): """Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, and 5. The default value is 1. """ @@ -247,7 +246,7 @@ class Count(with_metaclass(CaseInsensitiveEnumMeta, int, Enum)): THREE = 3 FIVE = 5 -class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of identity that created the resource. """ @@ -256,7 +255,7 @@ class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class Expander(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class Expander(str, Enum, metaclass=CaseInsensitiveEnumMeta): """If not specified, the default is 'random'. See `expanders `_ for more information. @@ -279,13 +278,13 @@ class Expander(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Used when you don't have a particular need for the node groups to scale differently. RANDOM = "random" -class ExtendedLocationTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ExtendedLocationTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of extendedLocation. """ EDGE_ZONE = "EdgeZone" -class Format(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class Format(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Return azure auth-provider kubeconfig. This format is deprecated in 1.22 and will be fully #: removed in 1.25. @@ -293,7 +292,7 @@ class Format(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Return exec format kubeconfig. This format requires kubelogin binary in the path. EXEC_ENUM = "exec" -class GPUInstanceProfile(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class GPUInstanceProfile(str, Enum, metaclass=CaseInsensitiveEnumMeta): """GPUInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU. """ @@ -303,14 +302,14 @@ class GPUInstanceProfile(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MIG4_G = "MIG4g" MIG7_G = "MIG7g" -class IpFamily(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class IpFamily(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The IP version to use for cluster networking and IP assignment. """ I_PV4 = "IPv4" I_PV6 = "IPv6" -class KubeletDiskType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class KubeletDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. """ @@ -320,7 +319,7 @@ class KubeletDiskType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Kubelet will use the temporary disk for its data. TEMPORARY = "Temporary" -class LicenseType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class LicenseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The license type to use for Windows VMs. See `Azure Hybrid User Benefits `_ for more details. """ @@ -330,7 +329,7 @@ class LicenseType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Enables Azure Hybrid User Benefits for Windows VMs. WINDOWS_SERVER = "Windows_Server" -class LoadBalancerSku(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class LoadBalancerSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the differences between load balancer SKUs. @@ -343,7 +342,7 @@ class LoadBalancerSku(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Use a basic Load Balancer with limited functionality. BASIC = "basic" -class ManagedClusterPodIdentityProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ManagedClusterPodIdentityProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The current provisioning state of the pod identity. """ @@ -352,13 +351,13 @@ class ManagedClusterPodIdentityProvisioningState(with_metaclass(CaseInsensitiveE DELETING = "Deleting" FAILED = "Failed" -class ManagedClusterSKUName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ManagedClusterSKUName(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The name of a managed cluster SKU. """ BASIC = "Basic" -class ManagedClusterSKUTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ManagedClusterSKUTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): """If not specified, the default is 'Free'. See `uptime SLA `_ for more details. """ @@ -369,7 +368,7 @@ class ManagedClusterSKUTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: No guaranteed SLA, no additional charges. Free tier clusters have an SLO of 99.5%. FREE = "Free" -class NetworkMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """This cannot be specified if networkPlugin is anything other than 'azure'. """ @@ -380,7 +379,7 @@ class NetworkMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: This is no longer supported. BRIDGE = "bridge" -class NetworkPlugin(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkPlugin(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Network plugin used for building the Kubernetes network. """ @@ -393,7 +392,7 @@ class NetworkPlugin(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: information. KUBENET = "kubenet" -class NetworkPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Network policy used for building the Kubernetes network. """ @@ -406,7 +405,7 @@ class NetworkPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: for more information. AZURE = "azure" -class OSDiskType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OSDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS @@ -422,14 +421,14 @@ class OSDiskType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: provides lower read/write latency, along with faster node scaling and cluster upgrades. EPHEMERAL = "Ephemeral" -class OSSKU(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OSSKU(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Specifies an OS SKU. This value must not be specified if OSType is Windows. """ UBUNTU = "Ubuntu" CBL_MARINER = "CBLMariner" -class OSType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The operating system type. The default is Linux. """ @@ -438,7 +437,7 @@ class OSType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Use Windows. WINDOWS = "Windows" -class OutboundType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OutboundType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type `_. """ @@ -458,7 +457,7 @@ class OutboundType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: advanced scenario and requires proper network configuration. USER_ASSIGNED_NAT_GATEWAY = "userAssignedNATGateway" -class PrivateEndpointConnectionProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class PrivateEndpointConnectionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The current provisioning state. """ @@ -467,14 +466,14 @@ class PrivateEndpointConnectionProvisioningState(with_metaclass(CaseInsensitiveE DELETING = "Deleting" FAILED = "Failed" -class PublicNetworkAccess(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class PublicNetworkAccess(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Allow or deny public network access for AKS """ ENABLED = "Enabled" DISABLED = "Disabled" -class ResourceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """For more information see `use managed identities in AKS `_. """ @@ -490,7 +489,7 @@ class ResourceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Do not use a managed identity for the Managed Cluster, service principal will be used instead. NONE = "None" -class ScaleDownMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ScaleDownMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Describes how VMs are added to or removed from Agent Pools. See `billing states `_. """ @@ -501,7 +500,7 @@ class ScaleDownMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: during scale down. DEALLOCATE = "Deallocate" -class ScaleSetEvictionPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The eviction policy specifies what to do with the VM when it is evicted. The default is Delete. For more information about eviction see `spot VMs `_ @@ -514,7 +513,7 @@ class ScaleSetEvictionPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)) #: cause issues with cluster scaling or upgrading. DEALLOCATE = "Deallocate" -class ScaleSetPriority(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ScaleSetPriority(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The Virtual Machine Scale Set priority. """ @@ -524,14 +523,14 @@ class ScaleSetPriority(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Regular VMs will be used. REGULAR = "Regular" -class SnapshotType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SnapshotType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of a snapshot. The default is NodePool. """ #: The snapshot is a snapshot of a node pool. NODE_POOL = "NodePool" -class UpgradeChannel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class UpgradeChannel(str, Enum, metaclass=CaseInsensitiveEnumMeta): """For more information see `setting the AKS cluster auto-upgrade channel `_. """ @@ -561,7 +560,7 @@ class UpgradeChannel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Disables auto-upgrades and keeps the cluster at its current version of Kubernetes. NONE = "none" -class WeekDay(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class WeekDay(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The weekday enum. """ @@ -573,7 +572,7 @@ class WeekDay(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): FRIDAY = "Friday" SATURDAY = "Saturday" -class WorkloadRuntime(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class WorkloadRuntime(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Determines the type of workload a node can run. """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/models/_models_py3.py index 550d56e7c354..cc9b8960d47a 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/models/_models_py3.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/models/_models_py3.py @@ -7,11 +7,13 @@ # -------------------------------------------------------------------------- import datetime -from typing import Dict, List, Optional, Union +from typing import Dict, List, Optional, TYPE_CHECKING, Union import msrest.serialization -from ._container_service_client_enums import * +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + import __init__ as _models class SubResource(msrest.serialization.Model): @@ -79,15 +81,15 @@ class AgentPool(SubResource): :ivar os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS - `_. Possible values - include: "Managed", "Ephemeral". + `_. Known values are: + "Managed", "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2022_01_01.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Possible values include: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_01_01.models.KubeletDiskType - :ivar workload_runtime: Determines the type of workload a node can run. Possible values - include: "OCIContainer", "WasmWasi". + :ivar workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer", "WasmWasi". :vartype workload_runtime: str or ~azure.mgmt.containerservice.v2022_01_01.models.WorkloadRuntime :ivar vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and used. @@ -101,11 +103,11 @@ class AgentPool(SubResource): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_01_01.models.OSType - :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Possible values include: "Ubuntu", "CBLMariner". + :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known + values are: "Ubuntu", "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2022_01_01.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. :vartype max_count: int @@ -114,16 +116,15 @@ class AgentPool(SubResource): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it - defaults to Delete. Possible values include: "Delete", "Deallocate". + defaults to Delete. Known values are: "Delete", "Deallocate". :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_01_01.models.ScaleDownMode - :ivar type_properties_type: The type of Agent Pool. Possible values include: + :ivar type_properties_type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :vartype type_properties_type: str or ~azure.mgmt.containerservice.v2022_01_01.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Possible values include: "System", - "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". :vartype mode: str or ~azure.mgmt.containerservice.v2022_01_01.models.AgentPoolMode :ivar orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -158,12 +159,12 @@ class AgentPool(SubResource): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Possible values include: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_01_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Possible values include: "Delete", - "Deallocate". Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_01_01.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which @@ -195,7 +196,7 @@ class AgentPool(SubResource): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_01_01.models.GPUInstanceProfile :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool @@ -263,40 +264,40 @@ def __init__( count: Optional[int] = None, vm_size: Optional[str] = None, os_disk_size_gb: Optional[int] = None, - os_disk_type: Optional[Union[str, "OSDiskType"]] = None, - kubelet_disk_type: Optional[Union[str, "KubeletDiskType"]] = None, - workload_runtime: Optional[Union[str, "WorkloadRuntime"]] = None, + os_disk_type: Optional[Union[str, "_models.OSDiskType"]] = None, + kubelet_disk_type: Optional[Union[str, "_models.KubeletDiskType"]] = None, + workload_runtime: Optional[Union[str, "_models.WorkloadRuntime"]] = None, vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", - os_sku: Optional[Union[str, "OSSKU"]] = None, + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - scale_down_mode: Optional[Union[str, "ScaleDownMode"]] = None, - type_properties_type: Optional[Union[str, "AgentPoolType"]] = None, - mode: Optional[Union[str, "AgentPoolMode"]] = None, + scale_down_mode: Optional[Union[str, "_models.ScaleDownMode"]] = None, + type_properties_type: Optional[Union[str, "_models.AgentPoolType"]] = None, + mode: Optional[Union[str, "_models.AgentPoolMode"]] = None, orchestrator_version: Optional[str] = None, - upgrade_settings: Optional["AgentPoolUpgradeSettings"] = None, - power_state: Optional["PowerState"] = None, + upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, + power_state: Optional["_models.PowerState"] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", spot_max_price: Optional[float] = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, proximity_placement_group_id: Optional[str] = None, - kubelet_config: Optional["KubeletConfig"] = None, - linux_os_config: Optional["LinuxOSConfig"] = None, + kubelet_config: Optional["_models.KubeletConfig"] = None, + linux_os_config: Optional["_models.LinuxOSConfig"] = None, enable_encryption_at_host: Optional[bool] = None, enable_ultra_ssd: Optional[bool] = None, enable_fips: Optional[bool] = None, - gpu_instance_profile: Optional[Union[str, "GPUInstanceProfile"]] = None, - creation_data: Optional["CreationData"] = None, + gpu_instance_profile: Optional[Union[str, "_models.GPUInstanceProfile"]] = None, + creation_data: Optional["_models.CreationData"] = None, **kwargs ): """ @@ -315,15 +316,15 @@ def __init__( :keyword os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS - `_. Possible values - include: "Managed", "Ephemeral". + `_. Known values are: + "Managed", "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2022_01_01.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Possible values include: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_01_01.models.KubeletDiskType - :keyword workload_runtime: Determines the type of workload a node can run. Possible values - include: "OCIContainer", "WasmWasi". + :keyword workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer", "WasmWasi". :paramtype workload_runtime: str or ~azure.mgmt.containerservice.v2022_01_01.models.WorkloadRuntime :keyword vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and @@ -337,11 +338,11 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_01_01.models.OSType :keyword os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Possible values include: "Ubuntu", "CBLMariner". + Known values are: "Ubuntu", "CBLMariner". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2022_01_01.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -350,17 +351,16 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, - it defaults to Delete. Possible values include: "Delete", "Deallocate". + it defaults to Delete. Known values are: "Delete", "Deallocate". :paramtype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_01_01.models.ScaleDownMode - :keyword type_properties_type: The type of Agent Pool. Possible values include: + :keyword type_properties_type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type_properties_type: str or ~azure.mgmt.containerservice.v2022_01_01.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Possible values include: "System", - "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2022_01_01.models.AgentPoolMode :keyword orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -391,12 +391,12 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Possible values include: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_01_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Possible values include: "Delete", - "Deallocate". Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_01_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which @@ -428,7 +428,7 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_01_01.models.GPUInstanceProfile @@ -510,7 +510,7 @@ class AgentPoolAvailableVersions(msrest.serialization.Model): def __init__( self, *, - agent_pool_versions: Optional[List["AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem"]] = None, + agent_pool_versions: Optional[List["_models.AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem"]] = None, **kwargs ): """ @@ -587,7 +587,7 @@ class AgentPoolListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["AgentPool"]] = None, + value: Optional[List["_models.AgentPool"]] = None, **kwargs ): """ @@ -614,8 +614,8 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): :vartype type: str :ivar kubernetes_version: Required. The Kubernetes version (major.minor.patch). :vartype kubernetes_version: str - :ivar os_type: Required. The operating system type. The default is Linux. Possible values - include: "Linux", "Windows". Default value: "Linux". + :ivar os_type: Required. The operating system type. The default is Linux. Known values are: + "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_01_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -646,16 +646,16 @@ def __init__( self, *, kubernetes_version: str, - os_type: Union[str, "OSType"] = "Linux", - upgrades: Optional[List["AgentPoolUpgradeProfilePropertiesUpgradesItem"]] = None, + os_type: Union[str, "_models.OSType"] = "Linux", + upgrades: Optional[List["_models.AgentPoolUpgradeProfilePropertiesUpgradesItem"]] = None, latest_node_image_version: Optional[str] = None, **kwargs ): """ :keyword kubernetes_version: Required. The Kubernetes version (major.minor.patch). :paramtype kubernetes_version: str - :keyword os_type: Required. The operating system type. The default is Linux. Possible values - include: "Linux", "Windows". Default value: "Linux". + :keyword os_type: Required. The operating system type. The default is Linux. Known values are: + "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_01_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: @@ -767,7 +767,7 @@ def __init__( code: Optional[str] = None, message: Optional[str] = None, target: Optional[str] = None, - details: Optional[List["CloudErrorBody"]] = None, + details: Optional[List["_models.CloudErrorBody"]] = None, **kwargs ): """ @@ -811,7 +811,7 @@ class ContainerServiceDiagnosticsProfile(msrest.serialization.Model): def __init__( self, *, - vm_diagnostics: "ContainerServiceVMDiagnostics", + vm_diagnostics: "_models.ContainerServiceVMDiagnostics", **kwargs ): """ @@ -848,7 +848,7 @@ def __init__( self, *, admin_username: str, - ssh: "ContainerServiceSshConfiguration", + ssh: "_models.ContainerServiceSshConfiguration", **kwargs ): """ @@ -871,17 +871,17 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar count: Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, - and 5. The default value is 1. Possible values include: 1, 3, 5. Default value: "1". + and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". :vartype count: int or ~azure.mgmt.containerservice.v2022_01_01.models.Count :ivar dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. :vartype dns_prefix: str - :ivar vm_size: Required. Size of agent VMs. Possible values include: "Standard_A1", - "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", - "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", - "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", - "Standard_A8m_v2", "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", - "Standard_B8ms", "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", - "Standard_D12", "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", + :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", + "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", + "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", + "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", "Standard_B8ms", + "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", "Standard_D12", + "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", "Standard_D13_v2_Promo", "Standard_D14", "Standard_D14_v2", "Standard_D14_v2_Promo", "Standard_D15_v2", "Standard_D16_v3", "Standard_D16s_v3", "Standard_D1_v2", "Standard_D2", "Standard_D2_v2", "Standard_D2_v2_Promo", "Standard_D2_v3", "Standard_D2s_v3", "Standard_D3", @@ -926,7 +926,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): :vartype first_consecutive_static_ip: str :ivar storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Possible values include: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". :vartype storage_profile: str or ~azure.mgmt.containerservice.v2022_01_01.models.ContainerServiceStorageProfileTypes :ivar fqdn: FQDN for the master pool. @@ -955,27 +955,27 @@ def __init__( self, *, dns_prefix: str, - vm_size: Union[str, "ContainerServiceVMSizeTypes"], - count: Optional[Union[int, "Count"]] = 1, + vm_size: Union[str, "_models.ContainerServiceVMSizeTypes"], + count: Optional[Union[int, "_models.Count"]] = 1, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, first_consecutive_static_ip: Optional[str] = "10.240.255.5", - storage_profile: Optional[Union[str, "ContainerServiceStorageProfileTypes"]] = None, + storage_profile: Optional[Union[str, "_models.ContainerServiceStorageProfileTypes"]] = None, **kwargs ): """ :keyword count: Number of masters (VMs) in the container service cluster. Allowed values are 1, - 3, and 5. The default value is 1. Possible values include: 1, 3, 5. Default value: "1". + 3, and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". :paramtype count: int or ~azure.mgmt.containerservice.v2022_01_01.models.Count :keyword dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. :paramtype dns_prefix: str - :keyword vm_size: Required. Size of agent VMs. Possible values include: "Standard_A1", - "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", - "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", - "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", - "Standard_A8m_v2", "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", - "Standard_B8ms", "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", - "Standard_D12", "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", + :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", + "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", + "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", + "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", "Standard_B8ms", + "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", "Standard_D12", + "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", "Standard_D13_v2_Promo", "Standard_D14", "Standard_D14_v2", "Standard_D14_v2_Promo", "Standard_D15_v2", "Standard_D16_v3", "Standard_D16s_v3", "Standard_D1_v2", "Standard_D2", "Standard_D2_v2", "Standard_D2_v2_Promo", "Standard_D2_v3", "Standard_D2s_v3", "Standard_D3", @@ -1020,7 +1020,7 @@ def __init__( :paramtype first_consecutive_static_ip: str :keyword storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Possible values include: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". :paramtype storage_profile: str or ~azure.mgmt.containerservice.v2022_01_01.models.ContainerServiceStorageProfileTypes """ @@ -1038,14 +1038,14 @@ def __init__( class ContainerServiceNetworkProfile(msrest.serialization.Model): """Profile of network configuration. - :ivar network_plugin: Network plugin used for building the Kubernetes network. Possible values - include: "azure", "kubenet". Default value: "kubenet". + :ivar network_plugin: Network plugin used for building the Kubernetes network. Known values + are: "azure", "kubenet". Default value: "kubenet". :vartype network_plugin: str or ~azure.mgmt.containerservice.v2022_01_01.models.NetworkPlugin - :ivar network_policy: Network policy used for building the Kubernetes network. Possible values - include: "calico", "azure". + :ivar network_policy: Network policy used for building the Kubernetes network. Known values + are: "calico", "azure". :vartype network_policy: str or ~azure.mgmt.containerservice.v2022_01_01.models.NetworkPolicy :ivar network_mode: This cannot be specified if networkPlugin is anything other than 'azure'. - Possible values include: "transparent", "bridge". + Known values are: "transparent", "bridge". :vartype network_mode: str or ~azure.mgmt.containerservice.v2022_01_01.models.NetworkMode :ivar pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :vartype pod_cidr: str @@ -1060,13 +1060,13 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): :vartype docker_bridge_cidr: str :ivar outbound_type: This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type - `_. Possible values include: - "loadBalancer", "userDefinedRouting", "managedNATGateway", "userAssignedNATGateway". Default - value: "loadBalancer". + `_. Known values are: "loadBalancer", + "userDefinedRouting", "managedNATGateway", "userAssignedNATGateway". Default value: + "loadBalancer". :vartype outbound_type: str or ~azure.mgmt.containerservice.v2022_01_01.models.OutboundType :ivar load_balancer_sku: The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the - differences between load balancer SKUs. Possible values include: "standard", "basic". + differences between load balancer SKUs. Known values are: "standard", "basic". :vartype load_balancer_sku: str or ~azure.mgmt.containerservice.v2022_01_01.models.LoadBalancerSku :ivar load_balancer_profile: Profile of the cluster load balancer. @@ -1115,31 +1115,31 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): def __init__( self, *, - network_plugin: Optional[Union[str, "NetworkPlugin"]] = "kubenet", - network_policy: Optional[Union[str, "NetworkPolicy"]] = None, - network_mode: Optional[Union[str, "NetworkMode"]] = None, + network_plugin: Optional[Union[str, "_models.NetworkPlugin"]] = "kubenet", + network_policy: Optional[Union[str, "_models.NetworkPolicy"]] = None, + network_mode: Optional[Union[str, "_models.NetworkMode"]] = None, pod_cidr: Optional[str] = "10.244.0.0/16", service_cidr: Optional[str] = "10.0.0.0/16", dns_service_ip: Optional[str] = "10.0.0.10", docker_bridge_cidr: Optional[str] = "172.17.0.1/16", - outbound_type: Optional[Union[str, "OutboundType"]] = "loadBalancer", - load_balancer_sku: Optional[Union[str, "LoadBalancerSku"]] = None, - load_balancer_profile: Optional["ManagedClusterLoadBalancerProfile"] = None, - nat_gateway_profile: Optional["ManagedClusterNATGatewayProfile"] = None, + outbound_type: Optional[Union[str, "_models.OutboundType"]] = "loadBalancer", + load_balancer_sku: Optional[Union[str, "_models.LoadBalancerSku"]] = None, + load_balancer_profile: Optional["_models.ManagedClusterLoadBalancerProfile"] = None, + nat_gateway_profile: Optional["_models.ManagedClusterNATGatewayProfile"] = None, pod_cidrs: Optional[List[str]] = None, service_cidrs: Optional[List[str]] = None, - ip_families: Optional[List[Union[str, "IpFamily"]]] = None, + ip_families: Optional[List[Union[str, "_models.IpFamily"]]] = None, **kwargs ): """ - :keyword network_plugin: Network plugin used for building the Kubernetes network. Possible - values include: "azure", "kubenet". Default value: "kubenet". + :keyword network_plugin: Network plugin used for building the Kubernetes network. Known values + are: "azure", "kubenet". Default value: "kubenet". :paramtype network_plugin: str or ~azure.mgmt.containerservice.v2022_01_01.models.NetworkPlugin - :keyword network_policy: Network policy used for building the Kubernetes network. Possible - values include: "calico", "azure". + :keyword network_policy: Network policy used for building the Kubernetes network. Known values + are: "calico", "azure". :paramtype network_policy: str or ~azure.mgmt.containerservice.v2022_01_01.models.NetworkPolicy :keyword network_mode: This cannot be specified if networkPlugin is anything other than - 'azure'. Possible values include: "transparent", "bridge". + 'azure'. Known values are: "transparent", "bridge". :paramtype network_mode: str or ~azure.mgmt.containerservice.v2022_01_01.models.NetworkMode :keyword pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :paramtype pod_cidr: str @@ -1154,13 +1154,13 @@ def __init__( :paramtype docker_bridge_cidr: str :keyword outbound_type: This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type - `_. Possible values include: - "loadBalancer", "userDefinedRouting", "managedNATGateway", "userAssignedNATGateway". Default - value: "loadBalancer". + `_. Known values are: "loadBalancer", + "userDefinedRouting", "managedNATGateway", "userAssignedNATGateway". Default value: + "loadBalancer". :paramtype outbound_type: str or ~azure.mgmt.containerservice.v2022_01_01.models.OutboundType :keyword load_balancer_sku: The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the - differences between load balancer SKUs. Possible values include: "standard", "basic". + differences between load balancer SKUs. Known values are: "standard", "basic". :paramtype load_balancer_sku: str or ~azure.mgmt.containerservice.v2022_01_01.models.LoadBalancerSku :keyword load_balancer_profile: Profile of the cluster load balancer. @@ -1220,7 +1220,7 @@ class ContainerServiceSshConfiguration(msrest.serialization.Model): def __init__( self, *, - public_keys: List["ContainerServiceSshPublicKey"], + public_keys: List["_models.ContainerServiceSshPublicKey"], **kwargs ): """ @@ -1408,7 +1408,7 @@ def __init__( self, *, domain_name: Optional[str] = None, - endpoint_details: Optional[List["EndpointDetail"]] = None, + endpoint_details: Optional[List["_models.EndpointDetail"]] = None, **kwargs ): """ @@ -1474,7 +1474,7 @@ class ExtendedLocation(msrest.serialization.Model): :ivar name: The name of the extended location. :vartype name: str - :ivar type: The type of the extended location. Possible values include: "EdgeZone". + :ivar type: The type of the extended location. Known values are: "EdgeZone". :vartype type: str or ~azure.mgmt.containerservice.v2022_01_01.models.ExtendedLocationTypes """ @@ -1487,13 +1487,13 @@ def __init__( self, *, name: Optional[str] = None, - type: Optional[Union[str, "ExtendedLocationTypes"]] = None, + type: Optional[Union[str, "_models.ExtendedLocationTypes"]] = None, **kwargs ): """ :keyword name: The name of the extended location. :paramtype name: str - :keyword type: The type of the extended location. Possible values include: "EdgeZone". + :keyword type: The type of the extended location. Known values are: "EdgeZone". :paramtype type: str or ~azure.mgmt.containerservice.v2022_01_01.models.ExtendedLocationTypes """ super(ExtendedLocation, self).__init__(**kwargs) @@ -1652,7 +1652,7 @@ class LinuxOSConfig(msrest.serialization.Model): def __init__( self, *, - sysctls: Optional["SysctlConfig"] = None, + sysctls: Optional["_models.SysctlConfig"] = None, transparent_huge_page_enabled: Optional[str] = None, transparent_huge_page_defrag: Optional[str] = None, swap_file_size_mb: Optional[int] = None, @@ -1720,8 +1720,8 @@ class MaintenanceConfiguration(SubResource): def __init__( self, *, - time_in_week: Optional[List["TimeInWeek"]] = None, - not_allowed_time: Optional[List["TimeSpan"]] = None, + time_in_week: Optional[List["_models.TimeInWeek"]] = None, + not_allowed_time: Optional[List["_models.TimeSpan"]] = None, **kwargs ): """ @@ -1760,7 +1760,7 @@ class MaintenanceConfigurationListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["MaintenanceConfiguration"]] = None, + value: Optional[List["_models.MaintenanceConfiguration"]] = None, **kwargs ): """ @@ -1938,8 +1938,8 @@ class ManagedCluster(Resource): :ivar security_profile: Security profile for the managed cluster. :vartype security_profile: ~azure.mgmt.containerservice.v2022_01_01.models.ManagedClusterSecurityProfile - :ivar public_network_access: Allow or deny public network access for AKS. Possible values - include: "Enabled", "Disabled". + :ivar public_network_access: Allow or deny public network access for AKS. Known values are: + "Enabled", "Disabled". :vartype public_network_access: str or ~azure.mgmt.containerservice.v2022_01_01.models.PublicNetworkAccess """ @@ -2003,33 +2003,33 @@ def __init__( *, location: str, tags: Optional[Dict[str, str]] = None, - sku: Optional["ManagedClusterSKU"] = None, - extended_location: Optional["ExtendedLocation"] = None, - identity: Optional["ManagedClusterIdentity"] = None, + sku: Optional["_models.ManagedClusterSKU"] = None, + extended_location: Optional["_models.ExtendedLocation"] = None, + identity: Optional["_models.ManagedClusterIdentity"] = None, kubernetes_version: Optional[str] = None, dns_prefix: Optional[str] = None, fqdn_subdomain: Optional[str] = None, - agent_pool_profiles: Optional[List["ManagedClusterAgentPoolProfile"]] = None, - linux_profile: Optional["ContainerServiceLinuxProfile"] = None, - windows_profile: Optional["ManagedClusterWindowsProfile"] = None, - service_principal_profile: Optional["ManagedClusterServicePrincipalProfile"] = None, - addon_profiles: Optional[Dict[str, "ManagedClusterAddonProfile"]] = None, - pod_identity_profile: Optional["ManagedClusterPodIdentityProfile"] = None, + agent_pool_profiles: Optional[List["_models.ManagedClusterAgentPoolProfile"]] = None, + linux_profile: Optional["_models.ContainerServiceLinuxProfile"] = None, + windows_profile: Optional["_models.ManagedClusterWindowsProfile"] = None, + service_principal_profile: Optional["_models.ManagedClusterServicePrincipalProfile"] = None, + addon_profiles: Optional[Dict[str, "_models.ManagedClusterAddonProfile"]] = None, + pod_identity_profile: Optional["_models.ManagedClusterPodIdentityProfile"] = None, node_resource_group: Optional[str] = None, enable_rbac: Optional[bool] = None, enable_pod_security_policy: Optional[bool] = None, - network_profile: Optional["ContainerServiceNetworkProfile"] = None, - aad_profile: Optional["ManagedClusterAADProfile"] = None, - auto_upgrade_profile: Optional["ManagedClusterAutoUpgradeProfile"] = None, - auto_scaler_profile: Optional["ManagedClusterPropertiesAutoScalerProfile"] = None, - api_server_access_profile: Optional["ManagedClusterAPIServerAccessProfile"] = None, + network_profile: Optional["_models.ContainerServiceNetworkProfile"] = None, + aad_profile: Optional["_models.ManagedClusterAADProfile"] = None, + auto_upgrade_profile: Optional["_models.ManagedClusterAutoUpgradeProfile"] = None, + auto_scaler_profile: Optional["_models.ManagedClusterPropertiesAutoScalerProfile"] = None, + api_server_access_profile: Optional["_models.ManagedClusterAPIServerAccessProfile"] = None, disk_encryption_set_id: Optional[str] = None, - identity_profile: Optional[Dict[str, "UserAssignedIdentity"]] = None, - private_link_resources: Optional[List["PrivateLinkResource"]] = None, + identity_profile: Optional[Dict[str, "_models.UserAssignedIdentity"]] = None, + private_link_resources: Optional[List["_models.PrivateLinkResource"]] = None, disable_local_accounts: Optional[bool] = None, - http_proxy_config: Optional["ManagedClusterHTTPProxyConfig"] = None, - security_profile: Optional["ManagedClusterSecurityProfile"] = None, - public_network_access: Optional[Union[str, "PublicNetworkAccess"]] = None, + http_proxy_config: Optional["_models.ManagedClusterHTTPProxyConfig"] = None, + security_profile: Optional["_models.ManagedClusterSecurityProfile"] = None, + public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None, **kwargs ): """ @@ -2118,8 +2118,8 @@ def __init__( :keyword security_profile: Security profile for the managed cluster. :paramtype security_profile: ~azure.mgmt.containerservice.v2022_01_01.models.ManagedClusterSecurityProfile - :keyword public_network_access: Allow or deny public network access for AKS. Possible values - include: "Enabled", "Disabled". + :keyword public_network_access: Allow or deny public network access for AKS. Known values are: + "Enabled", "Disabled". :paramtype public_network_access: str or ~azure.mgmt.containerservice.v2022_01_01.models.PublicNetworkAccess """ @@ -2428,15 +2428,15 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS - `_. Possible values - include: "Managed", "Ephemeral". + `_. Known values are: + "Managed", "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2022_01_01.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Possible values include: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_01_01.models.KubeletDiskType - :ivar workload_runtime: Determines the type of workload a node can run. Possible values - include: "OCIContainer", "WasmWasi". + :ivar workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer", "WasmWasi". :vartype workload_runtime: str or ~azure.mgmt.containerservice.v2022_01_01.models.WorkloadRuntime :ivar vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and used. @@ -2450,11 +2450,11 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_01_01.models.OSType - :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Possible values include: "Ubuntu", "CBLMariner". + :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known + values are: "Ubuntu", "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2022_01_01.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. :vartype max_count: int @@ -2463,15 +2463,14 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it - defaults to Delete. Possible values include: "Delete", "Deallocate". + defaults to Delete. Known values are: "Delete", "Deallocate". :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_01_01.models.ScaleDownMode - :ivar type: The type of Agent Pool. Possible values include: "VirtualMachineScaleSets", + :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2022_01_01.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Possible values include: "System", - "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". :vartype mode: str or ~azure.mgmt.containerservice.v2022_01_01.models.AgentPoolMode :ivar orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -2506,12 +2505,12 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Possible values include: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_01_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Possible values include: "Delete", - "Deallocate". Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_01_01.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which @@ -2543,7 +2542,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_01_01.models.GPUInstanceProfile :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool @@ -2605,40 +2604,40 @@ def __init__( count: Optional[int] = None, vm_size: Optional[str] = None, os_disk_size_gb: Optional[int] = None, - os_disk_type: Optional[Union[str, "OSDiskType"]] = None, - kubelet_disk_type: Optional[Union[str, "KubeletDiskType"]] = None, - workload_runtime: Optional[Union[str, "WorkloadRuntime"]] = None, + os_disk_type: Optional[Union[str, "_models.OSDiskType"]] = None, + kubelet_disk_type: Optional[Union[str, "_models.KubeletDiskType"]] = None, + workload_runtime: Optional[Union[str, "_models.WorkloadRuntime"]] = None, vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", - os_sku: Optional[Union[str, "OSSKU"]] = None, + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - scale_down_mode: Optional[Union[str, "ScaleDownMode"]] = None, - type: Optional[Union[str, "AgentPoolType"]] = None, - mode: Optional[Union[str, "AgentPoolMode"]] = None, + scale_down_mode: Optional[Union[str, "_models.ScaleDownMode"]] = None, + type: Optional[Union[str, "_models.AgentPoolType"]] = None, + mode: Optional[Union[str, "_models.AgentPoolMode"]] = None, orchestrator_version: Optional[str] = None, - upgrade_settings: Optional["AgentPoolUpgradeSettings"] = None, - power_state: Optional["PowerState"] = None, + upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, + power_state: Optional["_models.PowerState"] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", spot_max_price: Optional[float] = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, proximity_placement_group_id: Optional[str] = None, - kubelet_config: Optional["KubeletConfig"] = None, - linux_os_config: Optional["LinuxOSConfig"] = None, + kubelet_config: Optional["_models.KubeletConfig"] = None, + linux_os_config: Optional["_models.LinuxOSConfig"] = None, enable_encryption_at_host: Optional[bool] = None, enable_ultra_ssd: Optional[bool] = None, enable_fips: Optional[bool] = None, - gpu_instance_profile: Optional[Union[str, "GPUInstanceProfile"]] = None, - creation_data: Optional["CreationData"] = None, + gpu_instance_profile: Optional[Union[str, "_models.GPUInstanceProfile"]] = None, + creation_data: Optional["_models.CreationData"] = None, **kwargs ): """ @@ -2657,15 +2656,15 @@ def __init__( :keyword os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS - `_. Possible values - include: "Managed", "Ephemeral". + `_. Known values are: + "Managed", "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2022_01_01.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Possible values include: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_01_01.models.KubeletDiskType - :keyword workload_runtime: Determines the type of workload a node can run. Possible values - include: "OCIContainer", "WasmWasi". + :keyword workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer", "WasmWasi". :paramtype workload_runtime: str or ~azure.mgmt.containerservice.v2022_01_01.models.WorkloadRuntime :keyword vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and @@ -2679,11 +2678,11 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_01_01.models.OSType :keyword os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Possible values include: "Ubuntu", "CBLMariner". + Known values are: "Ubuntu", "CBLMariner". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2022_01_01.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -2692,16 +2691,15 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, - it defaults to Delete. Possible values include: "Delete", "Deallocate". + it defaults to Delete. Known values are: "Delete", "Deallocate". :paramtype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_01_01.models.ScaleDownMode - :keyword type: The type of Agent Pool. Possible values include: "VirtualMachineScaleSets", + :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2022_01_01.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Possible values include: "System", - "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2022_01_01.models.AgentPoolMode :keyword orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -2732,12 +2730,12 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Possible values include: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_01_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Possible values include: "Delete", - "Deallocate". Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_01_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which @@ -2769,7 +2767,7 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_01_01.models.GPUInstanceProfile @@ -2841,15 +2839,15 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS - `_. Possible values - include: "Managed", "Ephemeral". + `_. Known values are: + "Managed", "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2022_01_01.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Possible values include: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_01_01.models.KubeletDiskType - :ivar workload_runtime: Determines the type of workload a node can run. Possible values - include: "OCIContainer", "WasmWasi". + :ivar workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer", "WasmWasi". :vartype workload_runtime: str or ~azure.mgmt.containerservice.v2022_01_01.models.WorkloadRuntime :ivar vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and used. @@ -2863,11 +2861,11 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_01_01.models.OSType - :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Possible values include: "Ubuntu", "CBLMariner". + :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known + values are: "Ubuntu", "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2022_01_01.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. :vartype max_count: int @@ -2876,15 +2874,14 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it - defaults to Delete. Possible values include: "Delete", "Deallocate". + defaults to Delete. Known values are: "Delete", "Deallocate". :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_01_01.models.ScaleDownMode - :ivar type: The type of Agent Pool. Possible values include: "VirtualMachineScaleSets", + :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2022_01_01.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Possible values include: "System", - "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". :vartype mode: str or ~azure.mgmt.containerservice.v2022_01_01.models.AgentPoolMode :ivar orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -2919,12 +2916,12 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Possible values include: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_01_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Possible values include: "Delete", - "Deallocate". Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_01_01.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which @@ -2956,7 +2953,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_01_01.models.GPUInstanceProfile :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool @@ -3023,40 +3020,40 @@ def __init__( count: Optional[int] = None, vm_size: Optional[str] = None, os_disk_size_gb: Optional[int] = None, - os_disk_type: Optional[Union[str, "OSDiskType"]] = None, - kubelet_disk_type: Optional[Union[str, "KubeletDiskType"]] = None, - workload_runtime: Optional[Union[str, "WorkloadRuntime"]] = None, + os_disk_type: Optional[Union[str, "_models.OSDiskType"]] = None, + kubelet_disk_type: Optional[Union[str, "_models.KubeletDiskType"]] = None, + workload_runtime: Optional[Union[str, "_models.WorkloadRuntime"]] = None, vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", - os_sku: Optional[Union[str, "OSSKU"]] = None, + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - scale_down_mode: Optional[Union[str, "ScaleDownMode"]] = None, - type: Optional[Union[str, "AgentPoolType"]] = None, - mode: Optional[Union[str, "AgentPoolMode"]] = None, + scale_down_mode: Optional[Union[str, "_models.ScaleDownMode"]] = None, + type: Optional[Union[str, "_models.AgentPoolType"]] = None, + mode: Optional[Union[str, "_models.AgentPoolMode"]] = None, orchestrator_version: Optional[str] = None, - upgrade_settings: Optional["AgentPoolUpgradeSettings"] = None, - power_state: Optional["PowerState"] = None, + upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, + power_state: Optional["_models.PowerState"] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", spot_max_price: Optional[float] = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, proximity_placement_group_id: Optional[str] = None, - kubelet_config: Optional["KubeletConfig"] = None, - linux_os_config: Optional["LinuxOSConfig"] = None, + kubelet_config: Optional["_models.KubeletConfig"] = None, + linux_os_config: Optional["_models.LinuxOSConfig"] = None, enable_encryption_at_host: Optional[bool] = None, enable_ultra_ssd: Optional[bool] = None, enable_fips: Optional[bool] = None, - gpu_instance_profile: Optional[Union[str, "GPUInstanceProfile"]] = None, - creation_data: Optional["CreationData"] = None, + gpu_instance_profile: Optional[Union[str, "_models.GPUInstanceProfile"]] = None, + creation_data: Optional["_models.CreationData"] = None, **kwargs ): """ @@ -3075,15 +3072,15 @@ def __init__( :keyword os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS - `_. Possible values - include: "Managed", "Ephemeral". + `_. Known values are: + "Managed", "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2022_01_01.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Possible values include: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_01_01.models.KubeletDiskType - :keyword workload_runtime: Determines the type of workload a node can run. Possible values - include: "OCIContainer", "WasmWasi". + :keyword workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer", "WasmWasi". :paramtype workload_runtime: str or ~azure.mgmt.containerservice.v2022_01_01.models.WorkloadRuntime :keyword vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and @@ -3097,11 +3094,11 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_01_01.models.OSType :keyword os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Possible values include: "Ubuntu", "CBLMariner". + Known values are: "Ubuntu", "CBLMariner". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2022_01_01.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -3110,16 +3107,15 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, - it defaults to Delete. Possible values include: "Delete", "Deallocate". + it defaults to Delete. Known values are: "Delete", "Deallocate". :paramtype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_01_01.models.ScaleDownMode - :keyword type: The type of Agent Pool. Possible values include: "VirtualMachineScaleSets", + :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2022_01_01.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Possible values include: "System", - "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2022_01_01.models.AgentPoolMode :keyword orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -3150,12 +3146,12 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Possible values include: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_01_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Possible values include: "Delete", - "Deallocate". Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_01_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which @@ -3187,7 +3183,7 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_01_01.models.GPUInstanceProfile @@ -3272,8 +3268,8 @@ class ManagedClusterAutoUpgradeProfile(msrest.serialization.Model): """Auto upgrade profile for a managed cluster. :ivar upgrade_channel: For more information see `setting the AKS cluster auto-upgrade channel - `_. Possible - values include: "rapid", "stable", "patch", "node-image", "none". + `_. Known values + are: "rapid", "stable", "patch", "node-image", "none". :vartype upgrade_channel: str or ~azure.mgmt.containerservice.v2022_01_01.models.UpgradeChannel """ @@ -3284,13 +3280,13 @@ class ManagedClusterAutoUpgradeProfile(msrest.serialization.Model): def __init__( self, *, - upgrade_channel: Optional[Union[str, "UpgradeChannel"]] = None, + upgrade_channel: Optional[Union[str, "_models.UpgradeChannel"]] = None, **kwargs ): """ :keyword upgrade_channel: For more information see `setting the AKS cluster auto-upgrade channel `_. - Possible values include: "rapid", "stable", "patch", "node-image", "none". + Known values are: "rapid", "stable", "patch", "node-image", "none". :paramtype upgrade_channel: str or ~azure.mgmt.containerservice.v2022_01_01.models.UpgradeChannel """ @@ -3356,7 +3352,7 @@ class ManagedClusterIdentity(msrest.serialization.Model): components. :vartype tenant_id: str :ivar type: For more information see `use managed identities in AKS - `_. Possible values include: + `_. Known values are: "SystemAssigned", "UserAssigned", "None". :vartype type: str or ~azure.mgmt.containerservice.v2022_01_01.models.ResourceIdentityType :ivar user_assigned_identities: The keys must be ARM resource IDs in the form: @@ -3380,13 +3376,13 @@ class ManagedClusterIdentity(msrest.serialization.Model): def __init__( self, *, - type: Optional[Union[str, "ResourceIdentityType"]] = None, - user_assigned_identities: Optional[Dict[str, "ManagedServiceIdentityUserAssignedIdentitiesValue"]] = None, + type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, + user_assigned_identities: Optional[Dict[str, "_models.ManagedServiceIdentityUserAssignedIdentitiesValue"]] = None, **kwargs ): """ :keyword type: For more information see `use managed identities in AKS - `_. Possible values include: + `_. Known values are: "SystemAssigned", "UserAssigned", "None". :paramtype type: str or ~azure.mgmt.containerservice.v2022_01_01.models.ResourceIdentityType :keyword user_assigned_identities: The keys must be ARM resource IDs in the form: @@ -3424,7 +3420,7 @@ class ManagedClusterListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["ManagedCluster"]] = None, + value: Optional[List["_models.ManagedCluster"]] = None, **kwargs ): """ @@ -3482,10 +3478,10 @@ class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): def __init__( self, *, - managed_outbound_i_ps: Optional["ManagedClusterLoadBalancerProfileManagedOutboundIPs"] = None, - outbound_ip_prefixes: Optional["ManagedClusterLoadBalancerProfileOutboundIPPrefixes"] = None, - outbound_i_ps: Optional["ManagedClusterLoadBalancerProfileOutboundIPs"] = None, - effective_outbound_i_ps: Optional[List["ResourceReference"]] = None, + managed_outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileManagedOutboundIPs"] = None, + outbound_ip_prefixes: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPPrefixes"] = None, + outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPs"] = None, + effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, allocated_outbound_ports: Optional[int] = 0, idle_timeout_in_minutes: Optional[int] = 30, enable_multiple_standard_load_balancers: Optional[bool] = None, @@ -3587,7 +3583,7 @@ class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.M def __init__( self, *, - public_ip_prefixes: Optional[List["ResourceReference"]] = None, + public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, **kwargs ): """ @@ -3613,7 +3609,7 @@ class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): def __init__( self, *, - public_i_ps: Optional[List["ResourceReference"]] = None, + public_i_ps: Optional[List["_models.ResourceReference"]] = None, **kwargs ): """ @@ -3683,8 +3679,8 @@ class ManagedClusterNATGatewayProfile(msrest.serialization.Model): def __init__( self, *, - managed_outbound_ip_profile: Optional["ManagedClusterManagedOutboundIPProfile"] = None, - effective_outbound_i_ps: Optional[List["ResourceReference"]] = None, + managed_outbound_ip_profile: Optional["_models.ManagedClusterManagedOutboundIPProfile"] = None, + effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, idle_timeout_in_minutes: Optional[int] = 4, **kwargs ): @@ -3722,8 +3718,8 @@ class ManagedClusterPodIdentity(msrest.serialization.Model): :vartype binding_selector: str :ivar identity: Required. The user assigned identity details. :vartype identity: ~azure.mgmt.containerservice.v2022_01_01.models.UserAssignedIdentity - :ivar provisioning_state: The current provisioning state of the pod identity. Possible values - include: "Assigned", "Updating", "Deleting", "Failed". + :ivar provisioning_state: The current provisioning state of the pod identity. Known values are: + "Assigned", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2022_01_01.models.ManagedClusterPodIdentityProvisioningState :ivar provisioning_info: @@ -3753,7 +3749,7 @@ def __init__( *, name: str, namespace: str, - identity: "UserAssignedIdentity", + identity: "_models.UserAssignedIdentity", binding_selector: Optional[str] = None, **kwargs ): @@ -3854,8 +3850,8 @@ def __init__( *, enabled: Optional[bool] = None, allow_network_plugin_kubenet: Optional[bool] = None, - user_assigned_identities: Optional[List["ManagedClusterPodIdentity"]] = None, - user_assigned_identity_exceptions: Optional[List["ManagedClusterPodIdentityException"]] = None, + user_assigned_identities: Optional[List["_models.ManagedClusterPodIdentity"]] = None, + user_assigned_identity_exceptions: Optional[List["_models.ManagedClusterPodIdentityException"]] = None, **kwargs ): """ @@ -3896,7 +3892,7 @@ class ManagedClusterPodIdentityProvisioningError(msrest.serialization.Model): def __init__( self, *, - error: Optional["ManagedClusterPodIdentityProvisioningErrorBody"] = None, + error: Optional["_models.ManagedClusterPodIdentityProvisioningErrorBody"] = None, **kwargs ): """ @@ -3938,7 +3934,7 @@ def __init__( code: Optional[str] = None, message: Optional[str] = None, target: Optional[str] = None, - details: Optional[List["ManagedClusterPodIdentityProvisioningErrorBody"]] = None, + details: Optional[List["_models.ManagedClusterPodIdentityProvisioningErrorBody"]] = None, **kwargs ): """ @@ -3977,7 +3973,7 @@ class ManagedClusterPodIdentityProvisioningInfo(msrest.serialization.Model): def __init__( self, *, - error: Optional["ManagedClusterPodIdentityProvisioningError"] = None, + error: Optional["_models.ManagedClusterPodIdentityProvisioningError"] = None, **kwargs ): """ @@ -3998,8 +3994,8 @@ class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): :vartype kubernetes_version: str :ivar name: The Agent Pool name. :vartype name: str - :ivar os_type: Required. The operating system type. The default is Linux. Possible values - include: "Linux", "Windows". Default value: "Linux". + :ivar os_type: Required. The operating system type. The default is Linux. Known values are: + "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_01_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -4022,9 +4018,9 @@ def __init__( self, *, kubernetes_version: str, - os_type: Union[str, "OSType"] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", name: Optional[str] = None, - upgrades: Optional[List["ManagedClusterPoolUpgradeProfileUpgradesItem"]] = None, + upgrades: Optional[List["_models.ManagedClusterPoolUpgradeProfileUpgradesItem"]] = None, **kwargs ): """ @@ -4032,8 +4028,8 @@ def __init__( :paramtype kubernetes_version: str :keyword name: The Agent Pool name. :paramtype name: str - :keyword os_type: Required. The operating system type. The default is Linux. Possible values - include: "Linux", "Windows". Default value: "Linux". + :keyword os_type: Required. The operating system type. The default is Linux. Known values are: + "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_01_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: @@ -4085,8 +4081,7 @@ class ManagedClusterPropertiesAutoScalerProfile(msrest.serialization.Model): :vartype balance_similar_node_groups: str :ivar expander: If not specified, the default is 'random'. See `expanders `_ - for more information. Possible values include: "least-waste", "most-pods", "priority", - "random". + for more information. Known values are: "least-waste", "most-pods", "priority", "random". :vartype expander: str or ~azure.mgmt.containerservice.v2022_01_01.models.Expander :ivar max_empty_bulk_delete: The default is 10. :vartype max_empty_bulk_delete: str @@ -4153,7 +4148,7 @@ def __init__( self, *, balance_similar_node_groups: Optional[str] = None, - expander: Optional[Union[str, "Expander"]] = None, + expander: Optional[Union[str, "_models.Expander"]] = None, max_empty_bulk_delete: Optional[str] = None, max_graceful_termination_sec: Optional[str] = None, max_node_provision_time: Optional[str] = None, @@ -4176,8 +4171,7 @@ def __init__( :paramtype balance_similar_node_groups: str :keyword expander: If not specified, the default is 'random'. See `expanders `_ - for more information. Possible values include: "least-waste", "most-pods", "priority", - "random". + for more information. Known values are: "least-waste", "most-pods", "priority", "random". :paramtype expander: str or ~azure.mgmt.containerservice.v2022_01_01.models.Expander :keyword max_empty_bulk_delete: The default is 10. :paramtype max_empty_bulk_delete: str @@ -4255,7 +4249,7 @@ class ManagedClusterSecurityProfile(msrest.serialization.Model): def __init__( self, *, - azure_defender: Optional["ManagedClusterSecurityProfileAzureDefender"] = None, + azure_defender: Optional["_models.ManagedClusterSecurityProfileAzureDefender"] = None, **kwargs ): """ @@ -4344,11 +4338,11 @@ def __init__( class ManagedClusterSKU(msrest.serialization.Model): """The SKU of a Managed Cluster. - :ivar name: The name of a managed cluster SKU. Possible values include: "Basic". + :ivar name: The name of a managed cluster SKU. Known values are: "Basic". :vartype name: str or ~azure.mgmt.containerservice.v2022_01_01.models.ManagedClusterSKUName :ivar tier: If not specified, the default is 'Free'. See `uptime SLA - `_ for more details. Possible values include: - "Paid", "Free". + `_ for more details. Known values are: "Paid", + "Free". :vartype tier: str or ~azure.mgmt.containerservice.v2022_01_01.models.ManagedClusterSKUTier """ @@ -4360,16 +4354,16 @@ class ManagedClusterSKU(msrest.serialization.Model): def __init__( self, *, - name: Optional[Union[str, "ManagedClusterSKUName"]] = None, - tier: Optional[Union[str, "ManagedClusterSKUTier"]] = None, + name: Optional[Union[str, "_models.ManagedClusterSKUName"]] = None, + tier: Optional[Union[str, "_models.ManagedClusterSKUTier"]] = None, **kwargs ): """ - :keyword name: The name of a managed cluster SKU. Possible values include: "Basic". + :keyword name: The name of a managed cluster SKU. Known values are: "Basic". :paramtype name: str or ~azure.mgmt.containerservice.v2022_01_01.models.ManagedClusterSKUName :keyword tier: If not specified, the default is 'Free'. See `uptime SLA - `_ for more details. Possible values include: - "Paid", "Free". + `_ for more details. Known values are: "Paid", + "Free". :paramtype tier: str or ~azure.mgmt.containerservice.v2022_01_01.models.ManagedClusterSKUTier """ super(ManagedClusterSKU, self).__init__(**kwargs) @@ -4418,8 +4412,8 @@ class ManagedClusterUpgradeProfile(msrest.serialization.Model): def __init__( self, *, - control_plane_profile: "ManagedClusterPoolUpgradeProfile", - agent_pool_profiles: List["ManagedClusterPoolUpgradeProfile"], + control_plane_profile: "_models.ManagedClusterPoolUpgradeProfile", + agent_pool_profiles: List["_models.ManagedClusterPoolUpgradeProfile"], **kwargs ): """ @@ -4461,8 +4455,8 @@ class ManagedClusterWindowsProfile(msrest.serialization.Model): "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!". :vartype admin_password: str :ivar license_type: The license type to use for Windows VMs. See `Azure Hybrid User Benefits - `_ for more details. Possible values - include: "None", "Windows_Server". + `_ for more details. Known values are: + "None", "Windows_Server". :vartype license_type: str or ~azure.mgmt.containerservice.v2022_01_01.models.LicenseType :ivar enable_csi_proxy: For more details on CSI proxy, see the `CSI proxy GitHub repo `_. @@ -4488,9 +4482,9 @@ def __init__( *, admin_username: str, admin_password: Optional[str] = None, - license_type: Optional[Union[str, "LicenseType"]] = None, + license_type: Optional[Union[str, "_models.LicenseType"]] = None, enable_csi_proxy: Optional[bool] = None, - gmsa_profile: Optional["WindowsGmsaProfile"] = None, + gmsa_profile: Optional["_models.WindowsGmsaProfile"] = None, **kwargs ): """ @@ -4511,8 +4505,8 @@ def __init__( "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!". :paramtype admin_password: str :keyword license_type: The license type to use for Windows VMs. See `Azure Hybrid User Benefits - `_ for more details. Possible values - include: "None", "Windows_Server". + `_ for more details. Known values are: + "None", "Windows_Server". :paramtype license_type: str or ~azure.mgmt.containerservice.v2022_01_01.models.LicenseType :keyword enable_csi_proxy: For more details on CSI proxy, see the `CSI proxy GitHub repo `_. @@ -4674,7 +4668,7 @@ class OSOptionProfile(msrest.serialization.Model): def __init__( self, *, - os_option_property_list: List["OSOptionProperty"], + os_option_property_list: List["_models.OSOptionProperty"], **kwargs ): """ @@ -4747,7 +4741,7 @@ def __init__( self, *, category: Optional[str] = None, - endpoints: Optional[List["EndpointDependency"]] = None, + endpoints: Optional[List["_models.EndpointDependency"]] = None, **kwargs ): """ @@ -4789,7 +4783,7 @@ class OutboundEnvironmentEndpointCollection(msrest.serialization.Model): def __init__( self, *, - value: List["OutboundEnvironmentEndpoint"], + value: List["_models.OutboundEnvironmentEndpoint"], **kwargs ): """ @@ -4805,8 +4799,8 @@ def __init__( class PowerState(msrest.serialization.Model): """Describes the Power State of the cluster. - :ivar code: Tells whether the cluster is Running or Stopped. Possible values include: - "Running", "Stopped". + :ivar code: Tells whether the cluster is Running or Stopped. Known values are: "Running", + "Stopped". :vartype code: str or ~azure.mgmt.containerservice.v2022_01_01.models.Code """ @@ -4817,12 +4811,12 @@ class PowerState(msrest.serialization.Model): def __init__( self, *, - code: Optional[Union[str, "Code"]] = None, + code: Optional[Union[str, "_models.Code"]] = None, **kwargs ): """ - :keyword code: Tells whether the cluster is Running or Stopped. Possible values include: - "Running", "Stopped". + :keyword code: Tells whether the cluster is Running or Stopped. Known values are: "Running", + "Stopped". :paramtype code: str or ~azure.mgmt.containerservice.v2022_01_01.models.Code """ super(PowerState, self).__init__(**kwargs) @@ -4865,7 +4859,7 @@ class PrivateEndpointConnection(msrest.serialization.Model): :vartype name: str :ivar type: The resource type. :vartype type: str - :ivar provisioning_state: The current provisioning state. Possible values include: "Succeeded", + :ivar provisioning_state: The current provisioning state. Known values are: "Succeeded", "Creating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2022_01_01.models.PrivateEndpointConnectionProvisioningState @@ -4896,8 +4890,8 @@ class PrivateEndpointConnection(msrest.serialization.Model): def __init__( self, *, - private_endpoint: Optional["PrivateEndpoint"] = None, - private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, + private_endpoint: Optional["_models.PrivateEndpoint"] = None, + private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionState"] = None, **kwargs ): """ @@ -4931,7 +4925,7 @@ class PrivateEndpointConnectionListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["PrivateEndpointConnection"]] = None, + value: Optional[List["_models.PrivateEndpointConnection"]] = None, **kwargs ): """ @@ -5021,7 +5015,7 @@ class PrivateLinkResourcesListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["PrivateLinkResource"]] = None, + value: Optional[List["_models.PrivateLinkResource"]] = None, **kwargs ): """ @@ -5035,7 +5029,7 @@ def __init__( class PrivateLinkServiceConnectionState(msrest.serialization.Model): """The state of a private link service connection. - :ivar status: The private link service connection status. Possible values include: "Pending", + :ivar status: The private link service connection status. Known values are: "Pending", "Approved", "Rejected", "Disconnected". :vartype status: str or ~azure.mgmt.containerservice.v2022_01_01.models.ConnectionStatus :ivar description: The private link service connection description. @@ -5050,13 +5044,13 @@ class PrivateLinkServiceConnectionState(msrest.serialization.Model): def __init__( self, *, - status: Optional[Union[str, "ConnectionStatus"]] = None, + status: Optional[Union[str, "_models.ConnectionStatus"]] = None, description: Optional[str] = None, **kwargs ): """ - :keyword status: The private link service connection status. Possible values include: - "Pending", "Approved", "Rejected", "Disconnected". + :keyword status: The private link service connection status. Known values are: "Pending", + "Approved", "Rejected", "Disconnected". :paramtype status: str or ~azure.mgmt.containerservice.v2022_01_01.models.ConnectionStatus :keyword description: The private link service connection description. :paramtype description: str @@ -5215,18 +5209,18 @@ class Snapshot(Resource): :ivar creation_data: CreationData to be used to specify the source agent pool resource ID to create this snapshot. :vartype creation_data: ~azure.mgmt.containerservice.v2022_01_01.models.CreationData - :ivar snapshot_type: The type of a snapshot. The default is NodePool. Possible values include: + :ivar snapshot_type: The type of a snapshot. The default is NodePool. Known values are: "NodePool". Default value: "NodePool". :vartype snapshot_type: str or ~azure.mgmt.containerservice.v2022_01_01.models.SnapshotType :ivar kubernetes_version: The version of Kubernetes. :vartype kubernetes_version: str :ivar node_image_version: The version of node image. :vartype node_image_version: str - :ivar os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_01_01.models.OSType - :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Possible values include: "Ubuntu", "CBLMariner". + :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known + values are: "Ubuntu", "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2022_01_01.models.OSSKU :ivar vm_size: The size of the VM. :vartype vm_size: str @@ -5270,8 +5264,8 @@ def __init__( *, location: str, tags: Optional[Dict[str, str]] = None, - creation_data: Optional["CreationData"] = None, - snapshot_type: Optional[Union[str, "SnapshotType"]] = "NodePool", + creation_data: Optional["_models.CreationData"] = None, + snapshot_type: Optional[Union[str, "_models.SnapshotType"]] = "NodePool", **kwargs ): """ @@ -5282,8 +5276,8 @@ def __init__( :keyword creation_data: CreationData to be used to specify the source agent pool resource ID to create this snapshot. :paramtype creation_data: ~azure.mgmt.containerservice.v2022_01_01.models.CreationData - :keyword snapshot_type: The type of a snapshot. The default is NodePool. Possible values - include: "NodePool". Default value: "NodePool". + :keyword snapshot_type: The type of a snapshot. The default is NodePool. Known values are: + "NodePool". Default value: "NodePool". :paramtype snapshot_type: str or ~azure.mgmt.containerservice.v2022_01_01.models.SnapshotType """ super(Snapshot, self).__init__(location=location, tags=tags, **kwargs) @@ -5321,7 +5315,7 @@ class SnapshotListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["Snapshot"]] = None, + value: Optional[List["_models.Snapshot"]] = None, **kwargs ): """ @@ -5552,15 +5546,15 @@ class SystemData(msrest.serialization.Model): :ivar created_by: The identity that created the resource. :vartype created_by: str - :ivar created_by_type: The type of identity that created the resource. Possible values include: + :ivar created_by_type: The type of identity that created the resource. Known values are: "User", "Application", "ManagedIdentity", "Key". :vartype created_by_type: str or ~azure.mgmt.containerservice.v2022_01_01.models.CreatedByType :ivar created_at: The UTC timestamp of resource creation. :vartype created_at: ~datetime.datetime :ivar last_modified_by: The identity that last modified the resource. :vartype last_modified_by: str - :ivar last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". + :ivar last_modified_by_type: The type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", "Key". :vartype last_modified_by_type: str or ~azure.mgmt.containerservice.v2022_01_01.models.CreatedByType :ivar last_modified_at: The type of identity that last modified the resource. @@ -5580,26 +5574,26 @@ def __init__( self, *, created_by: Optional[str] = None, - created_by_type: Optional[Union[str, "CreatedByType"]] = None, + created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, created_at: Optional[datetime.datetime] = None, last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[Union[str, "CreatedByType"]] = None, + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, last_modified_at: Optional[datetime.datetime] = None, **kwargs ): """ :keyword created_by: The identity that created the resource. :paramtype created_by: str - :keyword created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". + :keyword created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", "Key". :paramtype created_by_type: str or ~azure.mgmt.containerservice.v2022_01_01.models.CreatedByType :keyword created_at: The UTC timestamp of resource creation. :paramtype created_at: ~datetime.datetime :keyword last_modified_by: The identity that last modified the resource. :paramtype last_modified_by: str - :keyword last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". + :keyword last_modified_by_type: The type of identity that last modified the resource. Known + values are: "User", "Application", "ManagedIdentity", "Key". :paramtype last_modified_by_type: str or ~azure.mgmt.containerservice.v2022_01_01.models.CreatedByType :keyword last_modified_at: The type of identity that last modified the resource. @@ -5642,8 +5636,8 @@ def __init__( class TimeInWeek(msrest.serialization.Model): """Time in a week. - :ivar day: The day of the week. Possible values include: "Sunday", "Monday", "Tuesday", - "Wednesday", "Thursday", "Friday", "Saturday". + :ivar day: The day of the week. Known values are: "Sunday", "Monday", "Tuesday", "Wednesday", + "Thursday", "Friday", "Saturday". :vartype day: str or ~azure.mgmt.containerservice.v2022_01_01.models.WeekDay :ivar hour_slots: Each integer hour represents a time range beginning at 0m after the hour ending at the next hour (non-inclusive). 0 corresponds to 00:00 UTC, 23 corresponds to 23:00 @@ -5659,12 +5653,12 @@ class TimeInWeek(msrest.serialization.Model): def __init__( self, *, - day: Optional[Union[str, "WeekDay"]] = None, + day: Optional[Union[str, "_models.WeekDay"]] = None, hour_slots: Optional[List[int]] = None, **kwargs ): """ - :keyword day: The day of the week. Possible values include: "Sunday", "Monday", "Tuesday", + :keyword day: The day of the week. Known values are: "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday". :paramtype day: str or ~azure.mgmt.containerservice.v2022_01_01.models.WeekDay :keyword hour_slots: Each integer hour represents a time range beginning at 0m after the hour diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/models/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/models/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/operations/__init__.py index 5e1e5e72fa59..e0748876288c 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/operations/__init__.py @@ -15,6 +15,9 @@ from ._resolve_private_link_service_id_operations import ResolvePrivateLinkServiceIdOperations from ._snapshots_operations import SnapshotsOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'Operations', 'ManagedClustersOperations', @@ -25,3 +28,5 @@ 'ResolvePrivateLinkServiceIdOperations', 'SnapshotsOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/operations/_agent_pools_operations.py index eb6cecdc20b5..3bc68ab11bc5 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/operations/_agent_pools_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -35,9 +35,12 @@ def build_list_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools") # pylint: disable=line-too-long path_format_arguments = { @@ -49,18 +52,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -72,9 +73,12 @@ def build_get_request( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -87,18 +91,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -109,14 +111,17 @@ def build_create_or_update_request_initial( resource_name: str, agent_pool_name: str, *, - json: JSONType = None, + json: Optional[_models.AgentPool] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -129,20 +134,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -156,9 +159,12 @@ def build_delete_request_initial( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -171,18 +177,16 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -194,9 +198,12 @@ def build_get_upgrade_profile_request( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default") # pylint: disable=line-too-long path_format_arguments = { @@ -209,18 +216,16 @@ def build_get_upgrade_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -231,9 +236,12 @@ def build_get_available_agent_pool_versions_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions") # pylint: disable=line-too-long path_format_arguments = { @@ -245,18 +253,16 @@ def build_get_available_agent_pool_versions_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -268,9 +274,12 @@ def build_upgrade_node_image_version_request_initial( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion") # pylint: disable=line-too-long path_format_arguments = { @@ -283,42 +292,38 @@ def build_upgrade_node_image_version_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class AgentPoolsOperations(object): - """AgentPoolsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class AgentPoolsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_01_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_01_01.ContainerServiceClient`'s + :attr:`agent_pools` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -326,7 +331,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Iterable["_models.AgentPoolListResult"]: + ) -> Iterable[_models.AgentPoolListResult]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. @@ -341,13 +346,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_01_01.models.AgentPoolListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -357,9 +365,11 @@ def prepare_request(next_link=None): resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -369,9 +379,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -411,7 +423,7 @@ def get( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPool": + ) -> _models.AgentPool: """Gets the specified managed cluster agent pool. Gets the specified managed cluster agent pool. @@ -427,13 +439,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.AgentPool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] request = build_get_request( @@ -443,11 +458,13 @@ def get( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -473,17 +490,20 @@ def _create_or_update_initial( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> "_models.AgentPool": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] + ) -> _models.AgentPool: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-01-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] _json = self._serialize.body(parameters, 'AgentPool') @@ -496,11 +516,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -531,9 +553,9 @@ def begin_create_or_update( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> LROPoller["_models.AgentPool"]: + ) -> LROPoller[_models.AgentPool]: """Creates or updates an agent pool in the specified managed cluster. Creates or updates an agent pool in the specified managed cluster. @@ -559,17 +581,20 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_01_01.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, @@ -577,20 +602,27 @@ def begin_create_or_update( 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): - response = pipeline_response.http_response deserialized = self._deserialize('AgentPool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -610,13 +642,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements agent_pool_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -626,11 +661,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -677,21 +714,26 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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) @@ -701,8 +743,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -722,7 +770,7 @@ def get_upgrade_profile( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPoolUpgradeProfile": + ) -> _models.AgentPoolUpgradeProfile: """Gets the upgrade profile for an agent pool. Gets the upgrade profile for an agent pool. @@ -738,13 +786,16 @@ def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.AgentPoolUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] request = build_get_upgrade_profile_request( @@ -754,11 +805,13 @@ def get_upgrade_profile( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -785,7 +838,7 @@ def get_available_agent_pool_versions( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.AgentPoolAvailableVersions": + ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported Kubernetes versions for the specified agent pool. See `supported Kubernetes versions @@ -801,13 +854,16 @@ def get_available_agent_pool_versions( :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.AgentPoolAvailableVersions :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolAvailableVersions"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] request = build_get_available_agent_pool_versions_request( @@ -816,11 +872,13 @@ def get_available_agent_pool_versions( resource_name=resource_name, api_version=api_version, template_url=self.get_available_agent_pool_versions.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -847,14 +905,17 @@ def _upgrade_node_image_version_initial( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> Optional["_models.AgentPool"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.AgentPool"]] + ) -> Optional[_models.AgentPool]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] request = build_upgrade_node_image_version_request_initial( @@ -864,11 +925,13 @@ def _upgrade_node_image_version_initial( agent_pool_name=agent_pool_name, api_version=api_version, template_url=self._upgrade_node_image_version_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -901,7 +964,7 @@ def begin_upgrade_node_image_version( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> LROPoller["_models.AgentPool"]: + ) -> LROPoller[_models.AgentPool]: """Upgrades the node image version of an agent pool to the latest. Upgrading the node image version of an agent pool applies the newest OS and runtime updates to @@ -927,21 +990,26 @@ def begin_upgrade_node_image_version( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_01_01.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._upgrade_node_image_version_initial( + raw_result = self._upgrade_node_image_version_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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) @@ -957,8 +1025,14 @@ def get_long_running_output(pipeline_response): return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/operations/_maintenance_configurations_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/operations/_maintenance_configurations_operations.py index f7f074ea8d2d..13d2dd4eb5c4 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/operations/_maintenance_configurations_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/operations/_maintenance_configurations_operations.py @@ -16,12 +16,12 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -33,9 +33,12 @@ def build_list_by_managed_cluster_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations") # pylint: disable=line-too-long path_format_arguments = { @@ -47,18 +50,16 @@ def build_list_by_managed_cluster_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -70,9 +71,12 @@ def build_get_request( config_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long path_format_arguments = { @@ -85,18 +89,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -107,14 +109,17 @@ def build_create_or_update_request( resource_name: str, config_name: str, *, - json: JSONType = None, + json: Optional[_models.MaintenanceConfiguration] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long path_format_arguments = { @@ -127,20 +132,18 @@ def build_create_or_update_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -154,9 +157,12 @@ def build_delete_request( config_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long path_format_arguments = { @@ -169,42 +175,38 @@ def build_delete_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class MaintenanceConfigurationsOperations(object): - """MaintenanceConfigurationsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class MaintenanceConfigurationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_01_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_01_01.ContainerServiceClient`'s + :attr:`maintenance_configurations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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_by_managed_cluster( @@ -212,7 +214,7 @@ def list_by_managed_cluster( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Iterable["_models.MaintenanceConfigurationListResult"]: + ) -> Iterable[_models.MaintenanceConfigurationListResult]: """Gets a list of maintenance configurations in the specified managed cluster. Gets a list of maintenance configurations in the specified managed cluster. @@ -228,13 +230,16 @@ def list_by_managed_cluster( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_01_01.models.MaintenanceConfigurationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfigurationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfigurationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -244,9 +249,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=self.list_by_managed_cluster.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -256,9 +263,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -298,7 +307,7 @@ def get( resource_name: str, config_name: str, **kwargs: Any - ) -> "_models.MaintenanceConfiguration": + ) -> _models.MaintenanceConfiguration: """Gets the specified maintenance configuration of a managed cluster. Gets the specified maintenance configuration of a managed cluster. @@ -314,13 +323,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.MaintenanceConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfiguration"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] request = build_get_request( @@ -330,11 +342,13 @@ def get( config_name=config_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -361,9 +375,9 @@ def create_or_update( resource_group_name: str, resource_name: str, config_name: str, - parameters: "_models.MaintenanceConfiguration", + parameters: _models.MaintenanceConfiguration, **kwargs: Any - ) -> "_models.MaintenanceConfiguration": + ) -> _models.MaintenanceConfiguration: """Creates or updates a maintenance configuration in the specified managed cluster. Creates or updates a maintenance configuration in the specified managed cluster. @@ -381,14 +395,17 @@ def create_or_update( :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.MaintenanceConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfiguration"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-01-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] _json = self._serialize.body(parameters, 'MaintenanceConfiguration') @@ -401,11 +418,13 @@ def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -449,13 +468,16 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -465,11 +487,13 @@ def delete( # pylint: disable=inconsistent-return-statements config_name=config_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/operations/_managed_clusters_operations.py index e4b94ad80ca7..9f2703d3d605 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/operations/_managed_clusters_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -36,9 +36,12 @@ def build_get_os_options_request( resource_type: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default") # pylint: disable=line-too-long path_format_arguments = { @@ -49,20 +52,18 @@ def build_get_os_options_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if resource_type is not None: - _query_parameters['resource-type'] = _SERIALIZER.query("resource_type", resource_type, 'str') + _params['resource-type'] = _SERIALIZER.query("resource_type", resource_type, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -71,9 +72,12 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters") path_format_arguments = { @@ -83,18 +87,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -104,9 +106,12 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters") # pylint: disable=line-too-long path_format_arguments = { @@ -117,18 +122,16 @@ def build_list_by_resource_group_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -139,9 +142,12 @@ def build_get_upgrade_profile_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default") # pylint: disable=line-too-long path_format_arguments = { @@ -153,18 +159,16 @@ def build_get_upgrade_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -176,9 +180,12 @@ def build_get_access_profile_request( role_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -191,18 +198,16 @@ def build_get_access_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -215,9 +220,12 @@ def build_list_cluster_admin_credentials_request( server_fqdn: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -229,20 +237,18 @@ def build_list_cluster_admin_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if server_fqdn is not None: - _query_parameters['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -256,9 +262,12 @@ def build_list_cluster_user_credentials_request( format: Optional[Union[str, "_models.Format"]] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -270,22 +279,20 @@ def build_list_cluster_user_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if server_fqdn is not None: - _query_parameters['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') if format is not None: - _query_parameters['format'] = _SERIALIZER.query("format", format, 'str') + _params['format'] = _SERIALIZER.query("format", format, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -298,9 +305,12 @@ def build_list_cluster_monitoring_user_credentials_request( server_fqdn: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -312,20 +322,18 @@ def build_list_cluster_monitoring_user_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if server_fqdn is not None: - _query_parameters['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -336,9 +344,12 @@ def build_get_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -350,18 +361,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -371,14 +380,17 @@ def build_create_or_update_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedCluster] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -390,20 +402,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -415,14 +425,17 @@ def build_update_tags_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.TagsObject] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -434,20 +447,18 @@ def build_update_tags_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -460,9 +471,12 @@ def build_delete_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -474,18 +488,16 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -495,14 +507,17 @@ def build_reset_service_principal_profile_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedClusterServicePrincipalProfile] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile") # pylint: disable=line-too-long path_format_arguments = { @@ -514,20 +529,18 @@ def build_reset_service_principal_profile_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -539,14 +552,17 @@ def build_reset_aad_profile_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedClusterAADProfile] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile") # pylint: disable=line-too-long path_format_arguments = { @@ -558,20 +574,18 @@ def build_reset_aad_profile_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -584,9 +598,12 @@ def build_rotate_cluster_certificates_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates") # pylint: disable=line-too-long path_format_arguments = { @@ -598,18 +615,16 @@ def build_rotate_cluster_certificates_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -620,9 +635,12 @@ def build_stop_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop") # pylint: disable=line-too-long path_format_arguments = { @@ -634,18 +652,16 @@ def build_stop_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -656,9 +672,12 @@ def build_start_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start") # pylint: disable=line-too-long path_format_arguments = { @@ -670,18 +689,16 @@ def build_start_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -691,14 +708,17 @@ def build_run_command_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.RunCommandRequest] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand") # pylint: disable=line-too-long path_format_arguments = { @@ -710,20 +730,18 @@ def build_run_command_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -737,9 +755,12 @@ def build_get_command_result_request( command_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}") # pylint: disable=line-too-long path_format_arguments = { @@ -752,18 +773,16 @@ def build_get_command_result_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -774,9 +793,12 @@ def build_list_outbound_network_dependencies_endpoints_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints") # pylint: disable=line-too-long path_format_arguments = { @@ -788,42 +810,38 @@ def build_list_outbound_network_dependencies_endpoints_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class ManagedClustersOperations(object): # pylint: disable=too-many-public-methods - """ManagedClustersOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ManagedClustersOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_01_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_01_01.ContainerServiceClient`'s + :attr:`managed_clusters` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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_os_options( @@ -831,7 +849,7 @@ def get_os_options( location: str, resource_type: Optional[str] = None, **kwargs: Any - ) -> "_models.OSOptionProfile": + ) -> _models.OSOptionProfile: """Gets supported OS options in the specified subscription. Gets supported OS options in the specified subscription. @@ -846,13 +864,16 @@ def get_os_options( :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.OSOptionProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OSOptionProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OSOptionProfile] request = build_get_os_options_request( @@ -861,11 +882,13 @@ def get_os_options( api_version=api_version, resource_type=resource_type, template_url=self.get_os_options.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -890,7 +913,7 @@ def get_os_options( def list( self, **kwargs: Any - ) -> Iterable["_models.ManagedClusterListResult"]: + ) -> Iterable[_models.ManagedClusterListResult]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. @@ -902,13 +925,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_01_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -916,9 +942,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -926,9 +954,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -966,7 +996,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.ManagedClusterListResult"]: + ) -> Iterable[_models.ManagedClusterListResult]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. @@ -980,13 +1010,16 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_01_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -995,9 +1028,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -1006,9 +1041,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -1047,7 +1084,7 @@ def get_upgrade_profile( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedClusterUpgradeProfile": + ) -> _models.ManagedClusterUpgradeProfile: """Gets the upgrade profile of a managed cluster. Gets the upgrade profile of a managed cluster. @@ -1061,13 +1098,16 @@ def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.ManagedClusterUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] request = build_get_upgrade_profile_request( @@ -1076,11 +1116,13 @@ def get_upgrade_profile( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1108,7 +1150,7 @@ def get_access_profile( resource_name: str, role_name: str, **kwargs: Any - ) -> "_models.ManagedClusterAccessProfile": + ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. **WARNING**\ : This API will be deprecated. Instead use `ListClusterUserCredentials @@ -1127,13 +1169,16 @@ def get_access_profile( :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.ManagedClusterAccessProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterAccessProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] request = build_get_access_profile_request( @@ -1143,11 +1188,13 @@ def get_access_profile( role_name=role_name, api_version=api_version, template_url=self.get_access_profile.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1175,7 +1222,7 @@ def list_cluster_admin_credentials( resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Lists the admin credentials of a managed cluster. Lists the admin credentials of a managed cluster. @@ -1191,13 +1238,16 @@ def list_cluster_admin_credentials( :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_admin_credentials_request( @@ -1207,11 +1257,13 @@ def list_cluster_admin_credentials( api_version=api_version, server_fqdn=server_fqdn, template_url=self.list_cluster_admin_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1240,7 +1292,7 @@ def list_cluster_user_credentials( server_fqdn: Optional[str] = None, format: Optional[Union[str, "_models.Format"]] = None, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Lists the user credentials of a managed cluster. Lists the user credentials of a managed cluster. @@ -1260,13 +1312,16 @@ def list_cluster_user_credentials( :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_user_credentials_request( @@ -1277,11 +1332,13 @@ def list_cluster_user_credentials( server_fqdn=server_fqdn, format=format, template_url=self.list_cluster_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1309,7 +1366,7 @@ def list_cluster_monitoring_user_credentials( resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Lists the cluster monitoring user credentials of a managed cluster. Lists the cluster monitoring user credentials of a managed cluster. @@ -1325,13 +1382,16 @@ def list_cluster_monitoring_user_credentials( :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_monitoring_user_credentials_request( @@ -1341,11 +1401,13 @@ def list_cluster_monitoring_user_credentials( api_version=api_version, server_fqdn=server_fqdn, template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1372,7 +1434,7 @@ def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedCluster": + ) -> _models.ManagedCluster: """Gets a managed cluster. Gets a managed cluster. @@ -1386,13 +1448,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.ManagedCluster :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] request = build_get_request( @@ -1401,11 +1466,13 @@ def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1430,17 +1497,20 @@ def _create_or_update_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-01-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'ManagedCluster') @@ -1452,11 +1522,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1486,9 +1558,9 @@ def begin_create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> LROPoller["_models.ManagedCluster"]: + ) -> LROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. Creates or updates a managed cluster. @@ -1513,37 +1585,47 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_01_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1560,17 +1642,20 @@ def _update_tags_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-01-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'TagsObject') @@ -1582,11 +1667,13 @@ def _update_tags_initial( content_type=content_type, json=_json, template_url=self._update_tags_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1612,9 +1699,9 @@ def begin_update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> LROPoller["_models.ManagedCluster"]: + ) -> LROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates tags on a managed cluster. @@ -1639,37 +1726,47 @@ def begin_update_tags( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_01_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._update_tags_initial( + raw_result = self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1688,13 +1785,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -1703,11 +1803,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1751,20 +1853,25 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_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) @@ -1774,8 +1881,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1792,17 +1905,20 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-01-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') @@ -1814,11 +1930,13 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re content_type=content_type, json=_json, template_url=self._reset_service_principal_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1840,7 +1958,7 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> LROPoller[None]: """Reset the Service Principal Profile of a managed cluster. @@ -1866,23 +1984,28 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._reset_service_principal_profile_initial( + raw_result = self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1892,8 +2015,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1910,17 +2039,20 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') @@ -1932,11 +2064,13 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement content_type=content_type, json=_json, template_url=self._reset_aad_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1958,7 +2092,7 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> LROPoller[None]: """Reset the AAD Profile of a managed cluster. @@ -1983,23 +2117,28 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._reset_aad_profile_initial( + raw_result = self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -2009,8 +2148,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2029,13 +2174,16 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_rotate_cluster_certificates_request_initial( @@ -2044,11 +2192,13 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return resource_name=resource_name, api_version=api_version, template_url=self._rotate_cluster_certificates_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2093,20 +2243,25 @@ def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-st :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._rotate_cluster_certificates_initial( + raw_result = self._rotate_cluster_certificates_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) @@ -2116,8 +2271,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2136,13 +2297,16 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_stop_request_initial( @@ -2151,11 +2315,13 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_name, api_version=api_version, template_url=self._stop_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2203,20 +2369,25 @@ def begin_stop( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._stop_initial( + raw_result = self._stop_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) @@ -2226,8 +2397,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2246,13 +2423,16 @@ def _start_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_start_request_initial( @@ -2261,11 +2441,13 @@ def _start_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_name, api_version=api_version, template_url=self._start_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2310,20 +2492,25 @@ def begin_start( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._start_initial( + raw_result = self._start_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) @@ -2333,8 +2520,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2351,17 +2544,20 @@ def _run_command_initial( self, resource_group_name: str, resource_name: str, - request_payload: "_models.RunCommandRequest", + request_payload: _models.RunCommandRequest, **kwargs: Any - ) -> Optional["_models.RunCommandResult"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RunCommandResult"]] + ) -> Optional[_models.RunCommandResult]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-01-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] _json = self._serialize.body(request_payload, 'RunCommandRequest') @@ -2373,11 +2569,13 @@ def _run_command_initial( content_type=content_type, json=_json, template_url=self._run_command_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2405,9 +2603,9 @@ def begin_run_command( self, resource_group_name: str, resource_name: str, - request_payload: "_models.RunCommandRequest", + request_payload: _models.RunCommandRequest, **kwargs: Any - ) -> LROPoller["_models.RunCommandResult"]: + ) -> LROPoller[_models.RunCommandResult]: """Submits a command to run against the Managed Cluster. AKS will create a pod to run the command. This is primarily useful for private clusters. For @@ -2434,37 +2632,47 @@ def begin_run_command( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_01_01.models.RunCommandResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.RunCommandResult] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._run_command_initial( + raw_result = self._run_command_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, request_payload=request_payload, 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): - response = pipeline_response.http_response deserialized = self._deserialize('RunCommandResult', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2484,7 +2692,7 @@ def get_command_result( resource_name: str, command_id: str, **kwargs: Any - ) -> Optional["_models.RunCommandResult"]: + ) -> Optional[_models.RunCommandResult]: """Gets the results of a command which has been run on the Managed Cluster. Gets the results of a command which has been run on the Managed Cluster. @@ -2500,13 +2708,16 @@ def get_command_result( :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.RunCommandResult or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RunCommandResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] request = build_get_command_result_request( @@ -2516,11 +2727,13 @@ def get_command_result( command_id=command_id, api_version=api_version, template_url=self.get_command_result.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2549,7 +2762,7 @@ def list_outbound_network_dependencies_endpoints( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Iterable["_models.OutboundEnvironmentEndpointCollection"]: + ) -> Iterable[_models.OutboundEnvironmentEndpointCollection]: """Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. @@ -2567,13 +2780,16 @@ def list_outbound_network_dependencies_endpoints( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_01_01.models.OutboundEnvironmentEndpointCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OutboundEnvironmentEndpointCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -2583,9 +2799,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=self.list_outbound_network_dependencies_endpoints.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -2595,9 +2813,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/operations/_operations.py index 324c275ca8e1..64e35650857f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/operations/_operations.py @@ -16,6 +16,7 @@ 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 @@ -29,55 +30,54 @@ def build_list_request( **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.ContainerService/operations") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class Operations(object): - """Operations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_01_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_01_01.ContainerServiceClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> Iterable["_models.OperationListResult"]: + ) -> Iterable[_models.OperationListResult]: """Gets a list of operations. Gets a list of operations. @@ -88,31 +88,38 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_01_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/operations/_private_endpoint_connections_operations.py index 6e432c5eabcd..1669d1ed026c 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/operations/_private_endpoint_connections_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast from msrest import Serializer @@ -16,13 +16,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -34,9 +34,12 @@ def build_list_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections") # pylint: disable=line-too-long path_format_arguments = { @@ -48,18 +51,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -71,9 +72,12 @@ def build_get_request( private_endpoint_connection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -86,18 +90,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -108,14 +110,17 @@ def build_update_request( resource_name: str, private_endpoint_connection_name: str, *, - json: JSONType = None, + json: Optional[_models.PrivateEndpointConnection] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -128,20 +133,18 @@ def build_update_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -155,9 +158,12 @@ def build_delete_request_initial( private_endpoint_connection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -170,42 +176,38 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class PrivateEndpointConnectionsOperations(object): - """PrivateEndpointConnectionsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class PrivateEndpointConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_01_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_01_01.ContainerServiceClient`'s + :attr:`private_endpoint_connections` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -213,7 +215,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnectionListResult": + ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. To learn more about private clusters, see: @@ -228,13 +230,16 @@ def list( :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.PrivateEndpointConnectionListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] request = build_list_request( @@ -243,11 +248,13 @@ def list( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -275,7 +282,7 @@ def get( resource_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Gets the specified private endpoint connection. To learn more about private clusters, see: @@ -292,13 +299,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] request = build_get_request( @@ -308,11 +318,13 @@ def get( private_endpoint_connection_name=private_endpoint_connection_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -339,9 +351,9 @@ def update( resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - parameters: "_models.PrivateEndpointConnection", + parameters: _models.PrivateEndpointConnection, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. Updates a private endpoint connection. @@ -359,14 +371,17 @@ def update( :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] _json = self._serialize.body(parameters, 'PrivateEndpointConnection') @@ -379,11 +394,13 @@ def update( content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -411,13 +428,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -427,11 +447,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name=private_endpoint_connection_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -478,21 +500,26 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -502,8 +529,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/operations/_private_link_resources_operations.py index 7f3d54511c21..dc572bd2162b 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/operations/_private_link_resources_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/operations/_private_link_resources_operations.py @@ -15,6 +15,7 @@ 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 @@ -31,9 +32,12 @@ def build_list_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources") # pylint: disable=line-too-long path_format_arguments = { @@ -45,42 +49,38 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class PrivateLinkResourcesOperations(object): - """PrivateLinkResourcesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class PrivateLinkResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_01_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_01_01.ContainerServiceClient`'s + :attr:`private_link_resources` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -88,7 +88,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.PrivateLinkResourcesListResult": + ) -> _models.PrivateLinkResourcesListResult: """Gets a list of private link resources in the specified managed cluster. To learn more about private clusters, see: @@ -103,13 +103,16 @@ def list( :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.PrivateLinkResourcesListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourcesListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] request = build_list_request( @@ -118,11 +121,13 @@ def list( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/operations/_resolve_private_link_service_id_operations.py index ea7ee9ce1e1d..b375e02789a0 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/operations/_resolve_private_link_service_id_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/operations/_resolve_private_link_service_id_operations.py @@ -15,12 +15,12 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -31,14 +31,17 @@ def build_post_request( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.PrivateLinkResource] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId") # pylint: disable=line-too-long path_format_arguments = { @@ -50,55 +53,51 @@ def build_post_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs ) -class ResolvePrivateLinkServiceIdOperations(object): - """ResolvePrivateLinkServiceIdOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ResolvePrivateLinkServiceIdOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_01_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_01_01.ContainerServiceClient`'s + :attr:`resolve_private_link_service_id` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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 post( self, resource_group_name: str, resource_name: str, - parameters: "_models.PrivateLinkResource", + parameters: _models.PrivateLinkResource, **kwargs: Any - ) -> "_models.PrivateLinkResource": + ) -> _models.PrivateLinkResource: """Gets the private link service ID for the specified managed cluster. Gets the private link service ID for the specified managed cluster. @@ -114,14 +113,17 @@ def post( :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.PrivateLinkResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-01-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] _json = self._serialize.body(parameters, 'PrivateLinkResource') @@ -133,11 +135,13 @@ def post( content_type=content_type, json=_json, template_url=self.post.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/operations/_snapshots_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/operations/_snapshots_operations.py index d7f5477eb294..529e165a69e8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/operations/_snapshots_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/operations/_snapshots_operations.py @@ -16,12 +16,12 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -31,9 +31,12 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots") path_format_arguments = { @@ -43,18 +46,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -64,9 +65,12 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots") # pylint: disable=line-too-long path_format_arguments = { @@ -77,18 +81,16 @@ def build_list_by_resource_group_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -99,9 +101,12 @@ def build_get_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -113,18 +118,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -134,14 +137,17 @@ def build_create_or_update_request( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.Snapshot] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -153,20 +159,18 @@ def build_create_or_update_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -178,14 +182,17 @@ def build_update_tags_request( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.TagsObject] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -197,20 +204,18 @@ def build_update_tags_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -223,9 +228,12 @@ def build_delete_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -237,48 +245,44 @@ def build_delete_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class SnapshotsOperations(object): - """SnapshotsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class SnapshotsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_01_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_01_01.ContainerServiceClient`'s + :attr:`snapshots` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> Iterable["_models.SnapshotListResult"]: + ) -> Iterable[_models.SnapshotListResult]: """Gets a list of snapshots in the specified subscription. Gets a list of snapshots in the specified subscription. @@ -289,13 +293,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_01_01.models.SnapshotListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -303,9 +310,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -313,9 +322,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -353,7 +364,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.SnapshotListResult"]: + ) -> Iterable[_models.SnapshotListResult]: """Lists snapshots in the specified subscription and resource group. Lists snapshots in the specified subscription and resource group. @@ -366,13 +377,16 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_01_01.models.SnapshotListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -381,9 +395,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -392,9 +408,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -433,7 +451,7 @@ def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.Snapshot": + ) -> _models.Snapshot: """Gets a snapshot. Gets a snapshot. @@ -447,13 +465,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.Snapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] request = build_get_request( @@ -462,11 +483,13 @@ def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -492,9 +515,9 @@ def create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.Snapshot", + parameters: _models.Snapshot, **kwargs: Any - ) -> "_models.Snapshot": + ) -> _models.Snapshot: """Creates or updates a snapshot. Creates or updates a snapshot. @@ -510,14 +533,17 @@ def create_or_update( :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.Snapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-01-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] _json = self._serialize.body(parameters, 'Snapshot') @@ -529,11 +555,13 @@ def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -563,9 +591,9 @@ def update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.Snapshot": + ) -> _models.Snapshot: """Updates tags on a snapshot. Updates tags on a snapshot. @@ -581,14 +609,17 @@ def update_tags( :rtype: ~azure.mgmt.containerservice.v2022_01_01.models.Snapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] _json = self._serialize.body(parameters, 'TagsObject') @@ -600,11 +631,13 @@ def update_tags( content_type=content_type, json=_json, template_url=self.update_tags.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -645,13 +678,16 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -660,11 +696,13 @@ def delete( # pylint: disable=inconsistent-return-statements resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/__init__.py index 53c675bd95e2..37a5f9e02e6f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._container_service_client import ContainerServiceClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['ContainerServiceClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/_container_service_client.py index cc93039800ce..1cde299ed11a 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/_container_service_client.py @@ -76,14 +76,30 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.managed_clusters = ManagedClustersOperations(self._client, self._config, self._serialize, self._deserialize) - self.maintenance_configurations = MaintenanceConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) - self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) - self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations(self._client, self._config, self._serialize, self._deserialize) - self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_clusters = ManagedClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.maintenance_configurations = MaintenanceConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.agent_pools = AgentPoolsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.snapshots = SnapshotsOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/__init__.py index 53c675bd95e2..37a5f9e02e6f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._container_service_client import ContainerServiceClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['ContainerServiceClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/_container_service_client.py index 5b40a3117239..81c680039c93 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/_container_service_client.py @@ -76,14 +76,30 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.managed_clusters = ManagedClustersOperations(self._client, self._config, self._serialize, self._deserialize) - self.maintenance_configurations = MaintenanceConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) - self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) - self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations(self._client, self._config, self._serialize, self._deserialize) - self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_clusters = ManagedClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.maintenance_configurations = MaintenanceConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.agent_pools = AgentPoolsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.snapshots = SnapshotsOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/operations/__init__.py index 5e1e5e72fa59..e0748876288c 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/operations/__init__.py @@ -15,6 +15,9 @@ from ._resolve_private_link_service_id_operations import ResolvePrivateLinkServiceIdOperations from ._snapshots_operations import SnapshotsOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'Operations', 'ManagedClustersOperations', @@ -25,3 +28,5 @@ 'ResolvePrivateLinkServiceIdOperations', 'SnapshotsOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/operations/_agent_pools_operations.py index c6a80d3ef5f2..41ea462ae237 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/operations/_agent_pools_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. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ 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 @@ -26,26 +27,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class AgentPoolsOperations: - """AgentPoolsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_01_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_01_02_preview.aio.ContainerServiceClient`'s + :attr:`agent_pools` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -53,7 +52,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> AsyncIterable["_models.AgentPoolListResult"]: + ) -> AsyncIterable[_models.AgentPoolListResult]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. @@ -68,13 +67,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_01_02_preview.models.AgentPoolListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -84,9 +86,11 @@ def prepare_request(next_link=None): resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -96,9 +100,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -138,7 +144,7 @@ async def get( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPool": + ) -> _models.AgentPool: """Gets the specified managed cluster agent pool. Gets the specified managed cluster agent pool. @@ -154,13 +160,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.AgentPool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] request = build_get_request( @@ -170,11 +179,13 @@ async def get( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -200,17 +211,20 @@ async def _create_or_update_initial( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> "_models.AgentPool": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] + ) -> _models.AgentPool: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-01-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] _json = self._serialize.body(parameters, 'AgentPool') @@ -223,11 +237,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -258,9 +274,9 @@ async def begin_create_or_update( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> AsyncLROPoller["_models.AgentPool"]: + ) -> AsyncLROPoller[_models.AgentPool]: """Creates or updates an agent pool in the specified managed cluster. Creates or updates an agent pool in the specified managed cluster. @@ -287,17 +303,20 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_01_02_preview.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, @@ -305,20 +324,27 @@ async def begin_create_or_update( 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): - response = pipeline_response.http_response deserialized = self._deserialize('AgentPool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -338,13 +364,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements agent_pool_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -354,11 +383,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -405,21 +436,26 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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) @@ -429,8 +465,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -450,7 +492,7 @@ async def get_upgrade_profile( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPoolUpgradeProfile": + ) -> _models.AgentPoolUpgradeProfile: """Gets the upgrade profile for an agent pool. Gets the upgrade profile for an agent pool. @@ -466,13 +508,16 @@ async def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.AgentPoolUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] request = build_get_upgrade_profile_request( @@ -482,11 +527,13 @@ async def get_upgrade_profile( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -513,7 +560,7 @@ async def get_available_agent_pool_versions( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.AgentPoolAvailableVersions": + ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported Kubernetes versions for the specified agent pool. See `supported Kubernetes versions @@ -529,13 +576,16 @@ async def get_available_agent_pool_versions( :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.AgentPoolAvailableVersions :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolAvailableVersions"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] request = build_get_available_agent_pool_versions_request( @@ -544,11 +594,13 @@ async def get_available_agent_pool_versions( resource_name=resource_name, api_version=api_version, template_url=self.get_available_agent_pool_versions.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -575,14 +627,17 @@ async def _upgrade_node_image_version_initial( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> Optional["_models.AgentPool"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.AgentPool"]] + ) -> Optional[_models.AgentPool]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] request = build_upgrade_node_image_version_request_initial( @@ -592,11 +647,13 @@ async def _upgrade_node_image_version_initial( agent_pool_name=agent_pool_name, api_version=api_version, template_url=self._upgrade_node_image_version_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -629,7 +686,7 @@ async def begin_upgrade_node_image_version( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> AsyncLROPoller["_models.AgentPool"]: + ) -> AsyncLROPoller[_models.AgentPool]: """Upgrades the node image version of an agent pool to the latest. Upgrading the node image version of an agent pool applies the newest OS and runtime updates to @@ -656,21 +713,26 @@ async def begin_upgrade_node_image_version( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_01_02_preview.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._upgrade_node_image_version_initial( + raw_result = await self._upgrade_node_image_version_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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) @@ -686,8 +748,14 @@ def get_long_running_output(pipeline_response): return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/operations/_maintenance_configurations_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/operations/_maintenance_configurations_operations.py index 883c3534d225..a85db6432a03 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/operations/_maintenance_configurations_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/operations/_maintenance_configurations_operations.py @@ -15,6 +15,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -24,26 +25,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class MaintenanceConfigurationsOperations: - """MaintenanceConfigurationsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_01_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_01_02_preview.aio.ContainerServiceClient`'s + :attr:`maintenance_configurations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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_by_managed_cluster( @@ -51,7 +50,7 @@ def list_by_managed_cluster( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> AsyncIterable["_models.MaintenanceConfigurationListResult"]: + ) -> AsyncIterable[_models.MaintenanceConfigurationListResult]: """Gets a list of maintenance configurations in the specified managed cluster. Gets a list of maintenance configurations in the specified managed cluster. @@ -67,13 +66,16 @@ def list_by_managed_cluster( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_01_02_preview.models.MaintenanceConfigurationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfigurationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfigurationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -83,9 +85,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=self.list_by_managed_cluster.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -95,9 +99,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -137,7 +143,7 @@ async def get( resource_name: str, config_name: str, **kwargs: Any - ) -> "_models.MaintenanceConfiguration": + ) -> _models.MaintenanceConfiguration: """Gets the specified maintenance configuration of a managed cluster. Gets the specified maintenance configuration of a managed cluster. @@ -153,13 +159,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.MaintenanceConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfiguration"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] request = build_get_request( @@ -169,11 +178,13 @@ async def get( config_name=config_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -200,9 +211,9 @@ async def create_or_update( resource_group_name: str, resource_name: str, config_name: str, - parameters: "_models.MaintenanceConfiguration", + parameters: _models.MaintenanceConfiguration, **kwargs: Any - ) -> "_models.MaintenanceConfiguration": + ) -> _models.MaintenanceConfiguration: """Creates or updates a maintenance configuration in the specified managed cluster. Creates or updates a maintenance configuration in the specified managed cluster. @@ -221,14 +232,17 @@ async def create_or_update( :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.MaintenanceConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfiguration"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] _json = self._serialize.body(parameters, 'MaintenanceConfiguration') @@ -241,11 +255,13 @@ async def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -289,13 +305,16 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -305,11 +324,13 @@ async def delete( # pylint: disable=inconsistent-return-statements config_name=config_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/operations/_managed_clusters_operations.py index 8acfa048e2eb..0944a8adc4a6 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/operations/_managed_clusters_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. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ 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 @@ -26,26 +27,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ManagedClustersOperations: # pylint: disable=too-many-public-methods - """ManagedClustersOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_01_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_01_02_preview.aio.ContainerServiceClient`'s + :attr:`managed_clusters` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace_async async def get_os_options( @@ -53,7 +52,7 @@ async def get_os_options( location: str, resource_type: Optional[str] = None, **kwargs: Any - ) -> "_models.OSOptionProfile": + ) -> _models.OSOptionProfile: """Gets supported OS options in the specified subscription. Gets supported OS options in the specified subscription. @@ -68,13 +67,16 @@ async def get_os_options( :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.OSOptionProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OSOptionProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OSOptionProfile] request = build_get_os_options_request( @@ -83,11 +85,13 @@ async def get_os_options( api_version=api_version, resource_type=resource_type, template_url=self.get_os_options.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -112,7 +116,7 @@ async def get_os_options( def list( self, **kwargs: Any - ) -> AsyncIterable["_models.ManagedClusterListResult"]: + ) -> AsyncIterable[_models.ManagedClusterListResult]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. @@ -124,13 +128,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_01_02_preview.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -138,9 +145,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -148,9 +157,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -188,7 +199,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ManagedClusterListResult"]: + ) -> AsyncIterable[_models.ManagedClusterListResult]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. @@ -202,13 +213,16 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_01_02_preview.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -217,9 +231,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -228,9 +244,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -269,7 +287,7 @@ async def get_upgrade_profile( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedClusterUpgradeProfile": + ) -> _models.ManagedClusterUpgradeProfile: """Gets the upgrade profile of a managed cluster. Gets the upgrade profile of a managed cluster. @@ -283,13 +301,16 @@ async def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.ManagedClusterUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] request = build_get_upgrade_profile_request( @@ -298,11 +319,13 @@ async def get_upgrade_profile( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -330,7 +353,7 @@ async def get_access_profile( resource_name: str, role_name: str, **kwargs: Any - ) -> "_models.ManagedClusterAccessProfile": + ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. **WARNING**\ : This API will be deprecated. Instead use `ListClusterUserCredentials @@ -349,13 +372,16 @@ async def get_access_profile( :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.ManagedClusterAccessProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterAccessProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] request = build_get_access_profile_request( @@ -365,11 +391,13 @@ async def get_access_profile( role_name=role_name, api_version=api_version, template_url=self.get_access_profile.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -398,7 +426,7 @@ async def list_cluster_admin_credentials( server_fqdn: Optional[str] = None, format: Optional[Union[str, "_models.Format"]] = None, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Lists the admin credentials of a managed cluster. Lists the admin credentials of a managed cluster. @@ -418,13 +446,16 @@ async def list_cluster_admin_credentials( :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_admin_credentials_request( @@ -435,11 +466,13 @@ async def list_cluster_admin_credentials( server_fqdn=server_fqdn, format=format, template_url=self.list_cluster_admin_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -467,7 +500,7 @@ async def list_cluster_user_credentials( resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Lists the user credentials of a managed cluster. Lists the user credentials of a managed cluster. @@ -483,13 +516,16 @@ async def list_cluster_user_credentials( :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_user_credentials_request( @@ -499,11 +535,13 @@ async def list_cluster_user_credentials( api_version=api_version, server_fqdn=server_fqdn, template_url=self.list_cluster_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -531,7 +569,7 @@ async def list_cluster_monitoring_user_credentials( resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Lists the cluster monitoring user credentials of a managed cluster. Lists the cluster monitoring user credentials of a managed cluster. @@ -547,13 +585,16 @@ async def list_cluster_monitoring_user_credentials( :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_monitoring_user_credentials_request( @@ -563,11 +604,13 @@ async def list_cluster_monitoring_user_credentials( api_version=api_version, server_fqdn=server_fqdn, template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -594,7 +637,7 @@ async def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedCluster": + ) -> _models.ManagedCluster: """Gets a managed cluster. Gets a managed cluster. @@ -608,13 +651,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.ManagedCluster :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] request = build_get_request( @@ -623,11 +669,13 @@ async def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -652,17 +700,20 @@ async def _create_or_update_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-01-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'ManagedCluster') @@ -674,11 +725,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -708,9 +761,9 @@ async def begin_create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> AsyncLROPoller["_models.ManagedCluster"]: + ) -> AsyncLROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. Creates or updates a managed cluster. @@ -735,37 +788,47 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_01_02_preview.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -782,17 +845,20 @@ async def _update_tags_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-01-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'TagsObject') @@ -804,11 +870,13 @@ async def _update_tags_initial( content_type=content_type, json=_json, template_url=self._update_tags_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -834,9 +902,9 @@ async def begin_update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> AsyncLROPoller["_models.ManagedCluster"]: + ) -> AsyncLROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates tags on a managed cluster. @@ -861,37 +929,47 @@ async def begin_update_tags( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_01_02_preview.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._update_tags_initial( + raw_result = await self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -910,13 +988,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -925,11 +1006,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -973,20 +1056,25 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_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) @@ -996,8 +1084,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1014,17 +1108,20 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-01-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') @@ -1036,11 +1133,13 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist content_type=content_type, json=_json, template_url=self._reset_service_principal_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1062,7 +1161,7 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> AsyncLROPoller[None]: """Reset the Service Principal Profile of a managed cluster. @@ -1088,23 +1187,28 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._reset_service_principal_profile_initial( + raw_result = await self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1114,8 +1218,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1132,17 +1242,20 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') @@ -1154,11 +1267,13 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta content_type=content_type, json=_json, template_url=self._reset_aad_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1180,7 +1295,7 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> AsyncLROPoller[None]: """Reset the AAD Profile of a managed cluster. @@ -1206,23 +1321,28 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._reset_aad_profile_initial( + raw_result = await self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1232,8 +1352,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1252,13 +1378,16 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_rotate_cluster_certificates_request_initial( @@ -1267,11 +1396,13 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- resource_name=resource_name, api_version=api_version, template_url=self._rotate_cluster_certificates_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1316,20 +1447,25 @@ async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-ret :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._rotate_cluster_certificates_initial( + raw_result = await self._rotate_cluster_certificates_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) @@ -1339,8 +1475,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1359,13 +1501,16 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_stop_request_initial( @@ -1374,11 +1519,13 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_name, api_version=api_version, template_url=self._stop_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1426,20 +1573,25 @@ async def begin_stop( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._stop_initial( + raw_result = await self._stop_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) @@ -1449,8 +1601,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1469,13 +1627,16 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_start_request_initial( @@ -1484,11 +1645,13 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_name, api_version=api_version, template_url=self._start_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1533,20 +1696,25 @@ async def begin_start( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._start_initial( + raw_result = await self._start_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) @@ -1556,8 +1724,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1574,17 +1748,20 @@ async def _run_command_initial( self, resource_group_name: str, resource_name: str, - request_payload: "_models.RunCommandRequest", + request_payload: _models.RunCommandRequest, **kwargs: Any - ) -> Optional["_models.RunCommandResult"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RunCommandResult"]] + ) -> Optional[_models.RunCommandResult]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-01-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] _json = self._serialize.body(request_payload, 'RunCommandRequest') @@ -1596,11 +1773,13 @@ async def _run_command_initial( content_type=content_type, json=_json, template_url=self._run_command_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1628,9 +1807,9 @@ async def begin_run_command( self, resource_group_name: str, resource_name: str, - request_payload: "_models.RunCommandRequest", + request_payload: _models.RunCommandRequest, **kwargs: Any - ) -> AsyncLROPoller["_models.RunCommandResult"]: + ) -> AsyncLROPoller[_models.RunCommandResult]: """Submits a command to run against the Managed Cluster. AKS will create a pod to run the command. This is primarily useful for private clusters. For @@ -1658,37 +1837,47 @@ async def begin_run_command( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_01_02_preview.models.RunCommandResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.RunCommandResult] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._run_command_initial( + raw_result = await self._run_command_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, request_payload=request_payload, 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): - response = pipeline_response.http_response deserialized = self._deserialize('RunCommandResult', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1708,7 +1897,7 @@ async def get_command_result( resource_name: str, command_id: str, **kwargs: Any - ) -> Optional["_models.RunCommandResult"]: + ) -> Optional[_models.RunCommandResult]: """Gets the results of a command which has been run on the Managed Cluster. Gets the results of a command which has been run on the Managed Cluster. @@ -1724,13 +1913,16 @@ async def get_command_result( :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.RunCommandResult or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RunCommandResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] request = build_get_command_result_request( @@ -1740,11 +1932,13 @@ async def get_command_result( command_id=command_id, api_version=api_version, template_url=self.get_command_result.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1773,7 +1967,7 @@ def list_outbound_network_dependencies_endpoints( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> AsyncIterable["_models.OutboundEnvironmentEndpointCollection"]: + ) -> AsyncIterable[_models.OutboundEnvironmentEndpointCollection]: """Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. @@ -1791,13 +1985,16 @@ def list_outbound_network_dependencies_endpoints( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_01_02_preview.models.OutboundEnvironmentEndpointCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OutboundEnvironmentEndpointCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -1807,9 +2004,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=self.list_outbound_network_dependencies_endpoints.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -1819,9 +2018,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/operations/_operations.py index a9acf5ace7bd..729a7a0ed7f6 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/operations/_operations.py @@ -14,6 +14,7 @@ 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 @@ -23,32 +24,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class Operations: - """Operations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_01_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_01_02_preview.aio.ContainerServiceClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.OperationListResult"]: + ) -> AsyncIterable[_models.OperationListResult]: """Gets a list of operations. Gets a list of operations. @@ -59,31 +58,38 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_01_02_preview.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/operations/_private_endpoint_connections_operations.py index 1c038e703b81..37a04e1dbf32 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/operations/_private_endpoint_connections_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -14,6 +14,7 @@ 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 @@ -24,26 +25,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class PrivateEndpointConnectionsOperations: - """PrivateEndpointConnectionsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_01_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_01_02_preview.aio.ContainerServiceClient`'s + :attr:`private_endpoint_connections` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -51,7 +50,7 @@ async def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnectionListResult": + ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. To learn more about private clusters, see: @@ -67,13 +66,16 @@ async def list( ~azure.mgmt.containerservice.v2022_01_02_preview.models.PrivateEndpointConnectionListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] request = build_list_request( @@ -82,11 +84,13 @@ async def list( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -114,7 +118,7 @@ async def get( resource_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Gets the specified private endpoint connection. To learn more about private clusters, see: @@ -131,13 +135,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] request = build_get_request( @@ -147,11 +154,13 @@ async def get( private_endpoint_connection_name=private_endpoint_connection_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -178,9 +187,9 @@ async def update( resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - parameters: "_models.PrivateEndpointConnection", + parameters: _models.PrivateEndpointConnection, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. Updates a private endpoint connection. @@ -199,14 +208,17 @@ async def update( :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-01-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] _json = self._serialize.body(parameters, 'PrivateEndpointConnection') @@ -219,11 +231,13 @@ async def update( content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -251,13 +265,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -267,11 +284,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name=private_endpoint_connection_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -318,21 +337,26 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -342,8 +366,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/operations/_private_link_resources_operations.py index 3cf80c717fda..4b141de3481d 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/operations/_private_link_resources_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/operations/_private_link_resources_operations.py @@ -13,6 +13,7 @@ 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 @@ -22,26 +23,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class PrivateLinkResourcesOperations: - """PrivateLinkResourcesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_01_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_01_02_preview.aio.ContainerServiceClient`'s + :attr:`private_link_resources` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -49,7 +48,7 @@ async def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.PrivateLinkResourcesListResult": + ) -> _models.PrivateLinkResourcesListResult: """Gets a list of private link resources in the specified managed cluster. To learn more about private clusters, see: @@ -64,13 +63,16 @@ async def list( :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.PrivateLinkResourcesListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourcesListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] request = build_list_request( @@ -79,11 +81,13 @@ async def list( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/operations/_resolve_private_link_service_id_operations.py index 33f6bbcdfcc9..c1458c9b64ec 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/operations/_resolve_private_link_service_id_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/operations/_resolve_private_link_service_id_operations.py @@ -13,6 +13,7 @@ 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 @@ -22,35 +23,33 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ResolvePrivateLinkServiceIdOperations: - """ResolvePrivateLinkServiceIdOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_01_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_01_02_preview.aio.ContainerServiceClient`'s + :attr:`resolve_private_link_service_id` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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 post( self, resource_group_name: str, resource_name: str, - parameters: "_models.PrivateLinkResource", + parameters: _models.PrivateLinkResource, **kwargs: Any - ) -> "_models.PrivateLinkResource": + ) -> _models.PrivateLinkResource: """Gets the private link service ID for the specified managed cluster. Gets the private link service ID for the specified managed cluster. @@ -66,14 +65,17 @@ async def post( :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.PrivateLinkResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-01-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] _json = self._serialize.body(parameters, 'PrivateLinkResource') @@ -85,11 +87,13 @@ async def post( content_type=content_type, json=_json, template_url=self.post.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/operations/_snapshots_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/operations/_snapshots_operations.py index 9cea526bc8ff..7c30e7a9dffe 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/operations/_snapshots_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/aio/operations/_snapshots_operations.py @@ -15,6 +15,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -24,32 +25,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class SnapshotsOperations: - """SnapshotsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_01_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_01_02_preview.aio.ContainerServiceClient`'s + :attr:`snapshots` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.SnapshotListResult"]: + ) -> AsyncIterable[_models.SnapshotListResult]: """Gets a list of snapshots in the specified subscription. Gets a list of snapshots in the specified subscription. @@ -60,13 +59,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_01_02_preview.models.SnapshotListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -74,9 +76,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -84,9 +88,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -124,7 +130,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.SnapshotListResult"]: + ) -> AsyncIterable[_models.SnapshotListResult]: """Lists snapshots in the specified subscription and resource group. Lists snapshots in the specified subscription and resource group. @@ -137,13 +143,16 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_01_02_preview.models.SnapshotListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -152,9 +161,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -163,9 +174,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -204,7 +217,7 @@ async def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.Snapshot": + ) -> _models.Snapshot: """Gets a snapshot. Gets a snapshot. @@ -218,13 +231,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.Snapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] request = build_get_request( @@ -233,11 +249,13 @@ async def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -263,9 +281,9 @@ async def create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.Snapshot", + parameters: _models.Snapshot, **kwargs: Any - ) -> "_models.Snapshot": + ) -> _models.Snapshot: """Creates or updates a snapshot. Creates or updates a snapshot. @@ -281,14 +299,17 @@ async def create_or_update( :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.Snapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] _json = self._serialize.body(parameters, 'Snapshot') @@ -300,11 +321,13 @@ async def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -334,9 +357,9 @@ async def update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.Snapshot": + ) -> _models.Snapshot: """Updates tags on a snapshot. Updates tags on a snapshot. @@ -352,14 +375,17 @@ async def update_tags( :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.Snapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-01-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] _json = self._serialize.body(parameters, 'TagsObject') @@ -371,11 +397,13 @@ async def update_tags( content_type=content_type, json=_json, template_url=self.update_tags.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -416,13 +444,16 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -431,11 +462,13 @@ async def delete( # pylint: disable=inconsistent-return-statements resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/models/__init__.py index 293491d02098..7bb54e83b18e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/models/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/models/__init__.py @@ -133,7 +133,9 @@ WeekDay, WorkloadRuntime, ) - +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'AgentPool', 'AgentPoolAvailableVersions', @@ -259,3 +261,5 @@ 'WeekDay', 'WorkloadRuntime', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/models/_container_service_client_enums.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/models/_container_service_client_enums.py index 816efef5f65e..b4ac50d61317 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/models/_container_service_client_enums.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/models/_container_service_client_enums.py @@ -7,11 +7,10 @@ # -------------------------------------------------------------------------- from enum import Enum -from six import with_metaclass from azure.core import CaseInsensitiveEnumMeta -class AgentPoolMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class AgentPoolMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: https://docs.microsoft.com/azure/aks/use-system-pools @@ -24,7 +23,7 @@ class AgentPoolMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: User agent pools are primarily for hosting your application pods. USER = "User" -class AgentPoolType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class AgentPoolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of Agent Pool. """ @@ -33,7 +32,7 @@ class AgentPoolType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Use of this is strongly discouraged. AVAILABILITY_SET = "AvailabilitySet" -class Code(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class Code(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Tells whether the cluster is Running or Stopped """ @@ -42,7 +41,7 @@ class Code(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: The cluster is stopped. STOPPED = "Stopped" -class ConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The private link service connection status. """ @@ -51,7 +50,7 @@ class ConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): REJECTED = "Rejected" DISCONNECTED = "Disconnected" -class ContainerServiceStorageProfileTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Specifies what kind of storage to use. If omitted, the default will be chosen on your behalf based on the choice of orchestrator. """ @@ -59,7 +58,7 @@ class ContainerServiceStorageProfileTypes(with_metaclass(CaseInsensitiveEnumMeta STORAGE_ACCOUNT = "StorageAccount" MANAGED_DISKS = "ManagedDisks" -class ContainerServiceVMSizeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Size of agent VMs. Note: This is no longer maintained. """ @@ -238,7 +237,7 @@ class ContainerServiceVMSizeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, E STANDARD_NV24 = "Standard_NV24" STANDARD_NV6 = "Standard_NV6" -class Count(with_metaclass(CaseInsensitiveEnumMeta, int, Enum)): +class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): """Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, and 5. The default value is 1. """ @@ -247,7 +246,7 @@ class Count(with_metaclass(CaseInsensitiveEnumMeta, int, Enum)): THREE = 3 FIVE = 5 -class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of identity that created the resource. """ @@ -256,7 +255,7 @@ class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class Expander(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class Expander(str, Enum, metaclass=CaseInsensitiveEnumMeta): """If not specified, the default is 'random'. See `expanders `_ for more information. @@ -279,13 +278,13 @@ class Expander(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Used when you don't have a particular need for the node groups to scale differently. RANDOM = "random" -class ExtendedLocationTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ExtendedLocationTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of extendedLocation. """ EDGE_ZONE = "EdgeZone" -class Format(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class Format(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Return azure auth-provider kubeconfig. This format is deprecated in 1.22 and will be fully #: removed in 1.25. @@ -293,7 +292,7 @@ class Format(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Return exec format kubeconfig. This format requires kubelogin binary in the path. EXEC_ENUM = "exec" -class GPUInstanceProfile(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class GPUInstanceProfile(str, Enum, metaclass=CaseInsensitiveEnumMeta): """GPUInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU. """ @@ -303,14 +302,14 @@ class GPUInstanceProfile(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MIG4_G = "MIG4g" MIG7_G = "MIG7g" -class IpFamily(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class IpFamily(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The IP version to use for cluster networking and IP assignment. """ I_PV4 = "IPv4" I_PV6 = "IPv6" -class KubeletDiskType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class KubeletDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. """ @@ -320,7 +319,7 @@ class KubeletDiskType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Kubelet will use the temporary disk for its data. TEMPORARY = "Temporary" -class LicenseType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class LicenseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The license type to use for Windows VMs. See `Azure Hybrid User Benefits `_ for more details. """ @@ -330,7 +329,7 @@ class LicenseType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Enables Azure Hybrid User Benefits for Windows VMs. WINDOWS_SERVER = "Windows_Server" -class LoadBalancerSku(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class LoadBalancerSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the differences between load balancer SKUs. @@ -343,7 +342,7 @@ class LoadBalancerSku(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Use a basic Load Balancer with limited functionality. BASIC = "basic" -class ManagedClusterPodIdentityProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ManagedClusterPodIdentityProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The current provisioning state of the pod identity. """ @@ -352,13 +351,13 @@ class ManagedClusterPodIdentityProvisioningState(with_metaclass(CaseInsensitiveE DELETING = "Deleting" FAILED = "Failed" -class ManagedClusterSKUName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ManagedClusterSKUName(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The name of a managed cluster SKU. """ BASIC = "Basic" -class ManagedClusterSKUTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ManagedClusterSKUTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): """If not specified, the default is 'Free'. See `uptime SLA `_ for more details. """ @@ -369,7 +368,7 @@ class ManagedClusterSKUTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: No guaranteed SLA, no additional charges. Free tier clusters have an SLO of 99.5%. FREE = "Free" -class NetworkMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """This cannot be specified if networkPlugin is anything other than 'azure'. """ @@ -380,7 +379,7 @@ class NetworkMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: This is no longer supported. BRIDGE = "bridge" -class NetworkPlugin(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkPlugin(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Network plugin used for building the Kubernetes network. """ @@ -396,7 +395,7 @@ class NetworkPlugin(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: networking functionality. NONE = "none" -class NetworkPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Network policy used for building the Kubernetes network. """ @@ -409,7 +408,7 @@ class NetworkPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: for more information. AZURE = "azure" -class OSDiskType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OSDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS @@ -425,14 +424,14 @@ class OSDiskType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: provides lower read/write latency, along with faster node scaling and cluster upgrades. EPHEMERAL = "Ephemeral" -class OSSKU(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OSSKU(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Specifies an OS SKU. This value must not be specified if OSType is Windows. """ UBUNTU = "Ubuntu" CBL_MARINER = "CBLMariner" -class OSType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The operating system type. The default is Linux. """ @@ -441,7 +440,7 @@ class OSType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Use Windows. WINDOWS = "Windows" -class OutboundType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OutboundType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type `_. """ @@ -461,7 +460,7 @@ class OutboundType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: advanced scenario and requires proper network configuration. USER_ASSIGNED_NAT_GATEWAY = "userAssignedNATGateway" -class PrivateEndpointConnectionProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class PrivateEndpointConnectionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The current provisioning state. """ @@ -470,14 +469,14 @@ class PrivateEndpointConnectionProvisioningState(with_metaclass(CaseInsensitiveE DELETING = "Deleting" FAILED = "Failed" -class PublicNetworkAccess(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class PublicNetworkAccess(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Allow or deny public network access for AKS """ ENABLED = "Enabled" DISABLED = "Disabled" -class ResourceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """For more information see `use managed identities in AKS `_. """ @@ -493,7 +492,7 @@ class ResourceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Do not use a managed identity for the Managed Cluster, service principal will be used instead. NONE = "None" -class ScaleDownMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ScaleDownMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Describes how VMs are added to or removed from Agent Pools. See `billing states `_. """ @@ -504,7 +503,7 @@ class ScaleDownMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: during scale down. DEALLOCATE = "Deallocate" -class ScaleSetEvictionPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The eviction policy specifies what to do with the VM when it is evicted. The default is Delete. For more information about eviction see `spot VMs `_ @@ -517,7 +516,7 @@ class ScaleSetEvictionPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)) #: cause issues with cluster scaling or upgrading. DEALLOCATE = "Deallocate" -class ScaleSetPriority(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ScaleSetPriority(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The Virtual Machine Scale Set priority. """ @@ -527,14 +526,14 @@ class ScaleSetPriority(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Regular VMs will be used. REGULAR = "Regular" -class SnapshotType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SnapshotType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of a snapshot. The default is NodePool. """ #: The snapshot is a snapshot of a node pool. NODE_POOL = "NodePool" -class UpgradeChannel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class UpgradeChannel(str, Enum, metaclass=CaseInsensitiveEnumMeta): """For more information see `setting the AKS cluster auto-upgrade channel `_. """ @@ -564,7 +563,7 @@ class UpgradeChannel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Disables auto-upgrades and keeps the cluster at its current version of Kubernetes. NONE = "none" -class WeekDay(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class WeekDay(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The weekday enum. """ @@ -576,7 +575,7 @@ class WeekDay(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): FRIDAY = "Friday" SATURDAY = "Saturday" -class WorkloadRuntime(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class WorkloadRuntime(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Determines the type of workload a node can run. """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/models/_models_py3.py index f0764c1601a1..15f583a95804 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/models/_models_py3.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/models/_models_py3.py @@ -7,11 +7,13 @@ # -------------------------------------------------------------------------- import datetime -from typing import Dict, List, Optional, Union +from typing import Dict, List, Optional, TYPE_CHECKING, Union import msrest.serialization -from ._container_service_client_enums import * +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + import __init__ as _models class SubResource(msrest.serialization.Model): @@ -79,16 +81,16 @@ class AgentPool(SubResource): :ivar os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS - `_. Possible values - include: "Managed", "Ephemeral". + `_. Known values are: + "Managed", "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Possible values include: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.KubeletDiskType - :ivar workload_runtime: Determines the type of workload a node can run. Possible values - include: "OCIContainer", "WasmWasi". + :ivar workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer", "WasmWasi". :vartype workload_runtime: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.WorkloadRuntime :ivar message_of_the_day: A base64-encoded string which will be written to /etc/motd after @@ -107,11 +109,11 @@ class AgentPool(SubResource): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.OSType - :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Possible values include: "Ubuntu", "CBLMariner". + :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known + values are: "Ubuntu", "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. :vartype max_count: int @@ -120,17 +122,16 @@ class AgentPool(SubResource): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it - defaults to Delete. Possible values include: "Delete", "Deallocate". + defaults to Delete. Known values are: "Delete", "Deallocate". :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.ScaleDownMode - :ivar type_properties_type: The type of Agent Pool. Possible values include: + :ivar type_properties_type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :vartype type_properties_type: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Possible values include: "System", - "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". :vartype mode: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.AgentPoolMode :ivar orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -165,12 +166,12 @@ class AgentPool(SubResource): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Possible values include: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Possible values include: "Delete", - "Deallocate". Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which @@ -202,7 +203,7 @@ class AgentPool(SubResource): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.GPUInstanceProfile :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool @@ -281,41 +282,41 @@ def __init__( count: Optional[int] = None, vm_size: Optional[str] = None, os_disk_size_gb: Optional[int] = None, - os_disk_type: Optional[Union[str, "OSDiskType"]] = None, - kubelet_disk_type: Optional[Union[str, "KubeletDiskType"]] = None, - workload_runtime: Optional[Union[str, "WorkloadRuntime"]] = None, + os_disk_type: Optional[Union[str, "_models.OSDiskType"]] = None, + kubelet_disk_type: Optional[Union[str, "_models.KubeletDiskType"]] = None, + workload_runtime: Optional[Union[str, "_models.WorkloadRuntime"]] = None, message_of_the_day: Optional[str] = None, vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", - os_sku: Optional[Union[str, "OSSKU"]] = None, + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - scale_down_mode: Optional[Union[str, "ScaleDownMode"]] = None, - type_properties_type: Optional[Union[str, "AgentPoolType"]] = None, - mode: Optional[Union[str, "AgentPoolMode"]] = None, + scale_down_mode: Optional[Union[str, "_models.ScaleDownMode"]] = None, + type_properties_type: Optional[Union[str, "_models.AgentPoolType"]] = None, + mode: Optional[Union[str, "_models.AgentPoolMode"]] = None, orchestrator_version: Optional[str] = None, - upgrade_settings: Optional["AgentPoolUpgradeSettings"] = None, - power_state: Optional["PowerState"] = None, + upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, + power_state: Optional["_models.PowerState"] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", spot_max_price: Optional[float] = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, proximity_placement_group_id: Optional[str] = None, - kubelet_config: Optional["KubeletConfig"] = None, - linux_os_config: Optional["LinuxOSConfig"] = None, + kubelet_config: Optional["_models.KubeletConfig"] = None, + linux_os_config: Optional["_models.LinuxOSConfig"] = None, enable_encryption_at_host: Optional[bool] = None, enable_ultra_ssd: Optional[bool] = None, enable_fips: Optional[bool] = None, - gpu_instance_profile: Optional[Union[str, "GPUInstanceProfile"]] = None, - creation_data: Optional["CreationData"] = None, + gpu_instance_profile: Optional[Union[str, "_models.GPUInstanceProfile"]] = None, + creation_data: Optional["_models.CreationData"] = None, capacity_reservation_group_id: Optional[str] = None, host_group_id: Optional[str] = None, **kwargs @@ -336,16 +337,16 @@ def __init__( :keyword os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS - `_. Possible values - include: "Managed", "Ephemeral". + `_. Known values are: + "Managed", "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Possible values include: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.KubeletDiskType - :keyword workload_runtime: Determines the type of workload a node can run. Possible values - include: "OCIContainer", "WasmWasi". + :keyword workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer", "WasmWasi". :paramtype workload_runtime: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.WorkloadRuntime :keyword message_of_the_day: A base64-encoded string which will be written to /etc/motd after @@ -364,11 +365,11 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.OSType :keyword os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Possible values include: "Ubuntu", "CBLMariner". + Known values are: "Ubuntu", "CBLMariner". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -377,17 +378,16 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, - it defaults to Delete. Possible values include: "Delete", "Deallocate". + it defaults to Delete. Known values are: "Delete", "Deallocate". :paramtype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.ScaleDownMode - :keyword type_properties_type: The type of Agent Pool. Possible values include: + :keyword type_properties_type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type_properties_type: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Possible values include: "System", - "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.AgentPoolMode :keyword orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -418,12 +418,12 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Possible values include: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Possible values include: "Delete", - "Deallocate". Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which @@ -457,7 +457,7 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.GPUInstanceProfile @@ -550,7 +550,7 @@ class AgentPoolAvailableVersions(msrest.serialization.Model): def __init__( self, *, - agent_pool_versions: Optional[List["AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem"]] = None, + agent_pool_versions: Optional[List["_models.AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem"]] = None, **kwargs ): """ @@ -627,7 +627,7 @@ class AgentPoolListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["AgentPool"]] = None, + value: Optional[List["_models.AgentPool"]] = None, **kwargs ): """ @@ -654,8 +654,8 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): :vartype type: str :ivar kubernetes_version: Required. The Kubernetes version (major.minor.patch). :vartype kubernetes_version: str - :ivar os_type: Required. The operating system type. The default is Linux. Possible values - include: "Linux", "Windows". Default value: "Linux". + :ivar os_type: Required. The operating system type. The default is Linux. Known values are: + "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -686,16 +686,16 @@ def __init__( self, *, kubernetes_version: str, - os_type: Union[str, "OSType"] = "Linux", - upgrades: Optional[List["AgentPoolUpgradeProfilePropertiesUpgradesItem"]] = None, + os_type: Union[str, "_models.OSType"] = "Linux", + upgrades: Optional[List["_models.AgentPoolUpgradeProfilePropertiesUpgradesItem"]] = None, latest_node_image_version: Optional[str] = None, **kwargs ): """ :keyword kubernetes_version: Required. The Kubernetes version (major.minor.patch). :paramtype kubernetes_version: str - :keyword os_type: Required. The operating system type. The default is Linux. Possible values - include: "Linux", "Windows". Default value: "Linux". + :keyword os_type: Required. The operating system type. The default is Linux. Known values are: + "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: @@ -807,7 +807,7 @@ def __init__( code: Optional[str] = None, message: Optional[str] = None, target: Optional[str] = None, - details: Optional[List["CloudErrorBody"]] = None, + details: Optional[List["_models.CloudErrorBody"]] = None, **kwargs ): """ @@ -852,7 +852,7 @@ class ContainerServiceDiagnosticsProfile(msrest.serialization.Model): def __init__( self, *, - vm_diagnostics: "ContainerServiceVMDiagnostics", + vm_diagnostics: "_models.ContainerServiceVMDiagnostics", **kwargs ): """ @@ -890,7 +890,7 @@ def __init__( self, *, admin_username: str, - ssh: "ContainerServiceSshConfiguration", + ssh: "_models.ContainerServiceSshConfiguration", **kwargs ): """ @@ -913,17 +913,17 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar count: Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, - and 5. The default value is 1. Possible values include: 1, 3, 5. Default value: "1". + and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". :vartype count: int or ~azure.mgmt.containerservice.v2022_01_02_preview.models.Count :ivar dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. :vartype dns_prefix: str - :ivar vm_size: Required. Size of agent VMs. Possible values include: "Standard_A1", - "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", - "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", - "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", - "Standard_A8m_v2", "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", - "Standard_B8ms", "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", - "Standard_D12", "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", + :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", + "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", + "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", + "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", "Standard_B8ms", + "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", "Standard_D12", + "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", "Standard_D13_v2_Promo", "Standard_D14", "Standard_D14_v2", "Standard_D14_v2_Promo", "Standard_D15_v2", "Standard_D16_v3", "Standard_D16s_v3", "Standard_D1_v2", "Standard_D2", "Standard_D2_v2", "Standard_D2_v2_Promo", "Standard_D2_v3", "Standard_D2s_v3", "Standard_D3", @@ -968,7 +968,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): :vartype first_consecutive_static_ip: str :ivar storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Possible values include: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". :vartype storage_profile: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.ContainerServiceStorageProfileTypes :ivar fqdn: FQDN for the master pool. @@ -997,27 +997,27 @@ def __init__( self, *, dns_prefix: str, - vm_size: Union[str, "ContainerServiceVMSizeTypes"], - count: Optional[Union[int, "Count"]] = 1, + vm_size: Union[str, "_models.ContainerServiceVMSizeTypes"], + count: Optional[Union[int, "_models.Count"]] = 1, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, first_consecutive_static_ip: Optional[str] = "10.240.255.5", - storage_profile: Optional[Union[str, "ContainerServiceStorageProfileTypes"]] = None, + storage_profile: Optional[Union[str, "_models.ContainerServiceStorageProfileTypes"]] = None, **kwargs ): """ :keyword count: Number of masters (VMs) in the container service cluster. Allowed values are 1, - 3, and 5. The default value is 1. Possible values include: 1, 3, 5. Default value: "1". + 3, and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". :paramtype count: int or ~azure.mgmt.containerservice.v2022_01_02_preview.models.Count :keyword dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. :paramtype dns_prefix: str - :keyword vm_size: Required. Size of agent VMs. Possible values include: "Standard_A1", - "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", - "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", - "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", - "Standard_A8m_v2", "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", - "Standard_B8ms", "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", - "Standard_D12", "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", + :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", + "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", + "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", + "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", "Standard_B8ms", + "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", "Standard_D12", + "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", "Standard_D13_v2_Promo", "Standard_D14", "Standard_D14_v2", "Standard_D14_v2_Promo", "Standard_D15_v2", "Standard_D16_v3", "Standard_D16s_v3", "Standard_D1_v2", "Standard_D2", "Standard_D2_v2", "Standard_D2_v2_Promo", "Standard_D2_v3", "Standard_D2s_v3", "Standard_D3", @@ -1062,7 +1062,7 @@ def __init__( :paramtype first_consecutive_static_ip: str :keyword storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Possible values include: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". :paramtype storage_profile: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.ContainerServiceStorageProfileTypes """ @@ -1080,16 +1080,16 @@ def __init__( class ContainerServiceNetworkProfile(msrest.serialization.Model): """Profile of network configuration. - :ivar network_plugin: Network plugin used for building the Kubernetes network. Possible values - include: "azure", "kubenet", "none". Default value: "kubenet". + :ivar network_plugin: Network plugin used for building the Kubernetes network. Known values + are: "azure", "kubenet", "none". Default value: "kubenet". :vartype network_plugin: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.NetworkPlugin - :ivar network_policy: Network policy used for building the Kubernetes network. Possible values - include: "calico", "azure". + :ivar network_policy: Network policy used for building the Kubernetes network. Known values + are: "calico", "azure". :vartype network_policy: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.NetworkPolicy :ivar network_mode: This cannot be specified if networkPlugin is anything other than 'azure'. - Possible values include: "transparent", "bridge". + Known values are: "transparent", "bridge". :vartype network_mode: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.NetworkMode :ivar pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. @@ -1105,14 +1105,14 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): :vartype docker_bridge_cidr: str :ivar outbound_type: This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type - `_. Possible values include: - "loadBalancer", "userDefinedRouting", "managedNATGateway", "userAssignedNATGateway". Default - value: "loadBalancer". + `_. Known values are: "loadBalancer", + "userDefinedRouting", "managedNATGateway", "userAssignedNATGateway". Default value: + "loadBalancer". :vartype outbound_type: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.OutboundType :ivar load_balancer_sku: The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the - differences between load balancer SKUs. Possible values include: "standard", "basic". + differences between load balancer SKUs. Known values are: "standard", "basic". :vartype load_balancer_sku: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.LoadBalancerSku :ivar load_balancer_profile: Profile of the cluster load balancer. @@ -1162,33 +1162,33 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): def __init__( self, *, - network_plugin: Optional[Union[str, "NetworkPlugin"]] = "kubenet", - network_policy: Optional[Union[str, "NetworkPolicy"]] = None, - network_mode: Optional[Union[str, "NetworkMode"]] = None, + network_plugin: Optional[Union[str, "_models.NetworkPlugin"]] = "kubenet", + network_policy: Optional[Union[str, "_models.NetworkPolicy"]] = None, + network_mode: Optional[Union[str, "_models.NetworkMode"]] = None, pod_cidr: Optional[str] = "10.244.0.0/16", service_cidr: Optional[str] = "10.0.0.0/16", dns_service_ip: Optional[str] = "10.0.0.10", docker_bridge_cidr: Optional[str] = "172.17.0.1/16", - outbound_type: Optional[Union[str, "OutboundType"]] = "loadBalancer", - load_balancer_sku: Optional[Union[str, "LoadBalancerSku"]] = None, - load_balancer_profile: Optional["ManagedClusterLoadBalancerProfile"] = None, - nat_gateway_profile: Optional["ManagedClusterNATGatewayProfile"] = None, + outbound_type: Optional[Union[str, "_models.OutboundType"]] = "loadBalancer", + load_balancer_sku: Optional[Union[str, "_models.LoadBalancerSku"]] = None, + load_balancer_profile: Optional["_models.ManagedClusterLoadBalancerProfile"] = None, + nat_gateway_profile: Optional["_models.ManagedClusterNATGatewayProfile"] = None, pod_cidrs: Optional[List[str]] = None, service_cidrs: Optional[List[str]] = None, - ip_families: Optional[List[Union[str, "IpFamily"]]] = None, + ip_families: Optional[List[Union[str, "_models.IpFamily"]]] = None, **kwargs ): """ - :keyword network_plugin: Network plugin used for building the Kubernetes network. Possible - values include: "azure", "kubenet", "none". Default value: "kubenet". + :keyword network_plugin: Network plugin used for building the Kubernetes network. Known values + are: "azure", "kubenet", "none". Default value: "kubenet". :paramtype network_plugin: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.NetworkPlugin - :keyword network_policy: Network policy used for building the Kubernetes network. Possible - values include: "calico", "azure". + :keyword network_policy: Network policy used for building the Kubernetes network. Known values + are: "calico", "azure". :paramtype network_policy: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.NetworkPolicy :keyword network_mode: This cannot be specified if networkPlugin is anything other than - 'azure'. Possible values include: "transparent", "bridge". + 'azure'. Known values are: "transparent", "bridge". :paramtype network_mode: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.NetworkMode :keyword pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. @@ -1204,14 +1204,14 @@ def __init__( :paramtype docker_bridge_cidr: str :keyword outbound_type: This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type - `_. Possible values include: - "loadBalancer", "userDefinedRouting", "managedNATGateway", "userAssignedNATGateway". Default - value: "loadBalancer". + `_. Known values are: "loadBalancer", + "userDefinedRouting", "managedNATGateway", "userAssignedNATGateway". Default value: + "loadBalancer". :paramtype outbound_type: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.OutboundType :keyword load_balancer_sku: The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the - differences between load balancer SKUs. Possible values include: "standard", "basic". + differences between load balancer SKUs. Known values are: "standard", "basic". :paramtype load_balancer_sku: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.LoadBalancerSku :keyword load_balancer_profile: Profile of the cluster load balancer. @@ -1272,7 +1272,7 @@ class ContainerServiceSshConfiguration(msrest.serialization.Model): def __init__( self, *, - public_keys: List["ContainerServiceSshPublicKey"], + public_keys: List["_models.ContainerServiceSshPublicKey"], **kwargs ): """ @@ -1462,7 +1462,7 @@ def __init__( self, *, domain_name: Optional[str] = None, - endpoint_details: Optional[List["EndpointDetail"]] = None, + endpoint_details: Optional[List["_models.EndpointDetail"]] = None, **kwargs ): """ @@ -1528,7 +1528,7 @@ class ExtendedLocation(msrest.serialization.Model): :ivar name: The name of the extended location. :vartype name: str - :ivar type: The type of the extended location. Possible values include: "EdgeZone". + :ivar type: The type of the extended location. Known values are: "EdgeZone". :vartype type: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.ExtendedLocationTypes """ @@ -1542,13 +1542,13 @@ def __init__( self, *, name: Optional[str] = None, - type: Optional[Union[str, "ExtendedLocationTypes"]] = None, + type: Optional[Union[str, "_models.ExtendedLocationTypes"]] = None, **kwargs ): """ :keyword name: The name of the extended location. :paramtype name: str - :keyword type: The type of the extended location. Possible values include: "EdgeZone". + :keyword type: The type of the extended location. Known values are: "EdgeZone". :paramtype type: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.ExtendedLocationTypes """ @@ -1708,7 +1708,7 @@ class LinuxOSConfig(msrest.serialization.Model): def __init__( self, *, - sysctls: Optional["SysctlConfig"] = None, + sysctls: Optional["_models.SysctlConfig"] = None, transparent_huge_page_enabled: Optional[str] = None, transparent_huge_page_defrag: Optional[str] = None, swap_file_size_mb: Optional[int] = None, @@ -1777,8 +1777,8 @@ class MaintenanceConfiguration(SubResource): def __init__( self, *, - time_in_week: Optional[List["TimeInWeek"]] = None, - not_allowed_time: Optional[List["TimeSpan"]] = None, + time_in_week: Optional[List["_models.TimeInWeek"]] = None, + not_allowed_time: Optional[List["_models.TimeSpan"]] = None, **kwargs ): """ @@ -1820,7 +1820,7 @@ class MaintenanceConfigurationListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["MaintenanceConfiguration"]] = None, + value: Optional[List["_models.MaintenanceConfiguration"]] = None, **kwargs ): """ @@ -2010,8 +2010,8 @@ class ManagedCluster(Resource): :ivar security_profile: Security profile for the managed cluster. :vartype security_profile: ~azure.mgmt.containerservice.v2022_01_02_preview.models.ManagedClusterSecurityProfile - :ivar public_network_access: Allow or deny public network access for AKS. Possible values - include: "Enabled", "Disabled". + :ivar public_network_access: Allow or deny public network access for AKS. Known values are: + "Enabled", "Disabled". :vartype public_network_access: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.PublicNetworkAccess """ @@ -2079,35 +2079,35 @@ def __init__( *, location: str, tags: Optional[Dict[str, str]] = None, - sku: Optional["ManagedClusterSKU"] = None, - extended_location: Optional["ExtendedLocation"] = None, - identity: Optional["ManagedClusterIdentity"] = None, + sku: Optional["_models.ManagedClusterSKU"] = None, + extended_location: Optional["_models.ExtendedLocation"] = None, + identity: Optional["_models.ManagedClusterIdentity"] = None, kubernetes_version: Optional[str] = None, dns_prefix: Optional[str] = None, fqdn_subdomain: Optional[str] = None, - agent_pool_profiles: Optional[List["ManagedClusterAgentPoolProfile"]] = None, - linux_profile: Optional["ContainerServiceLinuxProfile"] = None, - windows_profile: Optional["ManagedClusterWindowsProfile"] = None, - service_principal_profile: Optional["ManagedClusterServicePrincipalProfile"] = None, - addon_profiles: Optional[Dict[str, "ManagedClusterAddonProfile"]] = None, - pod_identity_profile: Optional["ManagedClusterPodIdentityProfile"] = None, - oidc_issuer_profile: Optional["ManagedClusterOIDCIssuerProfile"] = None, + agent_pool_profiles: Optional[List["_models.ManagedClusterAgentPoolProfile"]] = None, + linux_profile: Optional["_models.ContainerServiceLinuxProfile"] = None, + windows_profile: Optional["_models.ManagedClusterWindowsProfile"] = None, + service_principal_profile: Optional["_models.ManagedClusterServicePrincipalProfile"] = None, + addon_profiles: Optional[Dict[str, "_models.ManagedClusterAddonProfile"]] = None, + pod_identity_profile: Optional["_models.ManagedClusterPodIdentityProfile"] = None, + oidc_issuer_profile: Optional["_models.ManagedClusterOIDCIssuerProfile"] = None, node_resource_group: Optional[str] = None, enable_rbac: Optional[bool] = None, enable_pod_security_policy: Optional[bool] = None, enable_namespace_resources: Optional[bool] = None, - network_profile: Optional["ContainerServiceNetworkProfile"] = None, - aad_profile: Optional["ManagedClusterAADProfile"] = None, - auto_upgrade_profile: Optional["ManagedClusterAutoUpgradeProfile"] = None, - auto_scaler_profile: Optional["ManagedClusterPropertiesAutoScalerProfile"] = None, - api_server_access_profile: Optional["ManagedClusterAPIServerAccessProfile"] = None, + network_profile: Optional["_models.ContainerServiceNetworkProfile"] = None, + aad_profile: Optional["_models.ManagedClusterAADProfile"] = None, + auto_upgrade_profile: Optional["_models.ManagedClusterAutoUpgradeProfile"] = None, + auto_scaler_profile: Optional["_models.ManagedClusterPropertiesAutoScalerProfile"] = None, + api_server_access_profile: Optional["_models.ManagedClusterAPIServerAccessProfile"] = None, disk_encryption_set_id: Optional[str] = None, - identity_profile: Optional[Dict[str, "UserAssignedIdentity"]] = None, - private_link_resources: Optional[List["PrivateLinkResource"]] = None, + identity_profile: Optional[Dict[str, "_models.UserAssignedIdentity"]] = None, + private_link_resources: Optional[List["_models.PrivateLinkResource"]] = None, disable_local_accounts: Optional[bool] = None, - http_proxy_config: Optional["ManagedClusterHTTPProxyConfig"] = None, - security_profile: Optional["ManagedClusterSecurityProfile"] = None, - public_network_access: Optional[Union[str, "PublicNetworkAccess"]] = None, + http_proxy_config: Optional["_models.ManagedClusterHTTPProxyConfig"] = None, + security_profile: Optional["_models.ManagedClusterSecurityProfile"] = None, + public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None, **kwargs ): """ @@ -2205,8 +2205,8 @@ def __init__( :keyword security_profile: Security profile for the managed cluster. :paramtype security_profile: ~azure.mgmt.containerservice.v2022_01_02_preview.models.ManagedClusterSecurityProfile - :keyword public_network_access: Allow or deny public network access for AKS. Possible values - include: "Enabled", "Disabled". + :keyword public_network_access: Allow or deny public network access for AKS. Known values are: + "Enabled", "Disabled". :paramtype public_network_access: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.PublicNetworkAccess """ @@ -2518,16 +2518,16 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS - `_. Possible values - include: "Managed", "Ephemeral". + `_. Known values are: + "Managed", "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Possible values include: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.KubeletDiskType - :ivar workload_runtime: Determines the type of workload a node can run. Possible values - include: "OCIContainer", "WasmWasi". + :ivar workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer", "WasmWasi". :vartype workload_runtime: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.WorkloadRuntime :ivar message_of_the_day: A base64-encoded string which will be written to /etc/motd after @@ -2546,11 +2546,11 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.OSType - :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Possible values include: "Ubuntu", "CBLMariner". + :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known + values are: "Ubuntu", "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. :vartype max_count: int @@ -2559,16 +2559,15 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it - defaults to Delete. Possible values include: "Delete", "Deallocate". + defaults to Delete. Known values are: "Delete", "Deallocate". :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.ScaleDownMode - :ivar type: The type of Agent Pool. Possible values include: "VirtualMachineScaleSets", + :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Possible values include: "System", - "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". :vartype mode: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.AgentPoolMode :ivar orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -2603,12 +2602,12 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Possible values include: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Possible values include: "Delete", - "Deallocate". Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which @@ -2640,7 +2639,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.GPUInstanceProfile :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool @@ -2713,41 +2712,41 @@ def __init__( count: Optional[int] = None, vm_size: Optional[str] = None, os_disk_size_gb: Optional[int] = None, - os_disk_type: Optional[Union[str, "OSDiskType"]] = None, - kubelet_disk_type: Optional[Union[str, "KubeletDiskType"]] = None, - workload_runtime: Optional[Union[str, "WorkloadRuntime"]] = None, + os_disk_type: Optional[Union[str, "_models.OSDiskType"]] = None, + kubelet_disk_type: Optional[Union[str, "_models.KubeletDiskType"]] = None, + workload_runtime: Optional[Union[str, "_models.WorkloadRuntime"]] = None, message_of_the_day: Optional[str] = None, vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", - os_sku: Optional[Union[str, "OSSKU"]] = None, + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - scale_down_mode: Optional[Union[str, "ScaleDownMode"]] = None, - type: Optional[Union[str, "AgentPoolType"]] = None, - mode: Optional[Union[str, "AgentPoolMode"]] = None, + scale_down_mode: Optional[Union[str, "_models.ScaleDownMode"]] = None, + type: Optional[Union[str, "_models.AgentPoolType"]] = None, + mode: Optional[Union[str, "_models.AgentPoolMode"]] = None, orchestrator_version: Optional[str] = None, - upgrade_settings: Optional["AgentPoolUpgradeSettings"] = None, - power_state: Optional["PowerState"] = None, + upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, + power_state: Optional["_models.PowerState"] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", spot_max_price: Optional[float] = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, proximity_placement_group_id: Optional[str] = None, - kubelet_config: Optional["KubeletConfig"] = None, - linux_os_config: Optional["LinuxOSConfig"] = None, + kubelet_config: Optional["_models.KubeletConfig"] = None, + linux_os_config: Optional["_models.LinuxOSConfig"] = None, enable_encryption_at_host: Optional[bool] = None, enable_ultra_ssd: Optional[bool] = None, enable_fips: Optional[bool] = None, - gpu_instance_profile: Optional[Union[str, "GPUInstanceProfile"]] = None, - creation_data: Optional["CreationData"] = None, + gpu_instance_profile: Optional[Union[str, "_models.GPUInstanceProfile"]] = None, + creation_data: Optional["_models.CreationData"] = None, capacity_reservation_group_id: Optional[str] = None, host_group_id: Optional[str] = None, **kwargs @@ -2768,16 +2767,16 @@ def __init__( :keyword os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS - `_. Possible values - include: "Managed", "Ephemeral". + `_. Known values are: + "Managed", "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Possible values include: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.KubeletDiskType - :keyword workload_runtime: Determines the type of workload a node can run. Possible values - include: "OCIContainer", "WasmWasi". + :keyword workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer", "WasmWasi". :paramtype workload_runtime: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.WorkloadRuntime :keyword message_of_the_day: A base64-encoded string which will be written to /etc/motd after @@ -2796,11 +2795,11 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.OSType :keyword os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Possible values include: "Ubuntu", "CBLMariner". + Known values are: "Ubuntu", "CBLMariner". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -2809,16 +2808,15 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, - it defaults to Delete. Possible values include: "Delete", "Deallocate". + it defaults to Delete. Known values are: "Delete", "Deallocate". :paramtype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.ScaleDownMode - :keyword type: The type of Agent Pool. Possible values include: "VirtualMachineScaleSets", + :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Possible values include: "System", - "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.AgentPoolMode :keyword orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -2849,12 +2847,12 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Possible values include: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Possible values include: "Delete", - "Deallocate". Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which @@ -2888,7 +2886,7 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.GPUInstanceProfile @@ -2971,16 +2969,16 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS - `_. Possible values - include: "Managed", "Ephemeral". + `_. Known values are: + "Managed", "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Possible values include: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.KubeletDiskType - :ivar workload_runtime: Determines the type of workload a node can run. Possible values - include: "OCIContainer", "WasmWasi". + :ivar workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer", "WasmWasi". :vartype workload_runtime: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.WorkloadRuntime :ivar message_of_the_day: A base64-encoded string which will be written to /etc/motd after @@ -2999,11 +2997,11 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.OSType - :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Possible values include: "Ubuntu", "CBLMariner". + :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known + values are: "Ubuntu", "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. :vartype max_count: int @@ -3012,16 +3010,15 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it - defaults to Delete. Possible values include: "Delete", "Deallocate". + defaults to Delete. Known values are: "Delete", "Deallocate". :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.ScaleDownMode - :ivar type: The type of Agent Pool. Possible values include: "VirtualMachineScaleSets", + :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Possible values include: "System", - "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". :vartype mode: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.AgentPoolMode :ivar orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -3056,12 +3053,12 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Possible values include: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Possible values include: "Delete", - "Deallocate". Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which @@ -3093,7 +3090,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.GPUInstanceProfile :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool @@ -3171,41 +3168,41 @@ def __init__( count: Optional[int] = None, vm_size: Optional[str] = None, os_disk_size_gb: Optional[int] = None, - os_disk_type: Optional[Union[str, "OSDiskType"]] = None, - kubelet_disk_type: Optional[Union[str, "KubeletDiskType"]] = None, - workload_runtime: Optional[Union[str, "WorkloadRuntime"]] = None, + os_disk_type: Optional[Union[str, "_models.OSDiskType"]] = None, + kubelet_disk_type: Optional[Union[str, "_models.KubeletDiskType"]] = None, + workload_runtime: Optional[Union[str, "_models.WorkloadRuntime"]] = None, message_of_the_day: Optional[str] = None, vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", - os_sku: Optional[Union[str, "OSSKU"]] = None, + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - scale_down_mode: Optional[Union[str, "ScaleDownMode"]] = None, - type: Optional[Union[str, "AgentPoolType"]] = None, - mode: Optional[Union[str, "AgentPoolMode"]] = None, + scale_down_mode: Optional[Union[str, "_models.ScaleDownMode"]] = None, + type: Optional[Union[str, "_models.AgentPoolType"]] = None, + mode: Optional[Union[str, "_models.AgentPoolMode"]] = None, orchestrator_version: Optional[str] = None, - upgrade_settings: Optional["AgentPoolUpgradeSettings"] = None, - power_state: Optional["PowerState"] = None, + upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, + power_state: Optional["_models.PowerState"] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", spot_max_price: Optional[float] = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, proximity_placement_group_id: Optional[str] = None, - kubelet_config: Optional["KubeletConfig"] = None, - linux_os_config: Optional["LinuxOSConfig"] = None, + kubelet_config: Optional["_models.KubeletConfig"] = None, + linux_os_config: Optional["_models.LinuxOSConfig"] = None, enable_encryption_at_host: Optional[bool] = None, enable_ultra_ssd: Optional[bool] = None, enable_fips: Optional[bool] = None, - gpu_instance_profile: Optional[Union[str, "GPUInstanceProfile"]] = None, - creation_data: Optional["CreationData"] = None, + gpu_instance_profile: Optional[Union[str, "_models.GPUInstanceProfile"]] = None, + creation_data: Optional["_models.CreationData"] = None, capacity_reservation_group_id: Optional[str] = None, host_group_id: Optional[str] = None, **kwargs @@ -3226,16 +3223,16 @@ def __init__( :keyword os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS - `_. Possible values - include: "Managed", "Ephemeral". + `_. Known values are: + "Managed", "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Possible values include: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.KubeletDiskType - :keyword workload_runtime: Determines the type of workload a node can run. Possible values - include: "OCIContainer", "WasmWasi". + :keyword workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer", "WasmWasi". :paramtype workload_runtime: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.WorkloadRuntime :keyword message_of_the_day: A base64-encoded string which will be written to /etc/motd after @@ -3254,11 +3251,11 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.OSType :keyword os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Possible values include: "Ubuntu", "CBLMariner". + Known values are: "Ubuntu", "CBLMariner". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -3267,16 +3264,15 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, - it defaults to Delete. Possible values include: "Delete", "Deallocate". + it defaults to Delete. Known values are: "Delete", "Deallocate". :paramtype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.ScaleDownMode - :keyword type: The type of Agent Pool. Possible values include: "VirtualMachineScaleSets", + :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Possible values include: "System", - "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.AgentPoolMode :keyword orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -3307,12 +3303,12 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Possible values include: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Possible values include: "Delete", - "Deallocate". Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which @@ -3346,7 +3342,7 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.GPUInstanceProfile @@ -3439,8 +3435,8 @@ class ManagedClusterAutoUpgradeProfile(msrest.serialization.Model): """Auto upgrade profile for a managed cluster. :ivar upgrade_channel: For more information see `setting the AKS cluster auto-upgrade channel - `_. Possible - values include: "rapid", "stable", "patch", "node-image", "none". + `_. Known values + are: "rapid", "stable", "patch", "node-image", "none". :vartype upgrade_channel: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.UpgradeChannel """ @@ -3452,13 +3448,13 @@ class ManagedClusterAutoUpgradeProfile(msrest.serialization.Model): def __init__( self, *, - upgrade_channel: Optional[Union[str, "UpgradeChannel"]] = None, + upgrade_channel: Optional[Union[str, "_models.UpgradeChannel"]] = None, **kwargs ): """ :keyword upgrade_channel: For more information see `setting the AKS cluster auto-upgrade channel `_. - Possible values include: "rapid", "stable", "patch", "node-image", "none". + Known values are: "rapid", "stable", "patch", "node-image", "none". :paramtype upgrade_channel: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.UpgradeChannel """ @@ -3524,7 +3520,7 @@ class ManagedClusterIdentity(msrest.serialization.Model): components. :vartype tenant_id: str :ivar type: For more information see `use managed identities in AKS - `_. Possible values include: + `_. Known values are: "SystemAssigned", "UserAssigned", "None". :vartype type: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.ResourceIdentityType @@ -3549,13 +3545,13 @@ class ManagedClusterIdentity(msrest.serialization.Model): def __init__( self, *, - type: Optional[Union[str, "ResourceIdentityType"]] = None, - user_assigned_identities: Optional[Dict[str, "ManagedServiceIdentityUserAssignedIdentitiesValue"]] = None, + type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, + user_assigned_identities: Optional[Dict[str, "_models.ManagedServiceIdentityUserAssignedIdentitiesValue"]] = None, **kwargs ): """ :keyword type: For more information see `use managed identities in AKS - `_. Possible values include: + `_. Known values are: "SystemAssigned", "UserAssigned", "None". :paramtype type: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.ResourceIdentityType @@ -3594,7 +3590,7 @@ class ManagedClusterListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["ManagedCluster"]] = None, + value: Optional[List["_models.ManagedCluster"]] = None, **kwargs ): """ @@ -3652,10 +3648,10 @@ class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): def __init__( self, *, - managed_outbound_i_ps: Optional["ManagedClusterLoadBalancerProfileManagedOutboundIPs"] = None, - outbound_ip_prefixes: Optional["ManagedClusterLoadBalancerProfileOutboundIPPrefixes"] = None, - outbound_i_ps: Optional["ManagedClusterLoadBalancerProfileOutboundIPs"] = None, - effective_outbound_i_ps: Optional[List["ResourceReference"]] = None, + managed_outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileManagedOutboundIPs"] = None, + outbound_ip_prefixes: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPPrefixes"] = None, + outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPs"] = None, + effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, allocated_outbound_ports: Optional[int] = 0, idle_timeout_in_minutes: Optional[int] = 30, enable_multiple_standard_load_balancers: Optional[bool] = None, @@ -3757,7 +3753,7 @@ class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.M def __init__( self, *, - public_ip_prefixes: Optional[List["ResourceReference"]] = None, + public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, **kwargs ): """ @@ -3784,7 +3780,7 @@ class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): def __init__( self, *, - public_i_ps: Optional[List["ResourceReference"]] = None, + public_i_ps: Optional[List["_models.ResourceReference"]] = None, **kwargs ): """ @@ -3855,8 +3851,8 @@ class ManagedClusterNATGatewayProfile(msrest.serialization.Model): def __init__( self, *, - managed_outbound_ip_profile: Optional["ManagedClusterManagedOutboundIPProfile"] = None, - effective_outbound_i_ps: Optional[List["ResourceReference"]] = None, + managed_outbound_ip_profile: Optional["_models.ManagedClusterManagedOutboundIPProfile"] = None, + effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, idle_timeout_in_minutes: Optional[int] = 4, **kwargs ): @@ -3929,8 +3925,8 @@ class ManagedClusterPodIdentity(msrest.serialization.Model): :vartype binding_selector: str :ivar identity: Required. The user assigned identity details. :vartype identity: ~azure.mgmt.containerservice.v2022_01_02_preview.models.UserAssignedIdentity - :ivar provisioning_state: The current provisioning state of the pod identity. Possible values - include: "Assigned", "Updating", "Deleting", "Failed". + :ivar provisioning_state: The current provisioning state of the pod identity. Known values are: + "Assigned", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.ManagedClusterPodIdentityProvisioningState :ivar provisioning_info: @@ -3960,7 +3956,7 @@ def __init__( *, name: str, namespace: str, - identity: "UserAssignedIdentity", + identity: "_models.UserAssignedIdentity", binding_selector: Optional[str] = None, **kwargs ): @@ -4062,8 +4058,8 @@ def __init__( *, enabled: Optional[bool] = None, allow_network_plugin_kubenet: Optional[bool] = None, - user_assigned_identities: Optional[List["ManagedClusterPodIdentity"]] = None, - user_assigned_identity_exceptions: Optional[List["ManagedClusterPodIdentityException"]] = None, + user_assigned_identities: Optional[List["_models.ManagedClusterPodIdentity"]] = None, + user_assigned_identity_exceptions: Optional[List["_models.ManagedClusterPodIdentityException"]] = None, **kwargs ): """ @@ -4104,7 +4100,7 @@ class ManagedClusterPodIdentityProvisioningError(msrest.serialization.Model): def __init__( self, *, - error: Optional["ManagedClusterPodIdentityProvisioningErrorBody"] = None, + error: Optional["_models.ManagedClusterPodIdentityProvisioningErrorBody"] = None, **kwargs ): """ @@ -4146,7 +4142,7 @@ def __init__( code: Optional[str] = None, message: Optional[str] = None, target: Optional[str] = None, - details: Optional[List["ManagedClusterPodIdentityProvisioningErrorBody"]] = None, + details: Optional[List["_models.ManagedClusterPodIdentityProvisioningErrorBody"]] = None, **kwargs ): """ @@ -4185,7 +4181,7 @@ class ManagedClusterPodIdentityProvisioningInfo(msrest.serialization.Model): def __init__( self, *, - error: Optional["ManagedClusterPodIdentityProvisioningError"] = None, + error: Optional["_models.ManagedClusterPodIdentityProvisioningError"] = None, **kwargs ): """ @@ -4206,8 +4202,8 @@ class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): :vartype kubernetes_version: str :ivar name: The Agent Pool name. :vartype name: str - :ivar os_type: Required. The operating system type. The default is Linux. Possible values - include: "Linux", "Windows". Default value: "Linux". + :ivar os_type: Required. The operating system type. The default is Linux. Known values are: + "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -4230,9 +4226,9 @@ def __init__( self, *, kubernetes_version: str, - os_type: Union[str, "OSType"] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", name: Optional[str] = None, - upgrades: Optional[List["ManagedClusterPoolUpgradeProfileUpgradesItem"]] = None, + upgrades: Optional[List["_models.ManagedClusterPoolUpgradeProfileUpgradesItem"]] = None, **kwargs ): """ @@ -4240,8 +4236,8 @@ def __init__( :paramtype kubernetes_version: str :keyword name: The Agent Pool name. :paramtype name: str - :keyword os_type: Required. The operating system type. The default is Linux. Possible values - include: "Linux", "Windows". Default value: "Linux". + :keyword os_type: Required. The operating system type. The default is Linux. Known values are: + "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: @@ -4293,8 +4289,7 @@ class ManagedClusterPropertiesAutoScalerProfile(msrest.serialization.Model): :vartype balance_similar_node_groups: str :ivar expander: If not specified, the default is 'random'. See `expanders `_ - for more information. Possible values include: "least-waste", "most-pods", "priority", - "random". + for more information. Known values are: "least-waste", "most-pods", "priority", "random". :vartype expander: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.Expander :ivar max_empty_bulk_delete: The default is 10. :vartype max_empty_bulk_delete: str @@ -4361,7 +4356,7 @@ def __init__( self, *, balance_similar_node_groups: Optional[str] = None, - expander: Optional[Union[str, "Expander"]] = None, + expander: Optional[Union[str, "_models.Expander"]] = None, max_empty_bulk_delete: Optional[str] = None, max_graceful_termination_sec: Optional[str] = None, max_node_provision_time: Optional[str] = None, @@ -4384,8 +4379,7 @@ def __init__( :paramtype balance_similar_node_groups: str :keyword expander: If not specified, the default is 'random'. See `expanders `_ - for more information. Possible values include: "least-waste", "most-pods", "priority", - "random". + for more information. Known values are: "least-waste", "most-pods", "priority", "random". :paramtype expander: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.Expander :keyword max_empty_bulk_delete: The default is 10. :paramtype max_empty_bulk_delete: str @@ -4463,7 +4457,7 @@ class ManagedClusterSecurityProfile(msrest.serialization.Model): def __init__( self, *, - azure_defender: Optional["ManagedClusterSecurityProfileAzureDefender"] = None, + azure_defender: Optional["_models.ManagedClusterSecurityProfileAzureDefender"] = None, **kwargs ): """ @@ -4552,12 +4546,12 @@ def __init__( class ManagedClusterSKU(msrest.serialization.Model): """The SKU of a Managed Cluster. - :ivar name: The name of a managed cluster SKU. Possible values include: "Basic". + :ivar name: The name of a managed cluster SKU. Known values are: "Basic". :vartype name: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.ManagedClusterSKUName :ivar tier: If not specified, the default is 'Free'. See `uptime SLA - `_ for more details. Possible values include: - "Paid", "Free". + `_ for more details. Known values are: "Paid", + "Free". :vartype tier: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.ManagedClusterSKUTier """ @@ -4570,17 +4564,17 @@ class ManagedClusterSKU(msrest.serialization.Model): def __init__( self, *, - name: Optional[Union[str, "ManagedClusterSKUName"]] = None, - tier: Optional[Union[str, "ManagedClusterSKUTier"]] = None, + name: Optional[Union[str, "_models.ManagedClusterSKUName"]] = None, + tier: Optional[Union[str, "_models.ManagedClusterSKUTier"]] = None, **kwargs ): """ - :keyword name: The name of a managed cluster SKU. Possible values include: "Basic". + :keyword name: The name of a managed cluster SKU. Known values are: "Basic". :paramtype name: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.ManagedClusterSKUName :keyword tier: If not specified, the default is 'Free'. See `uptime SLA - `_ for more details. Possible values include: - "Paid", "Free". + `_ for more details. Known values are: "Paid", + "Free". :paramtype tier: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.ManagedClusterSKUTier """ @@ -4630,8 +4624,8 @@ class ManagedClusterUpgradeProfile(msrest.serialization.Model): def __init__( self, *, - control_plane_profile: "ManagedClusterPoolUpgradeProfile", - agent_pool_profiles: List["ManagedClusterPoolUpgradeProfile"], + control_plane_profile: "_models.ManagedClusterPoolUpgradeProfile", + agent_pool_profiles: List["_models.ManagedClusterPoolUpgradeProfile"], **kwargs ): """ @@ -4673,8 +4667,8 @@ class ManagedClusterWindowsProfile(msrest.serialization.Model): "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!". :vartype admin_password: str :ivar license_type: The license type to use for Windows VMs. See `Azure Hybrid User Benefits - `_ for more details. Possible values - include: "None", "Windows_Server". + `_ for more details. Known values are: + "None", "Windows_Server". :vartype license_type: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.LicenseType :ivar enable_csi_proxy: For more details on CSI proxy, see the `CSI proxy GitHub repo @@ -4702,9 +4696,9 @@ def __init__( *, admin_username: str, admin_password: Optional[str] = None, - license_type: Optional[Union[str, "LicenseType"]] = None, + license_type: Optional[Union[str, "_models.LicenseType"]] = None, enable_csi_proxy: Optional[bool] = None, - gmsa_profile: Optional["WindowsGmsaProfile"] = None, + gmsa_profile: Optional["_models.WindowsGmsaProfile"] = None, **kwargs ): """ @@ -4725,8 +4719,8 @@ def __init__( "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!". :paramtype admin_password: str :keyword license_type: The license type to use for Windows VMs. See `Azure Hybrid User Benefits - `_ for more details. Possible values - include: "None", "Windows_Server". + `_ for more details. Known values are: + "None", "Windows_Server". :paramtype license_type: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.LicenseType :keyword enable_csi_proxy: For more details on CSI proxy, see the `CSI proxy GitHub repo @@ -4890,7 +4884,7 @@ class OSOptionProfile(msrest.serialization.Model): def __init__( self, *, - os_option_property_list: List["OSOptionProperty"], + os_option_property_list: List["_models.OSOptionProperty"], **kwargs ): """ @@ -4964,7 +4958,7 @@ def __init__( self, *, category: Optional[str] = None, - endpoints: Optional[List["EndpointDependency"]] = None, + endpoints: Optional[List["_models.EndpointDependency"]] = None, **kwargs ): """ @@ -5007,7 +5001,7 @@ class OutboundEnvironmentEndpointCollection(msrest.serialization.Model): def __init__( self, *, - value: List["OutboundEnvironmentEndpoint"], + value: List["_models.OutboundEnvironmentEndpoint"], **kwargs ): """ @@ -5023,8 +5017,8 @@ def __init__( class PowerState(msrest.serialization.Model): """Describes the Power State of the cluster. - :ivar code: Tells whether the cluster is Running or Stopped. Possible values include: - "Running", "Stopped". + :ivar code: Tells whether the cluster is Running or Stopped. Known values are: "Running", + "Stopped". :vartype code: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.Code """ @@ -5035,12 +5029,12 @@ class PowerState(msrest.serialization.Model): def __init__( self, *, - code: Optional[Union[str, "Code"]] = None, + code: Optional[Union[str, "_models.Code"]] = None, **kwargs ): """ - :keyword code: Tells whether the cluster is Running or Stopped. Possible values include: - "Running", "Stopped". + :keyword code: Tells whether the cluster is Running or Stopped. Known values are: "Running", + "Stopped". :paramtype code: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.Code """ super(PowerState, self).__init__(**kwargs) @@ -5083,7 +5077,7 @@ class PrivateEndpointConnection(msrest.serialization.Model): :vartype name: str :ivar type: The resource type. :vartype type: str - :ivar provisioning_state: The current provisioning state. Possible values include: "Succeeded", + :ivar provisioning_state: The current provisioning state. Known values are: "Succeeded", "Creating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.PrivateEndpointConnectionProvisioningState @@ -5115,8 +5109,8 @@ class PrivateEndpointConnection(msrest.serialization.Model): def __init__( self, *, - private_endpoint: Optional["PrivateEndpoint"] = None, - private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, + private_endpoint: Optional["_models.PrivateEndpoint"] = None, + private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionState"] = None, **kwargs ): """ @@ -5152,7 +5146,7 @@ class PrivateEndpointConnectionListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["PrivateEndpointConnection"]] = None, + value: Optional[List["_models.PrivateEndpointConnection"]] = None, **kwargs ): """ @@ -5243,7 +5237,7 @@ class PrivateLinkResourcesListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["PrivateLinkResource"]] = None, + value: Optional[List["_models.PrivateLinkResource"]] = None, **kwargs ): """ @@ -5258,7 +5252,7 @@ def __init__( class PrivateLinkServiceConnectionState(msrest.serialization.Model): """The state of a private link service connection. - :ivar status: The private link service connection status. Possible values include: "Pending", + :ivar status: The private link service connection status. Known values are: "Pending", "Approved", "Rejected", "Disconnected". :vartype status: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.ConnectionStatus @@ -5274,13 +5268,13 @@ class PrivateLinkServiceConnectionState(msrest.serialization.Model): def __init__( self, *, - status: Optional[Union[str, "ConnectionStatus"]] = None, + status: Optional[Union[str, "_models.ConnectionStatus"]] = None, description: Optional[str] = None, **kwargs ): """ - :keyword status: The private link service connection status. Possible values include: - "Pending", "Approved", "Rejected", "Disconnected". + :keyword status: The private link service connection status. Known values are: "Pending", + "Approved", "Rejected", "Disconnected". :paramtype status: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.ConnectionStatus :keyword description: The private link service connection description. @@ -5440,7 +5434,7 @@ class Snapshot(Resource): :ivar creation_data: CreationData to be used to specify the source agent pool resource ID to create this snapshot. :vartype creation_data: ~azure.mgmt.containerservice.v2022_01_02_preview.models.CreationData - :ivar snapshot_type: The type of a snapshot. The default is NodePool. Possible values include: + :ivar snapshot_type: The type of a snapshot. The default is NodePool. Known values are: "NodePool". Default value: "NodePool". :vartype snapshot_type: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.SnapshotType @@ -5448,11 +5442,11 @@ class Snapshot(Resource): :vartype kubernetes_version: str :ivar node_image_version: The version of node image. :vartype node_image_version: str - :ivar os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.OSType - :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Possible values include: "Ubuntu", "CBLMariner". + :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known + values are: "Ubuntu", "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.OSSKU :ivar vm_size: The size of the VM. :vartype vm_size: str @@ -5496,8 +5490,8 @@ def __init__( *, location: str, tags: Optional[Dict[str, str]] = None, - creation_data: Optional["CreationData"] = None, - snapshot_type: Optional[Union[str, "SnapshotType"]] = "NodePool", + creation_data: Optional["_models.CreationData"] = None, + snapshot_type: Optional[Union[str, "_models.SnapshotType"]] = "NodePool", **kwargs ): """ @@ -5508,8 +5502,8 @@ def __init__( :keyword creation_data: CreationData to be used to specify the source agent pool resource ID to create this snapshot. :paramtype creation_data: ~azure.mgmt.containerservice.v2022_01_02_preview.models.CreationData - :keyword snapshot_type: The type of a snapshot. The default is NodePool. Possible values - include: "NodePool". Default value: "NodePool". + :keyword snapshot_type: The type of a snapshot. The default is NodePool. Known values are: + "NodePool". Default value: "NodePool". :paramtype snapshot_type: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.SnapshotType """ @@ -5548,7 +5542,7 @@ class SnapshotListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["Snapshot"]] = None, + value: Optional[List["_models.Snapshot"]] = None, **kwargs ): """ @@ -5779,7 +5773,7 @@ class SystemData(msrest.serialization.Model): :ivar created_by: The identity that created the resource. :vartype created_by: str - :ivar created_by_type: The type of identity that created the resource. Possible values include: + :ivar created_by_type: The type of identity that created the resource. Known values are: "User", "Application", "ManagedIdentity", "Key". :vartype created_by_type: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.CreatedByType @@ -5787,8 +5781,8 @@ class SystemData(msrest.serialization.Model): :vartype created_at: ~datetime.datetime :ivar last_modified_by: The identity that last modified the resource. :vartype last_modified_by: str - :ivar last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". + :ivar last_modified_by_type: The type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", "Key". :vartype last_modified_by_type: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.CreatedByType :ivar last_modified_at: The type of identity that last modified the resource. @@ -5808,26 +5802,26 @@ def __init__( self, *, created_by: Optional[str] = None, - created_by_type: Optional[Union[str, "CreatedByType"]] = None, + created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, created_at: Optional[datetime.datetime] = None, last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[Union[str, "CreatedByType"]] = None, + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, last_modified_at: Optional[datetime.datetime] = None, **kwargs ): """ :keyword created_by: The identity that created the resource. :paramtype created_by: str - :keyword created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". + :keyword created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", "Key". :paramtype created_by_type: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.CreatedByType :keyword created_at: The UTC timestamp of resource creation. :paramtype created_at: ~datetime.datetime :keyword last_modified_by: The identity that last modified the resource. :paramtype last_modified_by: str - :keyword last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". + :keyword last_modified_by_type: The type of identity that last modified the resource. Known + values are: "User", "Application", "ManagedIdentity", "Key". :paramtype last_modified_by_type: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.CreatedByType :keyword last_modified_at: The type of identity that last modified the resource. @@ -5870,8 +5864,8 @@ def __init__( class TimeInWeek(msrest.serialization.Model): """Time in a week. - :ivar day: The day of the week. Possible values include: "Sunday", "Monday", "Tuesday", - "Wednesday", "Thursday", "Friday", "Saturday". + :ivar day: The day of the week. Known values are: "Sunday", "Monday", "Tuesday", "Wednesday", + "Thursday", "Friday", "Saturday". :vartype day: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.WeekDay :ivar hour_slots: Each integer hour represents a time range beginning at 0m after the hour ending at the next hour (non-inclusive). 0 corresponds to 00:00 UTC, 23 corresponds to 23:00 @@ -5887,12 +5881,12 @@ class TimeInWeek(msrest.serialization.Model): def __init__( self, *, - day: Optional[Union[str, "WeekDay"]] = None, + day: Optional[Union[str, "_models.WeekDay"]] = None, hour_slots: Optional[List[int]] = None, **kwargs ): """ - :keyword day: The day of the week. Possible values include: "Sunday", "Monday", "Tuesday", + :keyword day: The day of the week. Known values are: "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday". :paramtype day: str or ~azure.mgmt.containerservice.v2022_01_02_preview.models.WeekDay :keyword hour_slots: Each integer hour represents a time range beginning at 0m after the hour diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/models/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/models/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/operations/__init__.py index 5e1e5e72fa59..e0748876288c 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/operations/__init__.py @@ -15,6 +15,9 @@ from ._resolve_private_link_service_id_operations import ResolvePrivateLinkServiceIdOperations from ._snapshots_operations import SnapshotsOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'Operations', 'ManagedClustersOperations', @@ -25,3 +28,5 @@ 'ResolvePrivateLinkServiceIdOperations', 'SnapshotsOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/operations/_agent_pools_operations.py index 8f86ce2e458b..f475b7ac1632 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/operations/_agent_pools_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -35,9 +35,12 @@ def build_list_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools") # pylint: disable=line-too-long path_format_arguments = { @@ -49,18 +52,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -72,9 +73,12 @@ def build_get_request( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -87,18 +91,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -109,14 +111,17 @@ def build_create_or_update_request_initial( resource_name: str, agent_pool_name: str, *, - json: JSONType = None, + json: Optional[_models.AgentPool] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -129,20 +134,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -156,9 +159,12 @@ def build_delete_request_initial( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -171,18 +177,16 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -194,9 +198,12 @@ def build_get_upgrade_profile_request( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default") # pylint: disable=line-too-long path_format_arguments = { @@ -209,18 +216,16 @@ def build_get_upgrade_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -231,9 +236,12 @@ def build_get_available_agent_pool_versions_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions") # pylint: disable=line-too-long path_format_arguments = { @@ -245,18 +253,16 @@ def build_get_available_agent_pool_versions_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -268,9 +274,12 @@ def build_upgrade_node_image_version_request_initial( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion") # pylint: disable=line-too-long path_format_arguments = { @@ -283,42 +292,38 @@ def build_upgrade_node_image_version_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class AgentPoolsOperations(object): - """AgentPoolsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class AgentPoolsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_01_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_01_02_preview.ContainerServiceClient`'s + :attr:`agent_pools` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -326,7 +331,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Iterable["_models.AgentPoolListResult"]: + ) -> Iterable[_models.AgentPoolListResult]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. @@ -341,13 +346,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_01_02_preview.models.AgentPoolListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -357,9 +365,11 @@ def prepare_request(next_link=None): resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -369,9 +379,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -411,7 +423,7 @@ def get( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPool": + ) -> _models.AgentPool: """Gets the specified managed cluster agent pool. Gets the specified managed cluster agent pool. @@ -427,13 +439,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.AgentPool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] request = build_get_request( @@ -443,11 +458,13 @@ def get( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -473,17 +490,20 @@ def _create_or_update_initial( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> "_models.AgentPool": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] + ) -> _models.AgentPool: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-01-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] _json = self._serialize.body(parameters, 'AgentPool') @@ -496,11 +516,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -531,9 +553,9 @@ def begin_create_or_update( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> LROPoller["_models.AgentPool"]: + ) -> LROPoller[_models.AgentPool]: """Creates or updates an agent pool in the specified managed cluster. Creates or updates an agent pool in the specified managed cluster. @@ -559,17 +581,20 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_01_02_preview.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, @@ -577,20 +602,27 @@ def begin_create_or_update( 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): - response = pipeline_response.http_response deserialized = self._deserialize('AgentPool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -610,13 +642,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements agent_pool_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -626,11 +661,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -677,21 +714,26 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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) @@ -701,8 +743,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -722,7 +770,7 @@ def get_upgrade_profile( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPoolUpgradeProfile": + ) -> _models.AgentPoolUpgradeProfile: """Gets the upgrade profile for an agent pool. Gets the upgrade profile for an agent pool. @@ -738,13 +786,16 @@ def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.AgentPoolUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] request = build_get_upgrade_profile_request( @@ -754,11 +805,13 @@ def get_upgrade_profile( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -785,7 +838,7 @@ def get_available_agent_pool_versions( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.AgentPoolAvailableVersions": + ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported Kubernetes versions for the specified agent pool. See `supported Kubernetes versions @@ -801,13 +854,16 @@ def get_available_agent_pool_versions( :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.AgentPoolAvailableVersions :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolAvailableVersions"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] request = build_get_available_agent_pool_versions_request( @@ -816,11 +872,13 @@ def get_available_agent_pool_versions( resource_name=resource_name, api_version=api_version, template_url=self.get_available_agent_pool_versions.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -847,14 +905,17 @@ def _upgrade_node_image_version_initial( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> Optional["_models.AgentPool"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.AgentPool"]] + ) -> Optional[_models.AgentPool]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] request = build_upgrade_node_image_version_request_initial( @@ -864,11 +925,13 @@ def _upgrade_node_image_version_initial( agent_pool_name=agent_pool_name, api_version=api_version, template_url=self._upgrade_node_image_version_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -901,7 +964,7 @@ def begin_upgrade_node_image_version( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> LROPoller["_models.AgentPool"]: + ) -> LROPoller[_models.AgentPool]: """Upgrades the node image version of an agent pool to the latest. Upgrading the node image version of an agent pool applies the newest OS and runtime updates to @@ -927,21 +990,26 @@ def begin_upgrade_node_image_version( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_01_02_preview.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._upgrade_node_image_version_initial( + raw_result = self._upgrade_node_image_version_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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) @@ -957,8 +1025,14 @@ def get_long_running_output(pipeline_response): return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/operations/_maintenance_configurations_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/operations/_maintenance_configurations_operations.py index ea4de102451e..c253126d89ae 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/operations/_maintenance_configurations_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/operations/_maintenance_configurations_operations.py @@ -16,12 +16,12 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -33,9 +33,12 @@ def build_list_by_managed_cluster_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations") # pylint: disable=line-too-long path_format_arguments = { @@ -47,18 +50,16 @@ def build_list_by_managed_cluster_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -70,9 +71,12 @@ def build_get_request( config_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long path_format_arguments = { @@ -85,18 +89,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -107,14 +109,17 @@ def build_create_or_update_request( resource_name: str, config_name: str, *, - json: JSONType = None, + json: Optional[_models.MaintenanceConfiguration] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long path_format_arguments = { @@ -127,20 +132,18 @@ def build_create_or_update_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -154,9 +157,12 @@ def build_delete_request( config_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long path_format_arguments = { @@ -169,42 +175,38 @@ def build_delete_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class MaintenanceConfigurationsOperations(object): - """MaintenanceConfigurationsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class MaintenanceConfigurationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_01_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_01_02_preview.ContainerServiceClient`'s + :attr:`maintenance_configurations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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_by_managed_cluster( @@ -212,7 +214,7 @@ def list_by_managed_cluster( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Iterable["_models.MaintenanceConfigurationListResult"]: + ) -> Iterable[_models.MaintenanceConfigurationListResult]: """Gets a list of maintenance configurations in the specified managed cluster. Gets a list of maintenance configurations in the specified managed cluster. @@ -228,13 +230,16 @@ def list_by_managed_cluster( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_01_02_preview.models.MaintenanceConfigurationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfigurationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfigurationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -244,9 +249,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=self.list_by_managed_cluster.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -256,9 +263,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -298,7 +307,7 @@ def get( resource_name: str, config_name: str, **kwargs: Any - ) -> "_models.MaintenanceConfiguration": + ) -> _models.MaintenanceConfiguration: """Gets the specified maintenance configuration of a managed cluster. Gets the specified maintenance configuration of a managed cluster. @@ -314,13 +323,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.MaintenanceConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfiguration"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] request = build_get_request( @@ -330,11 +342,13 @@ def get( config_name=config_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -361,9 +375,9 @@ def create_or_update( resource_group_name: str, resource_name: str, config_name: str, - parameters: "_models.MaintenanceConfiguration", + parameters: _models.MaintenanceConfiguration, **kwargs: Any - ) -> "_models.MaintenanceConfiguration": + ) -> _models.MaintenanceConfiguration: """Creates or updates a maintenance configuration in the specified managed cluster. Creates or updates a maintenance configuration in the specified managed cluster. @@ -382,14 +396,17 @@ def create_or_update( :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.MaintenanceConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfiguration"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-01-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] _json = self._serialize.body(parameters, 'MaintenanceConfiguration') @@ -402,11 +419,13 @@ def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -450,13 +469,16 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -466,11 +488,13 @@ def delete( # pylint: disable=inconsistent-return-statements config_name=config_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/operations/_managed_clusters_operations.py index 2b633f61e103..9ac85fbf9349 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/operations/_managed_clusters_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -36,9 +36,12 @@ def build_get_os_options_request( resource_type: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default") # pylint: disable=line-too-long path_format_arguments = { @@ -49,20 +52,18 @@ def build_get_os_options_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if resource_type is not None: - _query_parameters['resource-type'] = _SERIALIZER.query("resource_type", resource_type, 'str') + _params['resource-type'] = _SERIALIZER.query("resource_type", resource_type, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -71,9 +72,12 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters") path_format_arguments = { @@ -83,18 +87,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -104,9 +106,12 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters") # pylint: disable=line-too-long path_format_arguments = { @@ -117,18 +122,16 @@ def build_list_by_resource_group_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -139,9 +142,12 @@ def build_get_upgrade_profile_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default") # pylint: disable=line-too-long path_format_arguments = { @@ -153,18 +159,16 @@ def build_get_upgrade_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -176,9 +180,12 @@ def build_get_access_profile_request( role_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -191,18 +198,16 @@ def build_get_access_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -216,9 +221,12 @@ def build_list_cluster_admin_credentials_request( format: Optional[Union[str, "_models.Format"]] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -230,22 +238,20 @@ def build_list_cluster_admin_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if server_fqdn is not None: - _query_parameters['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') if format is not None: - _query_parameters['format'] = _SERIALIZER.query("format", format, 'str') + _params['format'] = _SERIALIZER.query("format", format, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -258,9 +264,12 @@ def build_list_cluster_user_credentials_request( server_fqdn: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -272,20 +281,18 @@ def build_list_cluster_user_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if server_fqdn is not None: - _query_parameters['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -298,9 +305,12 @@ def build_list_cluster_monitoring_user_credentials_request( server_fqdn: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -312,20 +322,18 @@ def build_list_cluster_monitoring_user_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if server_fqdn is not None: - _query_parameters['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -336,9 +344,12 @@ def build_get_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -350,18 +361,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -371,14 +380,17 @@ def build_create_or_update_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedCluster] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -390,20 +402,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -415,14 +425,17 @@ def build_update_tags_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.TagsObject] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -434,20 +447,18 @@ def build_update_tags_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -460,9 +471,12 @@ def build_delete_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -474,18 +488,16 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -495,14 +507,17 @@ def build_reset_service_principal_profile_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedClusterServicePrincipalProfile] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile") # pylint: disable=line-too-long path_format_arguments = { @@ -514,20 +529,18 @@ def build_reset_service_principal_profile_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -539,14 +552,17 @@ def build_reset_aad_profile_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedClusterAADProfile] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile") # pylint: disable=line-too-long path_format_arguments = { @@ -558,20 +574,18 @@ def build_reset_aad_profile_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -584,9 +598,12 @@ def build_rotate_cluster_certificates_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates") # pylint: disable=line-too-long path_format_arguments = { @@ -598,18 +615,16 @@ def build_rotate_cluster_certificates_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -620,9 +635,12 @@ def build_stop_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop") # pylint: disable=line-too-long path_format_arguments = { @@ -634,18 +652,16 @@ def build_stop_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -656,9 +672,12 @@ def build_start_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start") # pylint: disable=line-too-long path_format_arguments = { @@ -670,18 +689,16 @@ def build_start_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -691,14 +708,17 @@ def build_run_command_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.RunCommandRequest] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand") # pylint: disable=line-too-long path_format_arguments = { @@ -710,20 +730,18 @@ def build_run_command_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -737,9 +755,12 @@ def build_get_command_result_request( command_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}") # pylint: disable=line-too-long path_format_arguments = { @@ -752,18 +773,16 @@ def build_get_command_result_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -774,9 +793,12 @@ def build_list_outbound_network_dependencies_endpoints_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints") # pylint: disable=line-too-long path_format_arguments = { @@ -788,42 +810,38 @@ def build_list_outbound_network_dependencies_endpoints_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class ManagedClustersOperations(object): # pylint: disable=too-many-public-methods - """ManagedClustersOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ManagedClustersOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_01_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_01_02_preview.ContainerServiceClient`'s + :attr:`managed_clusters` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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_os_options( @@ -831,7 +849,7 @@ def get_os_options( location: str, resource_type: Optional[str] = None, **kwargs: Any - ) -> "_models.OSOptionProfile": + ) -> _models.OSOptionProfile: """Gets supported OS options in the specified subscription. Gets supported OS options in the specified subscription. @@ -846,13 +864,16 @@ def get_os_options( :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.OSOptionProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OSOptionProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OSOptionProfile] request = build_get_os_options_request( @@ -861,11 +882,13 @@ def get_os_options( api_version=api_version, resource_type=resource_type, template_url=self.get_os_options.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -890,7 +913,7 @@ def get_os_options( def list( self, **kwargs: Any - ) -> Iterable["_models.ManagedClusterListResult"]: + ) -> Iterable[_models.ManagedClusterListResult]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. @@ -902,13 +925,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_01_02_preview.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -916,9 +942,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -926,9 +954,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -966,7 +996,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.ManagedClusterListResult"]: + ) -> Iterable[_models.ManagedClusterListResult]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. @@ -980,13 +1010,16 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_01_02_preview.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -995,9 +1028,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -1006,9 +1041,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -1047,7 +1084,7 @@ def get_upgrade_profile( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedClusterUpgradeProfile": + ) -> _models.ManagedClusterUpgradeProfile: """Gets the upgrade profile of a managed cluster. Gets the upgrade profile of a managed cluster. @@ -1061,13 +1098,16 @@ def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.ManagedClusterUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] request = build_get_upgrade_profile_request( @@ -1076,11 +1116,13 @@ def get_upgrade_profile( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1108,7 +1150,7 @@ def get_access_profile( resource_name: str, role_name: str, **kwargs: Any - ) -> "_models.ManagedClusterAccessProfile": + ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. **WARNING**\ : This API will be deprecated. Instead use `ListClusterUserCredentials @@ -1127,13 +1169,16 @@ def get_access_profile( :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.ManagedClusterAccessProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterAccessProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] request = build_get_access_profile_request( @@ -1143,11 +1188,13 @@ def get_access_profile( role_name=role_name, api_version=api_version, template_url=self.get_access_profile.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1176,7 +1223,7 @@ def list_cluster_admin_credentials( server_fqdn: Optional[str] = None, format: Optional[Union[str, "_models.Format"]] = None, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Lists the admin credentials of a managed cluster. Lists the admin credentials of a managed cluster. @@ -1196,13 +1243,16 @@ def list_cluster_admin_credentials( :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_admin_credentials_request( @@ -1213,11 +1263,13 @@ def list_cluster_admin_credentials( server_fqdn=server_fqdn, format=format, template_url=self.list_cluster_admin_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1245,7 +1297,7 @@ def list_cluster_user_credentials( resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Lists the user credentials of a managed cluster. Lists the user credentials of a managed cluster. @@ -1261,13 +1313,16 @@ def list_cluster_user_credentials( :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_user_credentials_request( @@ -1277,11 +1332,13 @@ def list_cluster_user_credentials( api_version=api_version, server_fqdn=server_fqdn, template_url=self.list_cluster_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1309,7 +1366,7 @@ def list_cluster_monitoring_user_credentials( resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Lists the cluster monitoring user credentials of a managed cluster. Lists the cluster monitoring user credentials of a managed cluster. @@ -1325,13 +1382,16 @@ def list_cluster_monitoring_user_credentials( :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_monitoring_user_credentials_request( @@ -1341,11 +1401,13 @@ def list_cluster_monitoring_user_credentials( api_version=api_version, server_fqdn=server_fqdn, template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1372,7 +1434,7 @@ def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedCluster": + ) -> _models.ManagedCluster: """Gets a managed cluster. Gets a managed cluster. @@ -1386,13 +1448,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.ManagedCluster :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] request = build_get_request( @@ -1401,11 +1466,13 @@ def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1430,17 +1497,20 @@ def _create_or_update_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-01-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'ManagedCluster') @@ -1452,11 +1522,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1486,9 +1558,9 @@ def begin_create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> LROPoller["_models.ManagedCluster"]: + ) -> LROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. Creates or updates a managed cluster. @@ -1513,37 +1585,47 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_01_02_preview.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1560,17 +1642,20 @@ def _update_tags_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-01-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'TagsObject') @@ -1582,11 +1667,13 @@ def _update_tags_initial( content_type=content_type, json=_json, template_url=self._update_tags_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1612,9 +1699,9 @@ def begin_update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> LROPoller["_models.ManagedCluster"]: + ) -> LROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates tags on a managed cluster. @@ -1639,37 +1726,47 @@ def begin_update_tags( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_01_02_preview.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._update_tags_initial( + raw_result = self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1688,13 +1785,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -1703,11 +1803,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1751,20 +1853,25 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_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) @@ -1774,8 +1881,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1792,17 +1905,20 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-01-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') @@ -1814,11 +1930,13 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re content_type=content_type, json=_json, template_url=self._reset_service_principal_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1840,7 +1958,7 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> LROPoller[None]: """Reset the Service Principal Profile of a managed cluster. @@ -1866,23 +1984,28 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._reset_service_principal_profile_initial( + raw_result = self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1892,8 +2015,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1910,17 +2039,20 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') @@ -1932,11 +2064,13 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement content_type=content_type, json=_json, template_url=self._reset_aad_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1958,7 +2092,7 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> LROPoller[None]: """Reset the AAD Profile of a managed cluster. @@ -1984,23 +2118,28 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._reset_aad_profile_initial( + raw_result = self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -2010,8 +2149,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2030,13 +2175,16 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_rotate_cluster_certificates_request_initial( @@ -2045,11 +2193,13 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return resource_name=resource_name, api_version=api_version, template_url=self._rotate_cluster_certificates_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2094,20 +2244,25 @@ def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-st :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._rotate_cluster_certificates_initial( + raw_result = self._rotate_cluster_certificates_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) @@ -2117,8 +2272,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2137,13 +2298,16 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_stop_request_initial( @@ -2152,11 +2316,13 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_name, api_version=api_version, template_url=self._stop_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2204,20 +2370,25 @@ def begin_stop( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._stop_initial( + raw_result = self._stop_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) @@ -2227,8 +2398,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2247,13 +2424,16 @@ def _start_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_start_request_initial( @@ -2262,11 +2442,13 @@ def _start_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_name, api_version=api_version, template_url=self._start_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2311,20 +2493,25 @@ def begin_start( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._start_initial( + raw_result = self._start_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) @@ -2334,8 +2521,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2352,17 +2545,20 @@ def _run_command_initial( self, resource_group_name: str, resource_name: str, - request_payload: "_models.RunCommandRequest", + request_payload: _models.RunCommandRequest, **kwargs: Any - ) -> Optional["_models.RunCommandResult"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RunCommandResult"]] + ) -> Optional[_models.RunCommandResult]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-01-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] _json = self._serialize.body(request_payload, 'RunCommandRequest') @@ -2374,11 +2570,13 @@ def _run_command_initial( content_type=content_type, json=_json, template_url=self._run_command_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2406,9 +2604,9 @@ def begin_run_command( self, resource_group_name: str, resource_name: str, - request_payload: "_models.RunCommandRequest", + request_payload: _models.RunCommandRequest, **kwargs: Any - ) -> LROPoller["_models.RunCommandResult"]: + ) -> LROPoller[_models.RunCommandResult]: """Submits a command to run against the Managed Cluster. AKS will create a pod to run the command. This is primarily useful for private clusters. For @@ -2436,37 +2634,47 @@ def begin_run_command( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_01_02_preview.models.RunCommandResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.RunCommandResult] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._run_command_initial( + raw_result = self._run_command_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, request_payload=request_payload, 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): - response = pipeline_response.http_response deserialized = self._deserialize('RunCommandResult', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2486,7 +2694,7 @@ def get_command_result( resource_name: str, command_id: str, **kwargs: Any - ) -> Optional["_models.RunCommandResult"]: + ) -> Optional[_models.RunCommandResult]: """Gets the results of a command which has been run on the Managed Cluster. Gets the results of a command which has been run on the Managed Cluster. @@ -2502,13 +2710,16 @@ def get_command_result( :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.RunCommandResult or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RunCommandResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] request = build_get_command_result_request( @@ -2518,11 +2729,13 @@ def get_command_result( command_id=command_id, api_version=api_version, template_url=self.get_command_result.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2551,7 +2764,7 @@ def list_outbound_network_dependencies_endpoints( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Iterable["_models.OutboundEnvironmentEndpointCollection"]: + ) -> Iterable[_models.OutboundEnvironmentEndpointCollection]: """Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. @@ -2569,13 +2782,16 @@ def list_outbound_network_dependencies_endpoints( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_01_02_preview.models.OutboundEnvironmentEndpointCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OutboundEnvironmentEndpointCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -2585,9 +2801,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=self.list_outbound_network_dependencies_endpoints.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -2597,9 +2815,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/operations/_operations.py index dc426f32bf20..baca194ac48b 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/operations/_operations.py @@ -16,6 +16,7 @@ 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 @@ -29,55 +30,54 @@ def build_list_request( **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.ContainerService/operations") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class Operations(object): - """Operations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_01_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_01_02_preview.ContainerServiceClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> Iterable["_models.OperationListResult"]: + ) -> Iterable[_models.OperationListResult]: """Gets a list of operations. Gets a list of operations. @@ -88,31 +88,38 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_01_02_preview.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/operations/_private_endpoint_connections_operations.py index 79adbabdcbf4..b627f5767465 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/operations/_private_endpoint_connections_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast from msrest import Serializer @@ -16,13 +16,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -34,9 +34,12 @@ def build_list_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections") # pylint: disable=line-too-long path_format_arguments = { @@ -48,18 +51,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -71,9 +72,12 @@ def build_get_request( private_endpoint_connection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -86,18 +90,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -108,14 +110,17 @@ def build_update_request( resource_name: str, private_endpoint_connection_name: str, *, - json: JSONType = None, + json: Optional[_models.PrivateEndpointConnection] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -128,20 +133,18 @@ def build_update_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -155,9 +158,12 @@ def build_delete_request_initial( private_endpoint_connection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -170,42 +176,38 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class PrivateEndpointConnectionsOperations(object): - """PrivateEndpointConnectionsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class PrivateEndpointConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_01_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_01_02_preview.ContainerServiceClient`'s + :attr:`private_endpoint_connections` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -213,7 +215,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnectionListResult": + ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. To learn more about private clusters, see: @@ -229,13 +231,16 @@ def list( ~azure.mgmt.containerservice.v2022_01_02_preview.models.PrivateEndpointConnectionListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] request = build_list_request( @@ -244,11 +249,13 @@ def list( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -276,7 +283,7 @@ def get( resource_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Gets the specified private endpoint connection. To learn more about private clusters, see: @@ -293,13 +300,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] request = build_get_request( @@ -309,11 +319,13 @@ def get( private_endpoint_connection_name=private_endpoint_connection_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -340,9 +352,9 @@ def update( resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - parameters: "_models.PrivateEndpointConnection", + parameters: _models.PrivateEndpointConnection, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. Updates a private endpoint connection. @@ -361,14 +373,17 @@ def update( :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] _json = self._serialize.body(parameters, 'PrivateEndpointConnection') @@ -381,11 +396,13 @@ def update( content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -413,13 +430,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -429,11 +449,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name=private_endpoint_connection_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -480,21 +502,26 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -504,8 +531,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/operations/_private_link_resources_operations.py index 6eca78ac7e66..32f47842d674 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/operations/_private_link_resources_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/operations/_private_link_resources_operations.py @@ -15,6 +15,7 @@ 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 @@ -31,9 +32,12 @@ def build_list_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources") # pylint: disable=line-too-long path_format_arguments = { @@ -45,42 +49,38 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class PrivateLinkResourcesOperations(object): - """PrivateLinkResourcesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class PrivateLinkResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_01_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_01_02_preview.ContainerServiceClient`'s + :attr:`private_link_resources` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -88,7 +88,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.PrivateLinkResourcesListResult": + ) -> _models.PrivateLinkResourcesListResult: """Gets a list of private link resources in the specified managed cluster. To learn more about private clusters, see: @@ -103,13 +103,16 @@ def list( :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.PrivateLinkResourcesListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourcesListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] request = build_list_request( @@ -118,11 +121,13 @@ def list( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/operations/_resolve_private_link_service_id_operations.py index eba78d7c005d..e68c052e8fe3 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/operations/_resolve_private_link_service_id_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/operations/_resolve_private_link_service_id_operations.py @@ -15,12 +15,12 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -31,14 +31,17 @@ def build_post_request( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.PrivateLinkResource] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId") # pylint: disable=line-too-long path_format_arguments = { @@ -50,55 +53,51 @@ def build_post_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs ) -class ResolvePrivateLinkServiceIdOperations(object): - """ResolvePrivateLinkServiceIdOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ResolvePrivateLinkServiceIdOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_01_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_01_02_preview.ContainerServiceClient`'s + :attr:`resolve_private_link_service_id` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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 post( self, resource_group_name: str, resource_name: str, - parameters: "_models.PrivateLinkResource", + parameters: _models.PrivateLinkResource, **kwargs: Any - ) -> "_models.PrivateLinkResource": + ) -> _models.PrivateLinkResource: """Gets the private link service ID for the specified managed cluster. Gets the private link service ID for the specified managed cluster. @@ -114,14 +113,17 @@ def post( :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.PrivateLinkResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-01-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] _json = self._serialize.body(parameters, 'PrivateLinkResource') @@ -133,11 +135,13 @@ def post( content_type=content_type, json=_json, template_url=self.post.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/operations/_snapshots_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/operations/_snapshots_operations.py index ed743fd87c04..e8e5d4d31ae7 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/operations/_snapshots_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_02_preview/operations/_snapshots_operations.py @@ -16,12 +16,12 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -31,9 +31,12 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots") path_format_arguments = { @@ -43,18 +46,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -64,9 +65,12 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots") # pylint: disable=line-too-long path_format_arguments = { @@ -77,18 +81,16 @@ def build_list_by_resource_group_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -99,9 +101,12 @@ def build_get_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -113,18 +118,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -134,14 +137,17 @@ def build_create_or_update_request( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.Snapshot] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -153,20 +159,18 @@ def build_create_or_update_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -178,14 +182,17 @@ def build_update_tags_request( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.TagsObject] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -197,20 +204,18 @@ def build_update_tags_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -223,9 +228,12 @@ def build_delete_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -237,48 +245,44 @@ def build_delete_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class SnapshotsOperations(object): - """SnapshotsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class SnapshotsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_01_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_01_02_preview.ContainerServiceClient`'s + :attr:`snapshots` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> Iterable["_models.SnapshotListResult"]: + ) -> Iterable[_models.SnapshotListResult]: """Gets a list of snapshots in the specified subscription. Gets a list of snapshots in the specified subscription. @@ -289,13 +293,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_01_02_preview.models.SnapshotListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -303,9 +310,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -313,9 +322,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -353,7 +364,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.SnapshotListResult"]: + ) -> Iterable[_models.SnapshotListResult]: """Lists snapshots in the specified subscription and resource group. Lists snapshots in the specified subscription and resource group. @@ -366,13 +377,16 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_01_02_preview.models.SnapshotListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -381,9 +395,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -392,9 +408,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -433,7 +451,7 @@ def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.Snapshot": + ) -> _models.Snapshot: """Gets a snapshot. Gets a snapshot. @@ -447,13 +465,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.Snapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] request = build_get_request( @@ -462,11 +483,13 @@ def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -492,9 +515,9 @@ def create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.Snapshot", + parameters: _models.Snapshot, **kwargs: Any - ) -> "_models.Snapshot": + ) -> _models.Snapshot: """Creates or updates a snapshot. Creates or updates a snapshot. @@ -510,14 +533,17 @@ def create_or_update( :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.Snapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-01-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] _json = self._serialize.body(parameters, 'Snapshot') @@ -529,11 +555,13 @@ def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -563,9 +591,9 @@ def update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.Snapshot": + ) -> _models.Snapshot: """Updates tags on a snapshot. Updates tags on a snapshot. @@ -581,14 +609,17 @@ def update_tags( :rtype: ~azure.mgmt.containerservice.v2022_01_02_preview.models.Snapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] _json = self._serialize.body(parameters, 'TagsObject') @@ -600,11 +631,13 @@ def update_tags( content_type=content_type, json=_json, template_url=self.update_tags.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -645,13 +678,16 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-01-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-01-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -660,11 +696,13 @@ def delete( # pylint: disable=inconsistent-return-statements resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/__init__.py index 53c675bd95e2..37a5f9e02e6f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._container_service_client import ContainerServiceClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['ContainerServiceClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/_container_service_client.py index 0a3fadf17251..536e9ec317ab 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/_container_service_client.py @@ -73,14 +73,30 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.managed_clusters = ManagedClustersOperations(self._client, self._config, self._serialize, self._deserialize) - self.maintenance_configurations = MaintenanceConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) - self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) - self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations(self._client, self._config, self._serialize, self._deserialize) - self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_clusters = ManagedClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.maintenance_configurations = MaintenanceConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.agent_pools = AgentPoolsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.snapshots = SnapshotsOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/__init__.py index 53c675bd95e2..37a5f9e02e6f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._container_service_client import ContainerServiceClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['ContainerServiceClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/_container_service_client.py index f1a3bace2283..766f273d7b0c 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/_container_service_client.py @@ -74,14 +74,30 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.managed_clusters = ManagedClustersOperations(self._client, self._config, self._serialize, self._deserialize) - self.maintenance_configurations = MaintenanceConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) - self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) - self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations(self._client, self._config, self._serialize, self._deserialize) - self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_clusters = ManagedClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.maintenance_configurations = MaintenanceConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.agent_pools = AgentPoolsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.snapshots = SnapshotsOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/operations/__init__.py index 5e1e5e72fa59..e0748876288c 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/operations/__init__.py @@ -15,6 +15,9 @@ from ._resolve_private_link_service_id_operations import ResolvePrivateLinkServiceIdOperations from ._snapshots_operations import SnapshotsOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'Operations', 'ManagedClustersOperations', @@ -25,3 +28,5 @@ 'ResolvePrivateLinkServiceIdOperations', 'SnapshotsOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/operations/_agent_pools_operations.py index e3bdb708ea0e..afc340cad47d 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/operations/_agent_pools_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. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ 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 @@ -26,26 +27,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class AgentPoolsOperations: - """AgentPoolsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_02_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_02_01.aio.ContainerServiceClient`'s + :attr:`agent_pools` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -53,7 +52,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> AsyncIterable["_models.AgentPoolListResult"]: + ) -> AsyncIterable[_models.AgentPoolListResult]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. @@ -68,13 +67,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_02_01.models.AgentPoolListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -84,9 +86,11 @@ def prepare_request(next_link=None): resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -96,9 +100,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -138,7 +144,7 @@ async def get( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPool": + ) -> _models.AgentPool: """Gets the specified managed cluster agent pool. Gets the specified managed cluster agent pool. @@ -154,13 +160,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.AgentPool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] request = build_get_request( @@ -170,11 +179,13 @@ async def get( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -200,17 +211,20 @@ async def _create_or_update_initial( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> "_models.AgentPool": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] + ) -> _models.AgentPool: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] _json = self._serialize.body(parameters, 'AgentPool') @@ -223,11 +237,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -258,9 +274,9 @@ async def begin_create_or_update( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> AsyncLROPoller["_models.AgentPool"]: + ) -> AsyncLROPoller[_models.AgentPool]: """Creates or updates an agent pool in the specified managed cluster. Creates or updates an agent pool in the specified managed cluster. @@ -287,17 +303,20 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_02_01.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, @@ -305,20 +324,27 @@ async def begin_create_or_update( 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): - response = pipeline_response.http_response deserialized = self._deserialize('AgentPool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -338,13 +364,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements agent_pool_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -354,11 +383,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -405,21 +436,26 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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) @@ -429,8 +465,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -450,7 +492,7 @@ async def get_upgrade_profile( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPoolUpgradeProfile": + ) -> _models.AgentPoolUpgradeProfile: """Gets the upgrade profile for an agent pool. Gets the upgrade profile for an agent pool. @@ -466,13 +508,16 @@ async def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.AgentPoolUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] request = build_get_upgrade_profile_request( @@ -482,11 +527,13 @@ async def get_upgrade_profile( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -513,7 +560,7 @@ async def get_available_agent_pool_versions( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.AgentPoolAvailableVersions": + ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported Kubernetes versions for the specified agent pool. See `supported Kubernetes versions @@ -529,13 +576,16 @@ async def get_available_agent_pool_versions( :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.AgentPoolAvailableVersions :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolAvailableVersions"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] request = build_get_available_agent_pool_versions_request( @@ -544,11 +594,13 @@ async def get_available_agent_pool_versions( resource_name=resource_name, api_version=api_version, template_url=self.get_available_agent_pool_versions.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -575,14 +627,17 @@ async def _upgrade_node_image_version_initial( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> Optional["_models.AgentPool"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.AgentPool"]] + ) -> Optional[_models.AgentPool]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] request = build_upgrade_node_image_version_request_initial( @@ -592,11 +647,13 @@ async def _upgrade_node_image_version_initial( agent_pool_name=agent_pool_name, api_version=api_version, template_url=self._upgrade_node_image_version_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -629,7 +686,7 @@ async def begin_upgrade_node_image_version( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> AsyncLROPoller["_models.AgentPool"]: + ) -> AsyncLROPoller[_models.AgentPool]: """Upgrades the node image version of an agent pool to the latest. Upgrading the node image version of an agent pool applies the newest OS and runtime updates to @@ -656,21 +713,26 @@ async def begin_upgrade_node_image_version( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_02_01.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._upgrade_node_image_version_initial( + raw_result = await self._upgrade_node_image_version_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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) @@ -686,8 +748,14 @@ def get_long_running_output(pipeline_response): return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/operations/_maintenance_configurations_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/operations/_maintenance_configurations_operations.py index 8fc8f0999d57..44711e0f7b9c 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/operations/_maintenance_configurations_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/operations/_maintenance_configurations_operations.py @@ -15,6 +15,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -24,26 +25,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class MaintenanceConfigurationsOperations: - """MaintenanceConfigurationsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_02_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_02_01.aio.ContainerServiceClient`'s + :attr:`maintenance_configurations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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_by_managed_cluster( @@ -51,7 +50,7 @@ def list_by_managed_cluster( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> AsyncIterable["_models.MaintenanceConfigurationListResult"]: + ) -> AsyncIterable[_models.MaintenanceConfigurationListResult]: """Gets a list of maintenance configurations in the specified managed cluster. Gets a list of maintenance configurations in the specified managed cluster. @@ -67,13 +66,16 @@ def list_by_managed_cluster( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_02_01.models.MaintenanceConfigurationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfigurationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfigurationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -83,9 +85,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=self.list_by_managed_cluster.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -95,9 +99,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -137,7 +143,7 @@ async def get( resource_name: str, config_name: str, **kwargs: Any - ) -> "_models.MaintenanceConfiguration": + ) -> _models.MaintenanceConfiguration: """Gets the specified maintenance configuration of a managed cluster. Gets the specified maintenance configuration of a managed cluster. @@ -153,13 +159,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.MaintenanceConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfiguration"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] request = build_get_request( @@ -169,11 +178,13 @@ async def get( config_name=config_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -200,9 +211,9 @@ async def create_or_update( resource_group_name: str, resource_name: str, config_name: str, - parameters: "_models.MaintenanceConfiguration", + parameters: _models.MaintenanceConfiguration, **kwargs: Any - ) -> "_models.MaintenanceConfiguration": + ) -> _models.MaintenanceConfiguration: """Creates or updates a maintenance configuration in the specified managed cluster. Creates or updates a maintenance configuration in the specified managed cluster. @@ -220,14 +231,17 @@ async def create_or_update( :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.MaintenanceConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfiguration"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] _json = self._serialize.body(parameters, 'MaintenanceConfiguration') @@ -240,11 +254,13 @@ async def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -288,13 +304,16 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -304,11 +323,13 @@ async def delete( # pylint: disable=inconsistent-return-statements config_name=config_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/operations/_managed_clusters_operations.py index d4e09f103ae0..be5ee6420fcc 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/operations/_managed_clusters_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. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ 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 @@ -26,26 +27,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ManagedClustersOperations: # pylint: disable=too-many-public-methods - """ManagedClustersOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_02_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_02_01.aio.ContainerServiceClient`'s + :attr:`managed_clusters` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace_async async def get_os_options( @@ -53,7 +52,7 @@ async def get_os_options( location: str, resource_type: Optional[str] = None, **kwargs: Any - ) -> "_models.OSOptionProfile": + ) -> _models.OSOptionProfile: """Gets supported OS options in the specified subscription. Gets supported OS options in the specified subscription. @@ -68,13 +67,16 @@ async def get_os_options( :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.OSOptionProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OSOptionProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OSOptionProfile] request = build_get_os_options_request( @@ -83,11 +85,13 @@ async def get_os_options( api_version=api_version, resource_type=resource_type, template_url=self.get_os_options.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -112,7 +116,7 @@ async def get_os_options( def list( self, **kwargs: Any - ) -> AsyncIterable["_models.ManagedClusterListResult"]: + ) -> AsyncIterable[_models.ManagedClusterListResult]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. @@ -124,13 +128,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_02_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -138,9 +145,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -148,9 +157,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -188,7 +199,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ManagedClusterListResult"]: + ) -> AsyncIterable[_models.ManagedClusterListResult]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. @@ -202,13 +213,16 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_02_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -217,9 +231,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -228,9 +244,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -269,7 +287,7 @@ async def get_upgrade_profile( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedClusterUpgradeProfile": + ) -> _models.ManagedClusterUpgradeProfile: """Gets the upgrade profile of a managed cluster. Gets the upgrade profile of a managed cluster. @@ -283,13 +301,16 @@ async def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.ManagedClusterUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] request = build_get_upgrade_profile_request( @@ -298,11 +319,13 @@ async def get_upgrade_profile( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -330,7 +353,7 @@ async def get_access_profile( resource_name: str, role_name: str, **kwargs: Any - ) -> "_models.ManagedClusterAccessProfile": + ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. **WARNING**\ : This API will be deprecated. Instead use `ListClusterUserCredentials @@ -349,13 +372,16 @@ async def get_access_profile( :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.ManagedClusterAccessProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterAccessProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] request = build_get_access_profile_request( @@ -365,11 +391,13 @@ async def get_access_profile( role_name=role_name, api_version=api_version, template_url=self.get_access_profile.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -397,7 +425,7 @@ async def list_cluster_admin_credentials( resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Lists the admin credentials of a managed cluster. Lists the admin credentials of a managed cluster. @@ -413,13 +441,16 @@ async def list_cluster_admin_credentials( :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_admin_credentials_request( @@ -429,11 +460,13 @@ async def list_cluster_admin_credentials( api_version=api_version, server_fqdn=server_fqdn, template_url=self.list_cluster_admin_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -462,7 +495,7 @@ async def list_cluster_user_credentials( server_fqdn: Optional[str] = None, format: Optional[Union[str, "_models.Format"]] = None, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Lists the user credentials of a managed cluster. Lists the user credentials of a managed cluster. @@ -482,13 +515,16 @@ async def list_cluster_user_credentials( :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_user_credentials_request( @@ -499,11 +535,13 @@ async def list_cluster_user_credentials( server_fqdn=server_fqdn, format=format, template_url=self.list_cluster_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -531,7 +569,7 @@ async def list_cluster_monitoring_user_credentials( resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Lists the cluster monitoring user credentials of a managed cluster. Lists the cluster monitoring user credentials of a managed cluster. @@ -547,13 +585,16 @@ async def list_cluster_monitoring_user_credentials( :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_monitoring_user_credentials_request( @@ -563,11 +604,13 @@ async def list_cluster_monitoring_user_credentials( api_version=api_version, server_fqdn=server_fqdn, template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -594,7 +637,7 @@ async def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedCluster": + ) -> _models.ManagedCluster: """Gets a managed cluster. Gets a managed cluster. @@ -608,13 +651,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.ManagedCluster :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] request = build_get_request( @@ -623,11 +669,13 @@ async def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -652,17 +700,20 @@ async def _create_or_update_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'ManagedCluster') @@ -674,11 +725,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -708,9 +761,9 @@ async def begin_create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> AsyncLROPoller["_models.ManagedCluster"]: + ) -> AsyncLROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. Creates or updates a managed cluster. @@ -735,37 +788,47 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_02_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -782,17 +845,20 @@ async def _update_tags_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'TagsObject') @@ -804,11 +870,13 @@ async def _update_tags_initial( content_type=content_type, json=_json, template_url=self._update_tags_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -834,9 +902,9 @@ async def begin_update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> AsyncLROPoller["_models.ManagedCluster"]: + ) -> AsyncLROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates tags on a managed cluster. @@ -861,37 +929,47 @@ async def begin_update_tags( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_02_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._update_tags_initial( + raw_result = await self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -910,13 +988,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -925,11 +1006,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -973,20 +1056,25 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_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) @@ -996,8 +1084,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1014,17 +1108,20 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') @@ -1036,11 +1133,13 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist content_type=content_type, json=_json, template_url=self._reset_service_principal_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1062,7 +1161,7 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> AsyncLROPoller[None]: """Reset the Service Principal Profile of a managed cluster. @@ -1088,23 +1187,28 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._reset_service_principal_profile_initial( + raw_result = await self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1114,8 +1218,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1132,17 +1242,20 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') @@ -1154,11 +1267,13 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta content_type=content_type, json=_json, template_url=self._reset_aad_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1180,7 +1295,7 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> AsyncLROPoller[None]: """Reset the AAD Profile of a managed cluster. @@ -1205,23 +1320,28 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._reset_aad_profile_initial( + raw_result = await self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1231,8 +1351,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1251,13 +1377,16 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_rotate_cluster_certificates_request_initial( @@ -1266,11 +1395,13 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- resource_name=resource_name, api_version=api_version, template_url=self._rotate_cluster_certificates_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1315,20 +1446,25 @@ async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-ret :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._rotate_cluster_certificates_initial( + raw_result = await self._rotate_cluster_certificates_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) @@ -1338,8 +1474,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1358,13 +1500,16 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_stop_request_initial( @@ -1373,11 +1518,13 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_name, api_version=api_version, template_url=self._stop_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1425,20 +1572,25 @@ async def begin_stop( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._stop_initial( + raw_result = await self._stop_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) @@ -1448,8 +1600,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1468,13 +1626,16 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_start_request_initial( @@ -1483,11 +1644,13 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_name, api_version=api_version, template_url=self._start_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1532,20 +1695,25 @@ async def begin_start( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._start_initial( + raw_result = await self._start_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) @@ -1555,8 +1723,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1573,17 +1747,20 @@ async def _run_command_initial( self, resource_group_name: str, resource_name: str, - request_payload: "_models.RunCommandRequest", + request_payload: _models.RunCommandRequest, **kwargs: Any - ) -> Optional["_models.RunCommandResult"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RunCommandResult"]] + ) -> Optional[_models.RunCommandResult]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] _json = self._serialize.body(request_payload, 'RunCommandRequest') @@ -1595,11 +1772,13 @@ async def _run_command_initial( content_type=content_type, json=_json, template_url=self._run_command_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1627,9 +1806,9 @@ async def begin_run_command( self, resource_group_name: str, resource_name: str, - request_payload: "_models.RunCommandRequest", + request_payload: _models.RunCommandRequest, **kwargs: Any - ) -> AsyncLROPoller["_models.RunCommandResult"]: + ) -> AsyncLROPoller[_models.RunCommandResult]: """Submits a command to run against the Managed Cluster. AKS will create a pod to run the command. This is primarily useful for private clusters. For @@ -1656,37 +1835,47 @@ async def begin_run_command( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_02_01.models.RunCommandResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.RunCommandResult] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._run_command_initial( + raw_result = await self._run_command_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, request_payload=request_payload, 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): - response = pipeline_response.http_response deserialized = self._deserialize('RunCommandResult', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1706,7 +1895,7 @@ async def get_command_result( resource_name: str, command_id: str, **kwargs: Any - ) -> Optional["_models.RunCommandResult"]: + ) -> Optional[_models.RunCommandResult]: """Gets the results of a command which has been run on the Managed Cluster. Gets the results of a command which has been run on the Managed Cluster. @@ -1722,13 +1911,16 @@ async def get_command_result( :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.RunCommandResult or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RunCommandResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] request = build_get_command_result_request( @@ -1738,11 +1930,13 @@ async def get_command_result( command_id=command_id, api_version=api_version, template_url=self.get_command_result.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1771,7 +1965,7 @@ def list_outbound_network_dependencies_endpoints( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> AsyncIterable["_models.OutboundEnvironmentEndpointCollection"]: + ) -> AsyncIterable[_models.OutboundEnvironmentEndpointCollection]: """Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. @@ -1789,13 +1983,16 @@ def list_outbound_network_dependencies_endpoints( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_02_01.models.OutboundEnvironmentEndpointCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OutboundEnvironmentEndpointCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -1805,9 +2002,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=self.list_outbound_network_dependencies_endpoints.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -1817,9 +2016,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/operations/_operations.py index be45fc41030e..e6f8ca5259ae 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/operations/_operations.py @@ -14,6 +14,7 @@ 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 @@ -23,32 +24,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class Operations: - """Operations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_02_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_02_01.aio.ContainerServiceClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.OperationListResult"]: + ) -> AsyncIterable[_models.OperationListResult]: """Gets a list of operations. Gets a list of operations. @@ -59,31 +58,38 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_02_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/operations/_private_endpoint_connections_operations.py index bb0dbbd9245b..1476dca05cd9 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/operations/_private_endpoint_connections_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -14,6 +14,7 @@ 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 @@ -24,26 +25,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class PrivateEndpointConnectionsOperations: - """PrivateEndpointConnectionsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_02_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_02_01.aio.ContainerServiceClient`'s + :attr:`private_endpoint_connections` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -51,7 +50,7 @@ async def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnectionListResult": + ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. To learn more about private clusters, see: @@ -66,13 +65,16 @@ async def list( :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.PrivateEndpointConnectionListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] request = build_list_request( @@ -81,11 +83,13 @@ async def list( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -113,7 +117,7 @@ async def get( resource_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Gets the specified private endpoint connection. To learn more about private clusters, see: @@ -130,13 +134,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] request = build_get_request( @@ -146,11 +153,13 @@ async def get( private_endpoint_connection_name=private_endpoint_connection_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -177,9 +186,9 @@ async def update( resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - parameters: "_models.PrivateEndpointConnection", + parameters: _models.PrivateEndpointConnection, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. Updates a private endpoint connection. @@ -197,14 +206,17 @@ async def update( :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] _json = self._serialize.body(parameters, 'PrivateEndpointConnection') @@ -217,11 +229,13 @@ async def update( content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -249,13 +263,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -265,11 +282,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name=private_endpoint_connection_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -316,21 +335,26 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -340,8 +364,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/operations/_private_link_resources_operations.py index b630386cf184..93e417b01fb8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/operations/_private_link_resources_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/operations/_private_link_resources_operations.py @@ -13,6 +13,7 @@ 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 @@ -22,26 +23,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class PrivateLinkResourcesOperations: - """PrivateLinkResourcesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_02_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_02_01.aio.ContainerServiceClient`'s + :attr:`private_link_resources` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -49,7 +48,7 @@ async def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.PrivateLinkResourcesListResult": + ) -> _models.PrivateLinkResourcesListResult: """Gets a list of private link resources in the specified managed cluster. To learn more about private clusters, see: @@ -64,13 +63,16 @@ async def list( :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.PrivateLinkResourcesListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourcesListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] request = build_list_request( @@ -79,11 +81,13 @@ async def list( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/operations/_resolve_private_link_service_id_operations.py index 9eff54e79de7..b108d8b0990f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/operations/_resolve_private_link_service_id_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/operations/_resolve_private_link_service_id_operations.py @@ -13,6 +13,7 @@ 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 @@ -22,35 +23,33 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ResolvePrivateLinkServiceIdOperations: - """ResolvePrivateLinkServiceIdOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_02_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_02_01.aio.ContainerServiceClient`'s + :attr:`resolve_private_link_service_id` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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 post( self, resource_group_name: str, resource_name: str, - parameters: "_models.PrivateLinkResource", + parameters: _models.PrivateLinkResource, **kwargs: Any - ) -> "_models.PrivateLinkResource": + ) -> _models.PrivateLinkResource: """Gets the private link service ID for the specified managed cluster. Gets the private link service ID for the specified managed cluster. @@ -66,14 +65,17 @@ async def post( :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.PrivateLinkResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] _json = self._serialize.body(parameters, 'PrivateLinkResource') @@ -85,11 +87,13 @@ async def post( content_type=content_type, json=_json, template_url=self.post.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/operations/_snapshots_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/operations/_snapshots_operations.py index 3236b2af1b4e..4085de32aac4 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/operations/_snapshots_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/aio/operations/_snapshots_operations.py @@ -15,6 +15,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -24,32 +25,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class SnapshotsOperations: - """SnapshotsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_02_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_02_01.aio.ContainerServiceClient`'s + :attr:`snapshots` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.SnapshotListResult"]: + ) -> AsyncIterable[_models.SnapshotListResult]: """Gets a list of snapshots in the specified subscription. Gets a list of snapshots in the specified subscription. @@ -60,13 +59,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_02_01.models.SnapshotListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -74,9 +76,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -84,9 +88,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -124,7 +130,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.SnapshotListResult"]: + ) -> AsyncIterable[_models.SnapshotListResult]: """Lists snapshots in the specified subscription and resource group. Lists snapshots in the specified subscription and resource group. @@ -137,13 +143,16 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_02_01.models.SnapshotListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -152,9 +161,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -163,9 +174,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -204,7 +217,7 @@ async def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.Snapshot": + ) -> _models.Snapshot: """Gets a snapshot. Gets a snapshot. @@ -218,13 +231,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.Snapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] request = build_get_request( @@ -233,11 +249,13 @@ async def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -263,9 +281,9 @@ async def create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.Snapshot", + parameters: _models.Snapshot, **kwargs: Any - ) -> "_models.Snapshot": + ) -> _models.Snapshot: """Creates or updates a snapshot. Creates or updates a snapshot. @@ -281,14 +299,17 @@ async def create_or_update( :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.Snapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] _json = self._serialize.body(parameters, 'Snapshot') @@ -300,11 +321,13 @@ async def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -334,9 +357,9 @@ async def update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.Snapshot": + ) -> _models.Snapshot: """Updates tags on a snapshot. Updates tags on a snapshot. @@ -352,14 +375,17 @@ async def update_tags( :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.Snapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] _json = self._serialize.body(parameters, 'TagsObject') @@ -371,11 +397,13 @@ async def update_tags( content_type=content_type, json=_json, template_url=self.update_tags.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -416,13 +444,16 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -431,11 +462,13 @@ async def delete( # pylint: disable=inconsistent-return-statements resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/models/__init__.py index ed24d714f832..1527884a3c86 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/models/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/models/__init__.py @@ -132,7 +132,9 @@ WeekDay, WorkloadRuntime, ) - +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'AgentPool', 'AgentPoolAvailableVersions', @@ -257,3 +259,5 @@ 'WeekDay', 'WorkloadRuntime', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/models/_container_service_client_enums.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/models/_container_service_client_enums.py index aa3de5ebe54e..cb066b7fffcc 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/models/_container_service_client_enums.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/models/_container_service_client_enums.py @@ -7,11 +7,10 @@ # -------------------------------------------------------------------------- from enum import Enum -from six import with_metaclass from azure.core import CaseInsensitiveEnumMeta -class AgentPoolMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class AgentPoolMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: https://docs.microsoft.com/azure/aks/use-system-pools @@ -24,7 +23,7 @@ class AgentPoolMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: User agent pools are primarily for hosting your application pods. USER = "User" -class AgentPoolType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class AgentPoolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of Agent Pool. """ @@ -33,7 +32,7 @@ class AgentPoolType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Use of this is strongly discouraged. AVAILABILITY_SET = "AvailabilitySet" -class Code(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class Code(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Tells whether the cluster is Running or Stopped """ @@ -42,7 +41,7 @@ class Code(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: The cluster is stopped. STOPPED = "Stopped" -class ConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The private link service connection status. """ @@ -51,7 +50,7 @@ class ConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): REJECTED = "Rejected" DISCONNECTED = "Disconnected" -class ContainerServiceStorageProfileTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Specifies what kind of storage to use. If omitted, the default will be chosen on your behalf based on the choice of orchestrator. """ @@ -59,7 +58,7 @@ class ContainerServiceStorageProfileTypes(with_metaclass(CaseInsensitiveEnumMeta STORAGE_ACCOUNT = "StorageAccount" MANAGED_DISKS = "ManagedDisks" -class ContainerServiceVMSizeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Size of agent VMs. Note: This is no longer maintained. """ @@ -238,7 +237,7 @@ class ContainerServiceVMSizeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, E STANDARD_NV24 = "Standard_NV24" STANDARD_NV6 = "Standard_NV6" -class Count(with_metaclass(CaseInsensitiveEnumMeta, int, Enum)): +class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): """Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, and 5. The default value is 1. """ @@ -247,7 +246,7 @@ class Count(with_metaclass(CaseInsensitiveEnumMeta, int, Enum)): THREE = 3 FIVE = 5 -class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of identity that created the resource. """ @@ -256,7 +255,7 @@ class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class Expander(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class Expander(str, Enum, metaclass=CaseInsensitiveEnumMeta): """If not specified, the default is 'random'. See `expanders `_ for more information. @@ -279,13 +278,13 @@ class Expander(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Used when you don't have a particular need for the node groups to scale differently. RANDOM = "random" -class ExtendedLocationTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ExtendedLocationTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of extendedLocation. """ EDGE_ZONE = "EdgeZone" -class Format(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class Format(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Return azure auth-provider kubeconfig. This format is deprecated in 1.22 and will be fully #: removed in 1.25. @@ -293,7 +292,7 @@ class Format(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Return exec format kubeconfig. This format requires kubelogin binary in the path. EXEC_ENUM = "exec" -class GPUInstanceProfile(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class GPUInstanceProfile(str, Enum, metaclass=CaseInsensitiveEnumMeta): """GPUInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU. """ @@ -303,14 +302,14 @@ class GPUInstanceProfile(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MIG4_G = "MIG4g" MIG7_G = "MIG7g" -class IpFamily(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class IpFamily(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The IP version to use for cluster networking and IP assignment. """ I_PV4 = "IPv4" I_PV6 = "IPv6" -class KubeletDiskType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class KubeletDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. """ @@ -320,7 +319,7 @@ class KubeletDiskType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Kubelet will use the temporary disk for its data. TEMPORARY = "Temporary" -class LicenseType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class LicenseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The license type to use for Windows VMs. See `Azure Hybrid User Benefits `_ for more details. """ @@ -330,7 +329,7 @@ class LicenseType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Enables Azure Hybrid User Benefits for Windows VMs. WINDOWS_SERVER = "Windows_Server" -class LoadBalancerSku(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class LoadBalancerSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the differences between load balancer SKUs. @@ -343,7 +342,7 @@ class LoadBalancerSku(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Use a basic Load Balancer with limited functionality. BASIC = "basic" -class ManagedClusterPodIdentityProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ManagedClusterPodIdentityProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The current provisioning state of the pod identity. """ @@ -352,13 +351,13 @@ class ManagedClusterPodIdentityProvisioningState(with_metaclass(CaseInsensitiveE DELETING = "Deleting" FAILED = "Failed" -class ManagedClusterSKUName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ManagedClusterSKUName(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The name of a managed cluster SKU. """ BASIC = "Basic" -class ManagedClusterSKUTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ManagedClusterSKUTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): """If not specified, the default is 'Free'. See `uptime SLA `_ for more details. """ @@ -369,7 +368,7 @@ class ManagedClusterSKUTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: No guaranteed SLA, no additional charges. Free tier clusters have an SLO of 99.5%. FREE = "Free" -class NetworkMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """This cannot be specified if networkPlugin is anything other than 'azure'. """ @@ -380,7 +379,7 @@ class NetworkMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: This is no longer supported. BRIDGE = "bridge" -class NetworkPlugin(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkPlugin(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Network plugin used for building the Kubernetes network. """ @@ -393,7 +392,7 @@ class NetworkPlugin(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: information. KUBENET = "kubenet" -class NetworkPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Network policy used for building the Kubernetes network. """ @@ -406,7 +405,7 @@ class NetworkPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: for more information. AZURE = "azure" -class OSDiskType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OSDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS @@ -422,14 +421,14 @@ class OSDiskType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: provides lower read/write latency, along with faster node scaling and cluster upgrades. EPHEMERAL = "Ephemeral" -class OSSKU(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OSSKU(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Specifies an OS SKU. This value must not be specified if OSType is Windows. """ UBUNTU = "Ubuntu" CBL_MARINER = "CBLMariner" -class OSType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The operating system type. The default is Linux. """ @@ -438,7 +437,7 @@ class OSType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Use Windows. WINDOWS = "Windows" -class OutboundType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OutboundType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type `_. """ @@ -458,7 +457,7 @@ class OutboundType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: advanced scenario and requires proper network configuration. USER_ASSIGNED_NAT_GATEWAY = "userAssignedNATGateway" -class PrivateEndpointConnectionProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class PrivateEndpointConnectionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The current provisioning state. """ @@ -467,14 +466,14 @@ class PrivateEndpointConnectionProvisioningState(with_metaclass(CaseInsensitiveE DELETING = "Deleting" FAILED = "Failed" -class PublicNetworkAccess(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class PublicNetworkAccess(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Allow or deny public network access for AKS """ ENABLED = "Enabled" DISABLED = "Disabled" -class ResourceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """For more information see `use managed identities in AKS `_. """ @@ -490,7 +489,7 @@ class ResourceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Do not use a managed identity for the Managed Cluster, service principal will be used instead. NONE = "None" -class ScaleDownMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ScaleDownMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Describes how VMs are added to or removed from Agent Pools. See `billing states `_. """ @@ -501,7 +500,7 @@ class ScaleDownMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: during scale down. DEALLOCATE = "Deallocate" -class ScaleSetEvictionPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The eviction policy specifies what to do with the VM when it is evicted. The default is Delete. For more information about eviction see `spot VMs `_ @@ -514,7 +513,7 @@ class ScaleSetEvictionPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)) #: cause issues with cluster scaling or upgrading. DEALLOCATE = "Deallocate" -class ScaleSetPriority(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ScaleSetPriority(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The Virtual Machine Scale Set priority. """ @@ -524,14 +523,14 @@ class ScaleSetPriority(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Regular VMs will be used. REGULAR = "Regular" -class SnapshotType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SnapshotType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of a snapshot. The default is NodePool. """ #: The snapshot is a snapshot of a node pool. NODE_POOL = "NodePool" -class UpgradeChannel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class UpgradeChannel(str, Enum, metaclass=CaseInsensitiveEnumMeta): """For more information see `setting the AKS cluster auto-upgrade channel `_. """ @@ -561,7 +560,7 @@ class UpgradeChannel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Disables auto-upgrades and keeps the cluster at its current version of Kubernetes. NONE = "none" -class WeekDay(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class WeekDay(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The weekday enum. """ @@ -573,7 +572,7 @@ class WeekDay(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): FRIDAY = "Friday" SATURDAY = "Saturday" -class WorkloadRuntime(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class WorkloadRuntime(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Determines the type of workload a node can run. """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/models/_models_py3.py index c5f71a244828..b745288bfa02 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/models/_models_py3.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/models/_models_py3.py @@ -7,11 +7,13 @@ # -------------------------------------------------------------------------- import datetime -from typing import Dict, List, Optional, Union +from typing import Dict, List, Optional, TYPE_CHECKING, Union import msrest.serialization -from ._container_service_client_enums import * +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + import __init__ as _models class SubResource(msrest.serialization.Model): @@ -79,15 +81,15 @@ class AgentPool(SubResource): :ivar os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS - `_. Possible values - include: "Managed", "Ephemeral". + `_. Known values are: + "Managed", "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2022_02_01.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Possible values include: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_02_01.models.KubeletDiskType - :ivar workload_runtime: Determines the type of workload a node can run. Possible values - include: "OCIContainer", "WasmWasi". + :ivar workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer", "WasmWasi". :vartype workload_runtime: str or ~azure.mgmt.containerservice.v2022_02_01.models.WorkloadRuntime :ivar vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and used. @@ -101,11 +103,11 @@ class AgentPool(SubResource): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_02_01.models.OSType - :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Possible values include: "Ubuntu", "CBLMariner". + :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known + values are: "Ubuntu", "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2022_02_01.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. :vartype max_count: int @@ -114,16 +116,15 @@ class AgentPool(SubResource): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it - defaults to Delete. Possible values include: "Delete", "Deallocate". + defaults to Delete. Known values are: "Delete", "Deallocate". :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_02_01.models.ScaleDownMode - :ivar type_properties_type: The type of Agent Pool. Possible values include: + :ivar type_properties_type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :vartype type_properties_type: str or ~azure.mgmt.containerservice.v2022_02_01.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Possible values include: "System", - "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". :vartype mode: str or ~azure.mgmt.containerservice.v2022_02_01.models.AgentPoolMode :ivar orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -158,12 +159,12 @@ class AgentPool(SubResource): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Possible values include: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_02_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Possible values include: "Delete", - "Deallocate". Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_02_01.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which @@ -195,7 +196,7 @@ class AgentPool(SubResource): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_02_01.models.GPUInstanceProfile :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool @@ -263,40 +264,40 @@ def __init__( count: Optional[int] = None, vm_size: Optional[str] = None, os_disk_size_gb: Optional[int] = None, - os_disk_type: Optional[Union[str, "OSDiskType"]] = None, - kubelet_disk_type: Optional[Union[str, "KubeletDiskType"]] = None, - workload_runtime: Optional[Union[str, "WorkloadRuntime"]] = None, + os_disk_type: Optional[Union[str, "_models.OSDiskType"]] = None, + kubelet_disk_type: Optional[Union[str, "_models.KubeletDiskType"]] = None, + workload_runtime: Optional[Union[str, "_models.WorkloadRuntime"]] = None, vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", - os_sku: Optional[Union[str, "OSSKU"]] = None, + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - scale_down_mode: Optional[Union[str, "ScaleDownMode"]] = None, - type_properties_type: Optional[Union[str, "AgentPoolType"]] = None, - mode: Optional[Union[str, "AgentPoolMode"]] = None, + scale_down_mode: Optional[Union[str, "_models.ScaleDownMode"]] = None, + type_properties_type: Optional[Union[str, "_models.AgentPoolType"]] = None, + mode: Optional[Union[str, "_models.AgentPoolMode"]] = None, orchestrator_version: Optional[str] = None, - upgrade_settings: Optional["AgentPoolUpgradeSettings"] = None, - power_state: Optional["PowerState"] = None, + upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, + power_state: Optional["_models.PowerState"] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", spot_max_price: Optional[float] = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, proximity_placement_group_id: Optional[str] = None, - kubelet_config: Optional["KubeletConfig"] = None, - linux_os_config: Optional["LinuxOSConfig"] = None, + kubelet_config: Optional["_models.KubeletConfig"] = None, + linux_os_config: Optional["_models.LinuxOSConfig"] = None, enable_encryption_at_host: Optional[bool] = None, enable_ultra_ssd: Optional[bool] = None, enable_fips: Optional[bool] = None, - gpu_instance_profile: Optional[Union[str, "GPUInstanceProfile"]] = None, - creation_data: Optional["CreationData"] = None, + gpu_instance_profile: Optional[Union[str, "_models.GPUInstanceProfile"]] = None, + creation_data: Optional["_models.CreationData"] = None, **kwargs ): """ @@ -315,15 +316,15 @@ def __init__( :keyword os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS - `_. Possible values - include: "Managed", "Ephemeral". + `_. Known values are: + "Managed", "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2022_02_01.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Possible values include: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_02_01.models.KubeletDiskType - :keyword workload_runtime: Determines the type of workload a node can run. Possible values - include: "OCIContainer", "WasmWasi". + :keyword workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer", "WasmWasi". :paramtype workload_runtime: str or ~azure.mgmt.containerservice.v2022_02_01.models.WorkloadRuntime :keyword vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and @@ -337,11 +338,11 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_02_01.models.OSType :keyword os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Possible values include: "Ubuntu", "CBLMariner". + Known values are: "Ubuntu", "CBLMariner". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2022_02_01.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -350,17 +351,16 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, - it defaults to Delete. Possible values include: "Delete", "Deallocate". + it defaults to Delete. Known values are: "Delete", "Deallocate". :paramtype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_02_01.models.ScaleDownMode - :keyword type_properties_type: The type of Agent Pool. Possible values include: + :keyword type_properties_type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type_properties_type: str or ~azure.mgmt.containerservice.v2022_02_01.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Possible values include: "System", - "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2022_02_01.models.AgentPoolMode :keyword orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -391,12 +391,12 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Possible values include: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_02_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Possible values include: "Delete", - "Deallocate". Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_02_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which @@ -428,7 +428,7 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_02_01.models.GPUInstanceProfile @@ -510,7 +510,7 @@ class AgentPoolAvailableVersions(msrest.serialization.Model): def __init__( self, *, - agent_pool_versions: Optional[List["AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem"]] = None, + agent_pool_versions: Optional[List["_models.AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem"]] = None, **kwargs ): """ @@ -587,7 +587,7 @@ class AgentPoolListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["AgentPool"]] = None, + value: Optional[List["_models.AgentPool"]] = None, **kwargs ): """ @@ -614,8 +614,8 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): :vartype type: str :ivar kubernetes_version: Required. The Kubernetes version (major.minor.patch). :vartype kubernetes_version: str - :ivar os_type: Required. The operating system type. The default is Linux. Possible values - include: "Linux", "Windows". Default value: "Linux". + :ivar os_type: Required. The operating system type. The default is Linux. Known values are: + "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_02_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -646,16 +646,16 @@ def __init__( self, *, kubernetes_version: str, - os_type: Union[str, "OSType"] = "Linux", - upgrades: Optional[List["AgentPoolUpgradeProfilePropertiesUpgradesItem"]] = None, + os_type: Union[str, "_models.OSType"] = "Linux", + upgrades: Optional[List["_models.AgentPoolUpgradeProfilePropertiesUpgradesItem"]] = None, latest_node_image_version: Optional[str] = None, **kwargs ): """ :keyword kubernetes_version: Required. The Kubernetes version (major.minor.patch). :paramtype kubernetes_version: str - :keyword os_type: Required. The operating system type. The default is Linux. Possible values - include: "Linux", "Windows". Default value: "Linux". + :keyword os_type: Required. The operating system type. The default is Linux. Known values are: + "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_02_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: @@ -767,7 +767,7 @@ def __init__( code: Optional[str] = None, message: Optional[str] = None, target: Optional[str] = None, - details: Optional[List["CloudErrorBody"]] = None, + details: Optional[List["_models.CloudErrorBody"]] = None, **kwargs ): """ @@ -811,7 +811,7 @@ class ContainerServiceDiagnosticsProfile(msrest.serialization.Model): def __init__( self, *, - vm_diagnostics: "ContainerServiceVMDiagnostics", + vm_diagnostics: "_models.ContainerServiceVMDiagnostics", **kwargs ): """ @@ -848,7 +848,7 @@ def __init__( self, *, admin_username: str, - ssh: "ContainerServiceSshConfiguration", + ssh: "_models.ContainerServiceSshConfiguration", **kwargs ): """ @@ -871,17 +871,17 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar count: Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, - and 5. The default value is 1. Possible values include: 1, 3, 5. Default value: "1". + and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". :vartype count: int or ~azure.mgmt.containerservice.v2022_02_01.models.Count :ivar dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. :vartype dns_prefix: str - :ivar vm_size: Required. Size of agent VMs. Possible values include: "Standard_A1", - "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", - "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", - "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", - "Standard_A8m_v2", "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", - "Standard_B8ms", "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", - "Standard_D12", "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", + :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", + "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", + "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", + "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", "Standard_B8ms", + "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", "Standard_D12", + "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", "Standard_D13_v2_Promo", "Standard_D14", "Standard_D14_v2", "Standard_D14_v2_Promo", "Standard_D15_v2", "Standard_D16_v3", "Standard_D16s_v3", "Standard_D1_v2", "Standard_D2", "Standard_D2_v2", "Standard_D2_v2_Promo", "Standard_D2_v3", "Standard_D2s_v3", "Standard_D3", @@ -926,7 +926,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): :vartype first_consecutive_static_ip: str :ivar storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Possible values include: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". :vartype storage_profile: str or ~azure.mgmt.containerservice.v2022_02_01.models.ContainerServiceStorageProfileTypes :ivar fqdn: FQDN for the master pool. @@ -955,27 +955,27 @@ def __init__( self, *, dns_prefix: str, - vm_size: Union[str, "ContainerServiceVMSizeTypes"], - count: Optional[Union[int, "Count"]] = 1, + vm_size: Union[str, "_models.ContainerServiceVMSizeTypes"], + count: Optional[Union[int, "_models.Count"]] = 1, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, first_consecutive_static_ip: Optional[str] = "10.240.255.5", - storage_profile: Optional[Union[str, "ContainerServiceStorageProfileTypes"]] = None, + storage_profile: Optional[Union[str, "_models.ContainerServiceStorageProfileTypes"]] = None, **kwargs ): """ :keyword count: Number of masters (VMs) in the container service cluster. Allowed values are 1, - 3, and 5. The default value is 1. Possible values include: 1, 3, 5. Default value: "1". + 3, and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". :paramtype count: int or ~azure.mgmt.containerservice.v2022_02_01.models.Count :keyword dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. :paramtype dns_prefix: str - :keyword vm_size: Required. Size of agent VMs. Possible values include: "Standard_A1", - "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", - "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", - "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", - "Standard_A8m_v2", "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", - "Standard_B8ms", "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", - "Standard_D12", "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", + :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", + "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", + "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", + "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", "Standard_B8ms", + "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", "Standard_D12", + "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", "Standard_D13_v2_Promo", "Standard_D14", "Standard_D14_v2", "Standard_D14_v2_Promo", "Standard_D15_v2", "Standard_D16_v3", "Standard_D16s_v3", "Standard_D1_v2", "Standard_D2", "Standard_D2_v2", "Standard_D2_v2_Promo", "Standard_D2_v3", "Standard_D2s_v3", "Standard_D3", @@ -1020,7 +1020,7 @@ def __init__( :paramtype first_consecutive_static_ip: str :keyword storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Possible values include: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". :paramtype storage_profile: str or ~azure.mgmt.containerservice.v2022_02_01.models.ContainerServiceStorageProfileTypes """ @@ -1038,14 +1038,14 @@ def __init__( class ContainerServiceNetworkProfile(msrest.serialization.Model): """Profile of network configuration. - :ivar network_plugin: Network plugin used for building the Kubernetes network. Possible values - include: "azure", "kubenet". Default value: "kubenet". + :ivar network_plugin: Network plugin used for building the Kubernetes network. Known values + are: "azure", "kubenet". Default value: "kubenet". :vartype network_plugin: str or ~azure.mgmt.containerservice.v2022_02_01.models.NetworkPlugin - :ivar network_policy: Network policy used for building the Kubernetes network. Possible values - include: "calico", "azure". + :ivar network_policy: Network policy used for building the Kubernetes network. Known values + are: "calico", "azure". :vartype network_policy: str or ~azure.mgmt.containerservice.v2022_02_01.models.NetworkPolicy :ivar network_mode: This cannot be specified if networkPlugin is anything other than 'azure'. - Possible values include: "transparent", "bridge". + Known values are: "transparent", "bridge". :vartype network_mode: str or ~azure.mgmt.containerservice.v2022_02_01.models.NetworkMode :ivar pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :vartype pod_cidr: str @@ -1060,13 +1060,13 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): :vartype docker_bridge_cidr: str :ivar outbound_type: This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type - `_. Possible values include: - "loadBalancer", "userDefinedRouting", "managedNATGateway", "userAssignedNATGateway". Default - value: "loadBalancer". + `_. Known values are: "loadBalancer", + "userDefinedRouting", "managedNATGateway", "userAssignedNATGateway". Default value: + "loadBalancer". :vartype outbound_type: str or ~azure.mgmt.containerservice.v2022_02_01.models.OutboundType :ivar load_balancer_sku: The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the - differences between load balancer SKUs. Possible values include: "standard", "basic". + differences between load balancer SKUs. Known values are: "standard", "basic". :vartype load_balancer_sku: str or ~azure.mgmt.containerservice.v2022_02_01.models.LoadBalancerSku :ivar load_balancer_profile: Profile of the cluster load balancer. @@ -1115,31 +1115,31 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): def __init__( self, *, - network_plugin: Optional[Union[str, "NetworkPlugin"]] = "kubenet", - network_policy: Optional[Union[str, "NetworkPolicy"]] = None, - network_mode: Optional[Union[str, "NetworkMode"]] = None, + network_plugin: Optional[Union[str, "_models.NetworkPlugin"]] = "kubenet", + network_policy: Optional[Union[str, "_models.NetworkPolicy"]] = None, + network_mode: Optional[Union[str, "_models.NetworkMode"]] = None, pod_cidr: Optional[str] = "10.244.0.0/16", service_cidr: Optional[str] = "10.0.0.0/16", dns_service_ip: Optional[str] = "10.0.0.10", docker_bridge_cidr: Optional[str] = "172.17.0.1/16", - outbound_type: Optional[Union[str, "OutboundType"]] = "loadBalancer", - load_balancer_sku: Optional[Union[str, "LoadBalancerSku"]] = None, - load_balancer_profile: Optional["ManagedClusterLoadBalancerProfile"] = None, - nat_gateway_profile: Optional["ManagedClusterNATGatewayProfile"] = None, + outbound_type: Optional[Union[str, "_models.OutboundType"]] = "loadBalancer", + load_balancer_sku: Optional[Union[str, "_models.LoadBalancerSku"]] = None, + load_balancer_profile: Optional["_models.ManagedClusterLoadBalancerProfile"] = None, + nat_gateway_profile: Optional["_models.ManagedClusterNATGatewayProfile"] = None, pod_cidrs: Optional[List[str]] = None, service_cidrs: Optional[List[str]] = None, - ip_families: Optional[List[Union[str, "IpFamily"]]] = None, + ip_families: Optional[List[Union[str, "_models.IpFamily"]]] = None, **kwargs ): """ - :keyword network_plugin: Network plugin used for building the Kubernetes network. Possible - values include: "azure", "kubenet". Default value: "kubenet". + :keyword network_plugin: Network plugin used for building the Kubernetes network. Known values + are: "azure", "kubenet". Default value: "kubenet". :paramtype network_plugin: str or ~azure.mgmt.containerservice.v2022_02_01.models.NetworkPlugin - :keyword network_policy: Network policy used for building the Kubernetes network. Possible - values include: "calico", "azure". + :keyword network_policy: Network policy used for building the Kubernetes network. Known values + are: "calico", "azure". :paramtype network_policy: str or ~azure.mgmt.containerservice.v2022_02_01.models.NetworkPolicy :keyword network_mode: This cannot be specified if networkPlugin is anything other than - 'azure'. Possible values include: "transparent", "bridge". + 'azure'. Known values are: "transparent", "bridge". :paramtype network_mode: str or ~azure.mgmt.containerservice.v2022_02_01.models.NetworkMode :keyword pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :paramtype pod_cidr: str @@ -1154,13 +1154,13 @@ def __init__( :paramtype docker_bridge_cidr: str :keyword outbound_type: This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type - `_. Possible values include: - "loadBalancer", "userDefinedRouting", "managedNATGateway", "userAssignedNATGateway". Default - value: "loadBalancer". + `_. Known values are: "loadBalancer", + "userDefinedRouting", "managedNATGateway", "userAssignedNATGateway". Default value: + "loadBalancer". :paramtype outbound_type: str or ~azure.mgmt.containerservice.v2022_02_01.models.OutboundType :keyword load_balancer_sku: The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the - differences between load balancer SKUs. Possible values include: "standard", "basic". + differences between load balancer SKUs. Known values are: "standard", "basic". :paramtype load_balancer_sku: str or ~azure.mgmt.containerservice.v2022_02_01.models.LoadBalancerSku :keyword load_balancer_profile: Profile of the cluster load balancer. @@ -1220,7 +1220,7 @@ class ContainerServiceSshConfiguration(msrest.serialization.Model): def __init__( self, *, - public_keys: List["ContainerServiceSshPublicKey"], + public_keys: List["_models.ContainerServiceSshPublicKey"], **kwargs ): """ @@ -1408,7 +1408,7 @@ def __init__( self, *, domain_name: Optional[str] = None, - endpoint_details: Optional[List["EndpointDetail"]] = None, + endpoint_details: Optional[List["_models.EndpointDetail"]] = None, **kwargs ): """ @@ -1474,7 +1474,7 @@ class ExtendedLocation(msrest.serialization.Model): :ivar name: The name of the extended location. :vartype name: str - :ivar type: The type of the extended location. Possible values include: "EdgeZone". + :ivar type: The type of the extended location. Known values are: "EdgeZone". :vartype type: str or ~azure.mgmt.containerservice.v2022_02_01.models.ExtendedLocationTypes """ @@ -1487,13 +1487,13 @@ def __init__( self, *, name: Optional[str] = None, - type: Optional[Union[str, "ExtendedLocationTypes"]] = None, + type: Optional[Union[str, "_models.ExtendedLocationTypes"]] = None, **kwargs ): """ :keyword name: The name of the extended location. :paramtype name: str - :keyword type: The type of the extended location. Possible values include: "EdgeZone". + :keyword type: The type of the extended location. Known values are: "EdgeZone". :paramtype type: str or ~azure.mgmt.containerservice.v2022_02_01.models.ExtendedLocationTypes """ super(ExtendedLocation, self).__init__(**kwargs) @@ -1652,7 +1652,7 @@ class LinuxOSConfig(msrest.serialization.Model): def __init__( self, *, - sysctls: Optional["SysctlConfig"] = None, + sysctls: Optional["_models.SysctlConfig"] = None, transparent_huge_page_enabled: Optional[str] = None, transparent_huge_page_defrag: Optional[str] = None, swap_file_size_mb: Optional[int] = None, @@ -1720,8 +1720,8 @@ class MaintenanceConfiguration(SubResource): def __init__( self, *, - time_in_week: Optional[List["TimeInWeek"]] = None, - not_allowed_time: Optional[List["TimeSpan"]] = None, + time_in_week: Optional[List["_models.TimeInWeek"]] = None, + not_allowed_time: Optional[List["_models.TimeSpan"]] = None, **kwargs ): """ @@ -1760,7 +1760,7 @@ class MaintenanceConfigurationListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["MaintenanceConfiguration"]] = None, + value: Optional[List["_models.MaintenanceConfiguration"]] = None, **kwargs ): """ @@ -1951,8 +1951,8 @@ class ManagedCluster(Resource): :ivar security_profile: Security profile for the managed cluster. :vartype security_profile: ~azure.mgmt.containerservice.v2022_02_01.models.ManagedClusterSecurityProfile - :ivar public_network_access: Allow or deny public network access for AKS. Possible values - include: "Enabled", "Disabled". + :ivar public_network_access: Allow or deny public network access for AKS. Known values are: + "Enabled", "Disabled". :vartype public_network_access: str or ~azure.mgmt.containerservice.v2022_02_01.models.PublicNetworkAccess """ @@ -2018,33 +2018,33 @@ def __init__( *, location: str, tags: Optional[Dict[str, str]] = None, - sku: Optional["ManagedClusterSKU"] = None, - extended_location: Optional["ExtendedLocation"] = None, - identity: Optional["ManagedClusterIdentity"] = None, + sku: Optional["_models.ManagedClusterSKU"] = None, + extended_location: Optional["_models.ExtendedLocation"] = None, + identity: Optional["_models.ManagedClusterIdentity"] = None, kubernetes_version: Optional[str] = None, dns_prefix: Optional[str] = None, fqdn_subdomain: Optional[str] = None, - agent_pool_profiles: Optional[List["ManagedClusterAgentPoolProfile"]] = None, - linux_profile: Optional["ContainerServiceLinuxProfile"] = None, - windows_profile: Optional["ManagedClusterWindowsProfile"] = None, - service_principal_profile: Optional["ManagedClusterServicePrincipalProfile"] = None, - addon_profiles: Optional[Dict[str, "ManagedClusterAddonProfile"]] = None, - pod_identity_profile: Optional["ManagedClusterPodIdentityProfile"] = None, + agent_pool_profiles: Optional[List["_models.ManagedClusterAgentPoolProfile"]] = None, + linux_profile: Optional["_models.ContainerServiceLinuxProfile"] = None, + windows_profile: Optional["_models.ManagedClusterWindowsProfile"] = None, + service_principal_profile: Optional["_models.ManagedClusterServicePrincipalProfile"] = None, + addon_profiles: Optional[Dict[str, "_models.ManagedClusterAddonProfile"]] = None, + pod_identity_profile: Optional["_models.ManagedClusterPodIdentityProfile"] = None, node_resource_group: Optional[str] = None, enable_rbac: Optional[bool] = None, enable_pod_security_policy: Optional[bool] = None, - network_profile: Optional["ContainerServiceNetworkProfile"] = None, - aad_profile: Optional["ManagedClusterAADProfile"] = None, - auto_upgrade_profile: Optional["ManagedClusterAutoUpgradeProfile"] = None, - auto_scaler_profile: Optional["ManagedClusterPropertiesAutoScalerProfile"] = None, - api_server_access_profile: Optional["ManagedClusterAPIServerAccessProfile"] = None, + network_profile: Optional["_models.ContainerServiceNetworkProfile"] = None, + aad_profile: Optional["_models.ManagedClusterAADProfile"] = None, + auto_upgrade_profile: Optional["_models.ManagedClusterAutoUpgradeProfile"] = None, + auto_scaler_profile: Optional["_models.ManagedClusterPropertiesAutoScalerProfile"] = None, + api_server_access_profile: Optional["_models.ManagedClusterAPIServerAccessProfile"] = None, disk_encryption_set_id: Optional[str] = None, - identity_profile: Optional[Dict[str, "UserAssignedIdentity"]] = None, - private_link_resources: Optional[List["PrivateLinkResource"]] = None, + identity_profile: Optional[Dict[str, "_models.UserAssignedIdentity"]] = None, + private_link_resources: Optional[List["_models.PrivateLinkResource"]] = None, disable_local_accounts: Optional[bool] = None, - http_proxy_config: Optional["ManagedClusterHTTPProxyConfig"] = None, - security_profile: Optional["ManagedClusterSecurityProfile"] = None, - public_network_access: Optional[Union[str, "PublicNetworkAccess"]] = None, + http_proxy_config: Optional["_models.ManagedClusterHTTPProxyConfig"] = None, + security_profile: Optional["_models.ManagedClusterSecurityProfile"] = None, + public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None, **kwargs ): """ @@ -2133,8 +2133,8 @@ def __init__( :keyword security_profile: Security profile for the managed cluster. :paramtype security_profile: ~azure.mgmt.containerservice.v2022_02_01.models.ManagedClusterSecurityProfile - :keyword public_network_access: Allow or deny public network access for AKS. Possible values - include: "Enabled", "Disabled". + :keyword public_network_access: Allow or deny public network access for AKS. Known values are: + "Enabled", "Disabled". :paramtype public_network_access: str or ~azure.mgmt.containerservice.v2022_02_01.models.PublicNetworkAccess """ @@ -2450,15 +2450,15 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS - `_. Possible values - include: "Managed", "Ephemeral". + `_. Known values are: + "Managed", "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2022_02_01.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Possible values include: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_02_01.models.KubeletDiskType - :ivar workload_runtime: Determines the type of workload a node can run. Possible values - include: "OCIContainer", "WasmWasi". + :ivar workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer", "WasmWasi". :vartype workload_runtime: str or ~azure.mgmt.containerservice.v2022_02_01.models.WorkloadRuntime :ivar vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and used. @@ -2472,11 +2472,11 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_02_01.models.OSType - :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Possible values include: "Ubuntu", "CBLMariner". + :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known + values are: "Ubuntu", "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2022_02_01.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. :vartype max_count: int @@ -2485,15 +2485,14 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it - defaults to Delete. Possible values include: "Delete", "Deallocate". + defaults to Delete. Known values are: "Delete", "Deallocate". :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_02_01.models.ScaleDownMode - :ivar type: The type of Agent Pool. Possible values include: "VirtualMachineScaleSets", + :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2022_02_01.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Possible values include: "System", - "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". :vartype mode: str or ~azure.mgmt.containerservice.v2022_02_01.models.AgentPoolMode :ivar orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -2528,12 +2527,12 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Possible values include: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_02_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Possible values include: "Delete", - "Deallocate". Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_02_01.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which @@ -2565,7 +2564,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_02_01.models.GPUInstanceProfile :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool @@ -2627,40 +2626,40 @@ def __init__( count: Optional[int] = None, vm_size: Optional[str] = None, os_disk_size_gb: Optional[int] = None, - os_disk_type: Optional[Union[str, "OSDiskType"]] = None, - kubelet_disk_type: Optional[Union[str, "KubeletDiskType"]] = None, - workload_runtime: Optional[Union[str, "WorkloadRuntime"]] = None, + os_disk_type: Optional[Union[str, "_models.OSDiskType"]] = None, + kubelet_disk_type: Optional[Union[str, "_models.KubeletDiskType"]] = None, + workload_runtime: Optional[Union[str, "_models.WorkloadRuntime"]] = None, vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", - os_sku: Optional[Union[str, "OSSKU"]] = None, + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - scale_down_mode: Optional[Union[str, "ScaleDownMode"]] = None, - type: Optional[Union[str, "AgentPoolType"]] = None, - mode: Optional[Union[str, "AgentPoolMode"]] = None, + scale_down_mode: Optional[Union[str, "_models.ScaleDownMode"]] = None, + type: Optional[Union[str, "_models.AgentPoolType"]] = None, + mode: Optional[Union[str, "_models.AgentPoolMode"]] = None, orchestrator_version: Optional[str] = None, - upgrade_settings: Optional["AgentPoolUpgradeSettings"] = None, - power_state: Optional["PowerState"] = None, + upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, + power_state: Optional["_models.PowerState"] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", spot_max_price: Optional[float] = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, proximity_placement_group_id: Optional[str] = None, - kubelet_config: Optional["KubeletConfig"] = None, - linux_os_config: Optional["LinuxOSConfig"] = None, + kubelet_config: Optional["_models.KubeletConfig"] = None, + linux_os_config: Optional["_models.LinuxOSConfig"] = None, enable_encryption_at_host: Optional[bool] = None, enable_ultra_ssd: Optional[bool] = None, enable_fips: Optional[bool] = None, - gpu_instance_profile: Optional[Union[str, "GPUInstanceProfile"]] = None, - creation_data: Optional["CreationData"] = None, + gpu_instance_profile: Optional[Union[str, "_models.GPUInstanceProfile"]] = None, + creation_data: Optional["_models.CreationData"] = None, **kwargs ): """ @@ -2679,15 +2678,15 @@ def __init__( :keyword os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS - `_. Possible values - include: "Managed", "Ephemeral". + `_. Known values are: + "Managed", "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2022_02_01.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Possible values include: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_02_01.models.KubeletDiskType - :keyword workload_runtime: Determines the type of workload a node can run. Possible values - include: "OCIContainer", "WasmWasi". + :keyword workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer", "WasmWasi". :paramtype workload_runtime: str or ~azure.mgmt.containerservice.v2022_02_01.models.WorkloadRuntime :keyword vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and @@ -2701,11 +2700,11 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_02_01.models.OSType :keyword os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Possible values include: "Ubuntu", "CBLMariner". + Known values are: "Ubuntu", "CBLMariner". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2022_02_01.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -2714,16 +2713,15 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, - it defaults to Delete. Possible values include: "Delete", "Deallocate". + it defaults to Delete. Known values are: "Delete", "Deallocate". :paramtype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_02_01.models.ScaleDownMode - :keyword type: The type of Agent Pool. Possible values include: "VirtualMachineScaleSets", + :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2022_02_01.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Possible values include: "System", - "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2022_02_01.models.AgentPoolMode :keyword orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -2754,12 +2752,12 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Possible values include: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_02_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Possible values include: "Delete", - "Deallocate". Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_02_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which @@ -2791,7 +2789,7 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_02_01.models.GPUInstanceProfile @@ -2863,15 +2861,15 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS - `_. Possible values - include: "Managed", "Ephemeral". + `_. Known values are: + "Managed", "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2022_02_01.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Possible values include: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_02_01.models.KubeletDiskType - :ivar workload_runtime: Determines the type of workload a node can run. Possible values - include: "OCIContainer", "WasmWasi". + :ivar workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer", "WasmWasi". :vartype workload_runtime: str or ~azure.mgmt.containerservice.v2022_02_01.models.WorkloadRuntime :ivar vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and used. @@ -2885,11 +2883,11 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_02_01.models.OSType - :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Possible values include: "Ubuntu", "CBLMariner". + :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known + values are: "Ubuntu", "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2022_02_01.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. :vartype max_count: int @@ -2898,15 +2896,14 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it - defaults to Delete. Possible values include: "Delete", "Deallocate". + defaults to Delete. Known values are: "Delete", "Deallocate". :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_02_01.models.ScaleDownMode - :ivar type: The type of Agent Pool. Possible values include: "VirtualMachineScaleSets", + :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2022_02_01.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Possible values include: "System", - "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". :vartype mode: str or ~azure.mgmt.containerservice.v2022_02_01.models.AgentPoolMode :ivar orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -2941,12 +2938,12 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Possible values include: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_02_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Possible values include: "Delete", - "Deallocate". Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_02_01.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which @@ -2978,7 +2975,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_02_01.models.GPUInstanceProfile :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool @@ -3045,40 +3042,40 @@ def __init__( count: Optional[int] = None, vm_size: Optional[str] = None, os_disk_size_gb: Optional[int] = None, - os_disk_type: Optional[Union[str, "OSDiskType"]] = None, - kubelet_disk_type: Optional[Union[str, "KubeletDiskType"]] = None, - workload_runtime: Optional[Union[str, "WorkloadRuntime"]] = None, + os_disk_type: Optional[Union[str, "_models.OSDiskType"]] = None, + kubelet_disk_type: Optional[Union[str, "_models.KubeletDiskType"]] = None, + workload_runtime: Optional[Union[str, "_models.WorkloadRuntime"]] = None, vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", - os_sku: Optional[Union[str, "OSSKU"]] = None, + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - scale_down_mode: Optional[Union[str, "ScaleDownMode"]] = None, - type: Optional[Union[str, "AgentPoolType"]] = None, - mode: Optional[Union[str, "AgentPoolMode"]] = None, + scale_down_mode: Optional[Union[str, "_models.ScaleDownMode"]] = None, + type: Optional[Union[str, "_models.AgentPoolType"]] = None, + mode: Optional[Union[str, "_models.AgentPoolMode"]] = None, orchestrator_version: Optional[str] = None, - upgrade_settings: Optional["AgentPoolUpgradeSettings"] = None, - power_state: Optional["PowerState"] = None, + upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, + power_state: Optional["_models.PowerState"] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", spot_max_price: Optional[float] = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, proximity_placement_group_id: Optional[str] = None, - kubelet_config: Optional["KubeletConfig"] = None, - linux_os_config: Optional["LinuxOSConfig"] = None, + kubelet_config: Optional["_models.KubeletConfig"] = None, + linux_os_config: Optional["_models.LinuxOSConfig"] = None, enable_encryption_at_host: Optional[bool] = None, enable_ultra_ssd: Optional[bool] = None, enable_fips: Optional[bool] = None, - gpu_instance_profile: Optional[Union[str, "GPUInstanceProfile"]] = None, - creation_data: Optional["CreationData"] = None, + gpu_instance_profile: Optional[Union[str, "_models.GPUInstanceProfile"]] = None, + creation_data: Optional["_models.CreationData"] = None, **kwargs ): """ @@ -3097,15 +3094,15 @@ def __init__( :keyword os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS - `_. Possible values - include: "Managed", "Ephemeral". + `_. Known values are: + "Managed", "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2022_02_01.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Possible values include: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_02_01.models.KubeletDiskType - :keyword workload_runtime: Determines the type of workload a node can run. Possible values - include: "OCIContainer", "WasmWasi". + :keyword workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer", "WasmWasi". :paramtype workload_runtime: str or ~azure.mgmt.containerservice.v2022_02_01.models.WorkloadRuntime :keyword vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and @@ -3119,11 +3116,11 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_02_01.models.OSType :keyword os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Possible values include: "Ubuntu", "CBLMariner". + Known values are: "Ubuntu", "CBLMariner". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2022_02_01.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -3132,16 +3129,15 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, - it defaults to Delete. Possible values include: "Delete", "Deallocate". + it defaults to Delete. Known values are: "Delete", "Deallocate". :paramtype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_02_01.models.ScaleDownMode - :keyword type: The type of Agent Pool. Possible values include: "VirtualMachineScaleSets", + :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2022_02_01.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Possible values include: "System", - "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2022_02_01.models.AgentPoolMode :keyword orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -3172,12 +3168,12 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Possible values include: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_02_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Possible values include: "Delete", - "Deallocate". Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_02_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which @@ -3209,7 +3205,7 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_02_01.models.GPUInstanceProfile @@ -3294,8 +3290,8 @@ class ManagedClusterAutoUpgradeProfile(msrest.serialization.Model): """Auto upgrade profile for a managed cluster. :ivar upgrade_channel: For more information see `setting the AKS cluster auto-upgrade channel - `_. Possible - values include: "rapid", "stable", "patch", "node-image", "none". + `_. Known values + are: "rapid", "stable", "patch", "node-image", "none". :vartype upgrade_channel: str or ~azure.mgmt.containerservice.v2022_02_01.models.UpgradeChannel """ @@ -3306,13 +3302,13 @@ class ManagedClusterAutoUpgradeProfile(msrest.serialization.Model): def __init__( self, *, - upgrade_channel: Optional[Union[str, "UpgradeChannel"]] = None, + upgrade_channel: Optional[Union[str, "_models.UpgradeChannel"]] = None, **kwargs ): """ :keyword upgrade_channel: For more information see `setting the AKS cluster auto-upgrade channel `_. - Possible values include: "rapid", "stable", "patch", "node-image", "none". + Known values are: "rapid", "stable", "patch", "node-image", "none". :paramtype upgrade_channel: str or ~azure.mgmt.containerservice.v2022_02_01.models.UpgradeChannel """ @@ -3378,7 +3374,7 @@ class ManagedClusterIdentity(msrest.serialization.Model): components. :vartype tenant_id: str :ivar type: For more information see `use managed identities in AKS - `_. Possible values include: + `_. Known values are: "SystemAssigned", "UserAssigned", "None". :vartype type: str or ~azure.mgmt.containerservice.v2022_02_01.models.ResourceIdentityType :ivar user_assigned_identities: The keys must be ARM resource IDs in the form: @@ -3402,13 +3398,13 @@ class ManagedClusterIdentity(msrest.serialization.Model): def __init__( self, *, - type: Optional[Union[str, "ResourceIdentityType"]] = None, - user_assigned_identities: Optional[Dict[str, "ManagedServiceIdentityUserAssignedIdentitiesValue"]] = None, + type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, + user_assigned_identities: Optional[Dict[str, "_models.ManagedServiceIdentityUserAssignedIdentitiesValue"]] = None, **kwargs ): """ :keyword type: For more information see `use managed identities in AKS - `_. Possible values include: + `_. Known values are: "SystemAssigned", "UserAssigned", "None". :paramtype type: str or ~azure.mgmt.containerservice.v2022_02_01.models.ResourceIdentityType :keyword user_assigned_identities: The keys must be ARM resource IDs in the form: @@ -3446,7 +3442,7 @@ class ManagedClusterListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["ManagedCluster"]] = None, + value: Optional[List["_models.ManagedCluster"]] = None, **kwargs ): """ @@ -3504,10 +3500,10 @@ class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): def __init__( self, *, - managed_outbound_i_ps: Optional["ManagedClusterLoadBalancerProfileManagedOutboundIPs"] = None, - outbound_ip_prefixes: Optional["ManagedClusterLoadBalancerProfileOutboundIPPrefixes"] = None, - outbound_i_ps: Optional["ManagedClusterLoadBalancerProfileOutboundIPs"] = None, - effective_outbound_i_ps: Optional[List["ResourceReference"]] = None, + managed_outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileManagedOutboundIPs"] = None, + outbound_ip_prefixes: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPPrefixes"] = None, + outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPs"] = None, + effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, allocated_outbound_ports: Optional[int] = 0, idle_timeout_in_minutes: Optional[int] = 30, enable_multiple_standard_load_balancers: Optional[bool] = None, @@ -3609,7 +3605,7 @@ class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.M def __init__( self, *, - public_ip_prefixes: Optional[List["ResourceReference"]] = None, + public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, **kwargs ): """ @@ -3635,7 +3631,7 @@ class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): def __init__( self, *, - public_i_ps: Optional[List["ResourceReference"]] = None, + public_i_ps: Optional[List["_models.ResourceReference"]] = None, **kwargs ): """ @@ -3705,8 +3701,8 @@ class ManagedClusterNATGatewayProfile(msrest.serialization.Model): def __init__( self, *, - managed_outbound_ip_profile: Optional["ManagedClusterManagedOutboundIPProfile"] = None, - effective_outbound_i_ps: Optional[List["ResourceReference"]] = None, + managed_outbound_ip_profile: Optional["_models.ManagedClusterManagedOutboundIPProfile"] = None, + effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, idle_timeout_in_minutes: Optional[int] = 4, **kwargs ): @@ -3744,8 +3740,8 @@ class ManagedClusterPodIdentity(msrest.serialization.Model): :vartype binding_selector: str :ivar identity: Required. The user assigned identity details. :vartype identity: ~azure.mgmt.containerservice.v2022_02_01.models.UserAssignedIdentity - :ivar provisioning_state: The current provisioning state of the pod identity. Possible values - include: "Assigned", "Updating", "Deleting", "Failed". + :ivar provisioning_state: The current provisioning state of the pod identity. Known values are: + "Assigned", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2022_02_01.models.ManagedClusterPodIdentityProvisioningState :ivar provisioning_info: @@ -3775,7 +3771,7 @@ def __init__( *, name: str, namespace: str, - identity: "UserAssignedIdentity", + identity: "_models.UserAssignedIdentity", binding_selector: Optional[str] = None, **kwargs ): @@ -3876,8 +3872,8 @@ def __init__( *, enabled: Optional[bool] = None, allow_network_plugin_kubenet: Optional[bool] = None, - user_assigned_identities: Optional[List["ManagedClusterPodIdentity"]] = None, - user_assigned_identity_exceptions: Optional[List["ManagedClusterPodIdentityException"]] = None, + user_assigned_identities: Optional[List["_models.ManagedClusterPodIdentity"]] = None, + user_assigned_identity_exceptions: Optional[List["_models.ManagedClusterPodIdentityException"]] = None, **kwargs ): """ @@ -3918,7 +3914,7 @@ class ManagedClusterPodIdentityProvisioningError(msrest.serialization.Model): def __init__( self, *, - error: Optional["ManagedClusterPodIdentityProvisioningErrorBody"] = None, + error: Optional["_models.ManagedClusterPodIdentityProvisioningErrorBody"] = None, **kwargs ): """ @@ -3960,7 +3956,7 @@ def __init__( code: Optional[str] = None, message: Optional[str] = None, target: Optional[str] = None, - details: Optional[List["ManagedClusterPodIdentityProvisioningErrorBody"]] = None, + details: Optional[List["_models.ManagedClusterPodIdentityProvisioningErrorBody"]] = None, **kwargs ): """ @@ -3999,7 +3995,7 @@ class ManagedClusterPodIdentityProvisioningInfo(msrest.serialization.Model): def __init__( self, *, - error: Optional["ManagedClusterPodIdentityProvisioningError"] = None, + error: Optional["_models.ManagedClusterPodIdentityProvisioningError"] = None, **kwargs ): """ @@ -4020,8 +4016,8 @@ class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): :vartype kubernetes_version: str :ivar name: The Agent Pool name. :vartype name: str - :ivar os_type: Required. The operating system type. The default is Linux. Possible values - include: "Linux", "Windows". Default value: "Linux". + :ivar os_type: Required. The operating system type. The default is Linux. Known values are: + "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_02_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -4044,9 +4040,9 @@ def __init__( self, *, kubernetes_version: str, - os_type: Union[str, "OSType"] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", name: Optional[str] = None, - upgrades: Optional[List["ManagedClusterPoolUpgradeProfileUpgradesItem"]] = None, + upgrades: Optional[List["_models.ManagedClusterPoolUpgradeProfileUpgradesItem"]] = None, **kwargs ): """ @@ -4054,8 +4050,8 @@ def __init__( :paramtype kubernetes_version: str :keyword name: The Agent Pool name. :paramtype name: str - :keyword os_type: Required. The operating system type. The default is Linux. Possible values - include: "Linux", "Windows". Default value: "Linux". + :keyword os_type: Required. The operating system type. The default is Linux. Known values are: + "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_02_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: @@ -4107,8 +4103,7 @@ class ManagedClusterPropertiesAutoScalerProfile(msrest.serialization.Model): :vartype balance_similar_node_groups: str :ivar expander: If not specified, the default is 'random'. See `expanders `_ - for more information. Possible values include: "least-waste", "most-pods", "priority", - "random". + for more information. Known values are: "least-waste", "most-pods", "priority", "random". :vartype expander: str or ~azure.mgmt.containerservice.v2022_02_01.models.Expander :ivar max_empty_bulk_delete: The default is 10. :vartype max_empty_bulk_delete: str @@ -4175,7 +4170,7 @@ def __init__( self, *, balance_similar_node_groups: Optional[str] = None, - expander: Optional[Union[str, "Expander"]] = None, + expander: Optional[Union[str, "_models.Expander"]] = None, max_empty_bulk_delete: Optional[str] = None, max_graceful_termination_sec: Optional[str] = None, max_node_provision_time: Optional[str] = None, @@ -4198,8 +4193,7 @@ def __init__( :paramtype balance_similar_node_groups: str :keyword expander: If not specified, the default is 'random'. See `expanders `_ - for more information. Possible values include: "least-waste", "most-pods", "priority", - "random". + for more information. Known values are: "least-waste", "most-pods", "priority", "random". :paramtype expander: str or ~azure.mgmt.containerservice.v2022_02_01.models.Expander :keyword max_empty_bulk_delete: The default is 10. :paramtype max_empty_bulk_delete: str @@ -4277,7 +4271,7 @@ class ManagedClusterSecurityProfile(msrest.serialization.Model): def __init__( self, *, - azure_defender: Optional["ManagedClusterSecurityProfileAzureDefender"] = None, + azure_defender: Optional["_models.ManagedClusterSecurityProfileAzureDefender"] = None, **kwargs ): """ @@ -4366,11 +4360,11 @@ def __init__( class ManagedClusterSKU(msrest.serialization.Model): """The SKU of a Managed Cluster. - :ivar name: The name of a managed cluster SKU. Possible values include: "Basic". + :ivar name: The name of a managed cluster SKU. Known values are: "Basic". :vartype name: str or ~azure.mgmt.containerservice.v2022_02_01.models.ManagedClusterSKUName :ivar tier: If not specified, the default is 'Free'. See `uptime SLA - `_ for more details. Possible values include: - "Paid", "Free". + `_ for more details. Known values are: "Paid", + "Free". :vartype tier: str or ~azure.mgmt.containerservice.v2022_02_01.models.ManagedClusterSKUTier """ @@ -4382,16 +4376,16 @@ class ManagedClusterSKU(msrest.serialization.Model): def __init__( self, *, - name: Optional[Union[str, "ManagedClusterSKUName"]] = None, - tier: Optional[Union[str, "ManagedClusterSKUTier"]] = None, + name: Optional[Union[str, "_models.ManagedClusterSKUName"]] = None, + tier: Optional[Union[str, "_models.ManagedClusterSKUTier"]] = None, **kwargs ): """ - :keyword name: The name of a managed cluster SKU. Possible values include: "Basic". + :keyword name: The name of a managed cluster SKU. Known values are: "Basic". :paramtype name: str or ~azure.mgmt.containerservice.v2022_02_01.models.ManagedClusterSKUName :keyword tier: If not specified, the default is 'Free'. See `uptime SLA - `_ for more details. Possible values include: - "Paid", "Free". + `_ for more details. Known values are: "Paid", + "Free". :paramtype tier: str or ~azure.mgmt.containerservice.v2022_02_01.models.ManagedClusterSKUTier """ super(ManagedClusterSKU, self).__init__(**kwargs) @@ -4440,8 +4434,8 @@ class ManagedClusterUpgradeProfile(msrest.serialization.Model): def __init__( self, *, - control_plane_profile: "ManagedClusterPoolUpgradeProfile", - agent_pool_profiles: List["ManagedClusterPoolUpgradeProfile"], + control_plane_profile: "_models.ManagedClusterPoolUpgradeProfile", + agent_pool_profiles: List["_models.ManagedClusterPoolUpgradeProfile"], **kwargs ): """ @@ -4483,8 +4477,8 @@ class ManagedClusterWindowsProfile(msrest.serialization.Model): "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!". :vartype admin_password: str :ivar license_type: The license type to use for Windows VMs. See `Azure Hybrid User Benefits - `_ for more details. Possible values - include: "None", "Windows_Server". + `_ for more details. Known values are: + "None", "Windows_Server". :vartype license_type: str or ~azure.mgmt.containerservice.v2022_02_01.models.LicenseType :ivar enable_csi_proxy: For more details on CSI proxy, see the `CSI proxy GitHub repo `_. @@ -4510,9 +4504,9 @@ def __init__( *, admin_username: str, admin_password: Optional[str] = None, - license_type: Optional[Union[str, "LicenseType"]] = None, + license_type: Optional[Union[str, "_models.LicenseType"]] = None, enable_csi_proxy: Optional[bool] = None, - gmsa_profile: Optional["WindowsGmsaProfile"] = None, + gmsa_profile: Optional["_models.WindowsGmsaProfile"] = None, **kwargs ): """ @@ -4533,8 +4527,8 @@ def __init__( "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!". :paramtype admin_password: str :keyword license_type: The license type to use for Windows VMs. See `Azure Hybrid User Benefits - `_ for more details. Possible values - include: "None", "Windows_Server". + `_ for more details. Known values are: + "None", "Windows_Server". :paramtype license_type: str or ~azure.mgmt.containerservice.v2022_02_01.models.LicenseType :keyword enable_csi_proxy: For more details on CSI proxy, see the `CSI proxy GitHub repo `_. @@ -4696,7 +4690,7 @@ class OSOptionProfile(msrest.serialization.Model): def __init__( self, *, - os_option_property_list: List["OSOptionProperty"], + os_option_property_list: List["_models.OSOptionProperty"], **kwargs ): """ @@ -4769,7 +4763,7 @@ def __init__( self, *, category: Optional[str] = None, - endpoints: Optional[List["EndpointDependency"]] = None, + endpoints: Optional[List["_models.EndpointDependency"]] = None, **kwargs ): """ @@ -4811,7 +4805,7 @@ class OutboundEnvironmentEndpointCollection(msrest.serialization.Model): def __init__( self, *, - value: List["OutboundEnvironmentEndpoint"], + value: List["_models.OutboundEnvironmentEndpoint"], **kwargs ): """ @@ -4827,8 +4821,8 @@ def __init__( class PowerState(msrest.serialization.Model): """Describes the Power State of the cluster. - :ivar code: Tells whether the cluster is Running or Stopped. Possible values include: - "Running", "Stopped". + :ivar code: Tells whether the cluster is Running or Stopped. Known values are: "Running", + "Stopped". :vartype code: str or ~azure.mgmt.containerservice.v2022_02_01.models.Code """ @@ -4839,12 +4833,12 @@ class PowerState(msrest.serialization.Model): def __init__( self, *, - code: Optional[Union[str, "Code"]] = None, + code: Optional[Union[str, "_models.Code"]] = None, **kwargs ): """ - :keyword code: Tells whether the cluster is Running or Stopped. Possible values include: - "Running", "Stopped". + :keyword code: Tells whether the cluster is Running or Stopped. Known values are: "Running", + "Stopped". :paramtype code: str or ~azure.mgmt.containerservice.v2022_02_01.models.Code """ super(PowerState, self).__init__(**kwargs) @@ -4887,7 +4881,7 @@ class PrivateEndpointConnection(msrest.serialization.Model): :vartype name: str :ivar type: The resource type. :vartype type: str - :ivar provisioning_state: The current provisioning state. Possible values include: "Succeeded", + :ivar provisioning_state: The current provisioning state. Known values are: "Succeeded", "Creating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2022_02_01.models.PrivateEndpointConnectionProvisioningState @@ -4918,8 +4912,8 @@ class PrivateEndpointConnection(msrest.serialization.Model): def __init__( self, *, - private_endpoint: Optional["PrivateEndpoint"] = None, - private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, + private_endpoint: Optional["_models.PrivateEndpoint"] = None, + private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionState"] = None, **kwargs ): """ @@ -4953,7 +4947,7 @@ class PrivateEndpointConnectionListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["PrivateEndpointConnection"]] = None, + value: Optional[List["_models.PrivateEndpointConnection"]] = None, **kwargs ): """ @@ -5043,7 +5037,7 @@ class PrivateLinkResourcesListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["PrivateLinkResource"]] = None, + value: Optional[List["_models.PrivateLinkResource"]] = None, **kwargs ): """ @@ -5057,7 +5051,7 @@ def __init__( class PrivateLinkServiceConnectionState(msrest.serialization.Model): """The state of a private link service connection. - :ivar status: The private link service connection status. Possible values include: "Pending", + :ivar status: The private link service connection status. Known values are: "Pending", "Approved", "Rejected", "Disconnected". :vartype status: str or ~azure.mgmt.containerservice.v2022_02_01.models.ConnectionStatus :ivar description: The private link service connection description. @@ -5072,13 +5066,13 @@ class PrivateLinkServiceConnectionState(msrest.serialization.Model): def __init__( self, *, - status: Optional[Union[str, "ConnectionStatus"]] = None, + status: Optional[Union[str, "_models.ConnectionStatus"]] = None, description: Optional[str] = None, **kwargs ): """ - :keyword status: The private link service connection status. Possible values include: - "Pending", "Approved", "Rejected", "Disconnected". + :keyword status: The private link service connection status. Known values are: "Pending", + "Approved", "Rejected", "Disconnected". :paramtype status: str or ~azure.mgmt.containerservice.v2022_02_01.models.ConnectionStatus :keyword description: The private link service connection description. :paramtype description: str @@ -5240,18 +5234,18 @@ class Snapshot(Resource): :ivar creation_data: CreationData to be used to specify the source agent pool resource ID to create this snapshot. :vartype creation_data: ~azure.mgmt.containerservice.v2022_02_01.models.CreationData - :ivar snapshot_type: The type of a snapshot. The default is NodePool. Possible values include: + :ivar snapshot_type: The type of a snapshot. The default is NodePool. Known values are: "NodePool". Default value: "NodePool". :vartype snapshot_type: str or ~azure.mgmt.containerservice.v2022_02_01.models.SnapshotType :ivar kubernetes_version: The version of Kubernetes. :vartype kubernetes_version: str :ivar node_image_version: The version of node image. :vartype node_image_version: str - :ivar os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_02_01.models.OSType - :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Possible values include: "Ubuntu", "CBLMariner". + :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known + values are: "Ubuntu", "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2022_02_01.models.OSSKU :ivar vm_size: The size of the VM. :vartype vm_size: str @@ -5295,8 +5289,8 @@ def __init__( *, location: str, tags: Optional[Dict[str, str]] = None, - creation_data: Optional["CreationData"] = None, - snapshot_type: Optional[Union[str, "SnapshotType"]] = "NodePool", + creation_data: Optional["_models.CreationData"] = None, + snapshot_type: Optional[Union[str, "_models.SnapshotType"]] = "NodePool", **kwargs ): """ @@ -5307,8 +5301,8 @@ def __init__( :keyword creation_data: CreationData to be used to specify the source agent pool resource ID to create this snapshot. :paramtype creation_data: ~azure.mgmt.containerservice.v2022_02_01.models.CreationData - :keyword snapshot_type: The type of a snapshot. The default is NodePool. Possible values - include: "NodePool". Default value: "NodePool". + :keyword snapshot_type: The type of a snapshot. The default is NodePool. Known values are: + "NodePool". Default value: "NodePool". :paramtype snapshot_type: str or ~azure.mgmt.containerservice.v2022_02_01.models.SnapshotType """ super(Snapshot, self).__init__(location=location, tags=tags, **kwargs) @@ -5345,7 +5339,7 @@ class SnapshotListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["Snapshot"]] = None, + value: Optional[List["_models.Snapshot"]] = None, **kwargs ): """ @@ -5576,15 +5570,15 @@ class SystemData(msrest.serialization.Model): :ivar created_by: The identity that created the resource. :vartype created_by: str - :ivar created_by_type: The type of identity that created the resource. Possible values include: + :ivar created_by_type: The type of identity that created the resource. Known values are: "User", "Application", "ManagedIdentity", "Key". :vartype created_by_type: str or ~azure.mgmt.containerservice.v2022_02_01.models.CreatedByType :ivar created_at: The timestamp of resource creation (UTC). :vartype created_at: ~datetime.datetime :ivar last_modified_by: The identity that last modified the resource. :vartype last_modified_by: str - :ivar last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". + :ivar last_modified_by_type: The type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", "Key". :vartype last_modified_by_type: str or ~azure.mgmt.containerservice.v2022_02_01.models.CreatedByType :ivar last_modified_at: The timestamp of resource last modification (UTC). @@ -5604,26 +5598,26 @@ def __init__( self, *, created_by: Optional[str] = None, - created_by_type: Optional[Union[str, "CreatedByType"]] = None, + created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, created_at: Optional[datetime.datetime] = None, last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[Union[str, "CreatedByType"]] = None, + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, last_modified_at: Optional[datetime.datetime] = None, **kwargs ): """ :keyword created_by: The identity that created the resource. :paramtype created_by: str - :keyword created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". + :keyword created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", "Key". :paramtype created_by_type: str or ~azure.mgmt.containerservice.v2022_02_01.models.CreatedByType :keyword created_at: The timestamp of resource creation (UTC). :paramtype created_at: ~datetime.datetime :keyword last_modified_by: The identity that last modified the resource. :paramtype last_modified_by: str - :keyword last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". + :keyword last_modified_by_type: The type of identity that last modified the resource. Known + values are: "User", "Application", "ManagedIdentity", "Key". :paramtype last_modified_by_type: str or ~azure.mgmt.containerservice.v2022_02_01.models.CreatedByType :keyword last_modified_at: The timestamp of resource last modification (UTC). @@ -5666,8 +5660,8 @@ def __init__( class TimeInWeek(msrest.serialization.Model): """Time in a week. - :ivar day: The day of the week. Possible values include: "Sunday", "Monday", "Tuesday", - "Wednesday", "Thursday", "Friday", "Saturday". + :ivar day: The day of the week. Known values are: "Sunday", "Monday", "Tuesday", "Wednesday", + "Thursday", "Friday", "Saturday". :vartype day: str or ~azure.mgmt.containerservice.v2022_02_01.models.WeekDay :ivar hour_slots: Each integer hour represents a time range beginning at 0m after the hour ending at the next hour (non-inclusive). 0 corresponds to 00:00 UTC, 23 corresponds to 23:00 @@ -5683,12 +5677,12 @@ class TimeInWeek(msrest.serialization.Model): def __init__( self, *, - day: Optional[Union[str, "WeekDay"]] = None, + day: Optional[Union[str, "_models.WeekDay"]] = None, hour_slots: Optional[List[int]] = None, **kwargs ): """ - :keyword day: The day of the week. Possible values include: "Sunday", "Monday", "Tuesday", + :keyword day: The day of the week. Known values are: "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday". :paramtype day: str or ~azure.mgmt.containerservice.v2022_02_01.models.WeekDay :keyword hour_slots: Each integer hour represents a time range beginning at 0m after the hour diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/models/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/models/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/operations/__init__.py index 5e1e5e72fa59..e0748876288c 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/operations/__init__.py @@ -15,6 +15,9 @@ from ._resolve_private_link_service_id_operations import ResolvePrivateLinkServiceIdOperations from ._snapshots_operations import SnapshotsOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'Operations', 'ManagedClustersOperations', @@ -25,3 +28,5 @@ 'ResolvePrivateLinkServiceIdOperations', 'SnapshotsOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/operations/_agent_pools_operations.py index 72c7d1abe5ad..2c61667fe758 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/operations/_agent_pools_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -35,9 +35,12 @@ def build_list_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools") # pylint: disable=line-too-long path_format_arguments = { @@ -49,18 +52,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -72,9 +73,12 @@ def build_get_request( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -87,18 +91,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -109,14 +111,17 @@ def build_create_or_update_request_initial( resource_name: str, agent_pool_name: str, *, - json: JSONType = None, + json: Optional[_models.AgentPool] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -129,20 +134,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -156,9 +159,12 @@ def build_delete_request_initial( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -171,18 +177,16 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -194,9 +198,12 @@ def build_get_upgrade_profile_request( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default") # pylint: disable=line-too-long path_format_arguments = { @@ -209,18 +216,16 @@ def build_get_upgrade_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -231,9 +236,12 @@ def build_get_available_agent_pool_versions_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions") # pylint: disable=line-too-long path_format_arguments = { @@ -245,18 +253,16 @@ def build_get_available_agent_pool_versions_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -268,9 +274,12 @@ def build_upgrade_node_image_version_request_initial( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion") # pylint: disable=line-too-long path_format_arguments = { @@ -283,42 +292,38 @@ def build_upgrade_node_image_version_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class AgentPoolsOperations(object): - """AgentPoolsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class AgentPoolsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_02_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_02_01.ContainerServiceClient`'s + :attr:`agent_pools` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -326,7 +331,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Iterable["_models.AgentPoolListResult"]: + ) -> Iterable[_models.AgentPoolListResult]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. @@ -341,13 +346,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_02_01.models.AgentPoolListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -357,9 +365,11 @@ def prepare_request(next_link=None): resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -369,9 +379,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -411,7 +423,7 @@ def get( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPool": + ) -> _models.AgentPool: """Gets the specified managed cluster agent pool. Gets the specified managed cluster agent pool. @@ -427,13 +439,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.AgentPool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] request = build_get_request( @@ -443,11 +458,13 @@ def get( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -473,17 +490,20 @@ def _create_or_update_initial( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> "_models.AgentPool": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] + ) -> _models.AgentPool: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] _json = self._serialize.body(parameters, 'AgentPool') @@ -496,11 +516,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -531,9 +553,9 @@ def begin_create_or_update( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> LROPoller["_models.AgentPool"]: + ) -> LROPoller[_models.AgentPool]: """Creates or updates an agent pool in the specified managed cluster. Creates or updates an agent pool in the specified managed cluster. @@ -559,17 +581,20 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_02_01.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, @@ -577,20 +602,27 @@ def begin_create_or_update( 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): - response = pipeline_response.http_response deserialized = self._deserialize('AgentPool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -610,13 +642,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements agent_pool_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -626,11 +661,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -677,21 +714,26 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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) @@ -701,8 +743,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -722,7 +770,7 @@ def get_upgrade_profile( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPoolUpgradeProfile": + ) -> _models.AgentPoolUpgradeProfile: """Gets the upgrade profile for an agent pool. Gets the upgrade profile for an agent pool. @@ -738,13 +786,16 @@ def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.AgentPoolUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] request = build_get_upgrade_profile_request( @@ -754,11 +805,13 @@ def get_upgrade_profile( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -785,7 +838,7 @@ def get_available_agent_pool_versions( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.AgentPoolAvailableVersions": + ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported Kubernetes versions for the specified agent pool. See `supported Kubernetes versions @@ -801,13 +854,16 @@ def get_available_agent_pool_versions( :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.AgentPoolAvailableVersions :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolAvailableVersions"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] request = build_get_available_agent_pool_versions_request( @@ -816,11 +872,13 @@ def get_available_agent_pool_versions( resource_name=resource_name, api_version=api_version, template_url=self.get_available_agent_pool_versions.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -847,14 +905,17 @@ def _upgrade_node_image_version_initial( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> Optional["_models.AgentPool"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.AgentPool"]] + ) -> Optional[_models.AgentPool]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] request = build_upgrade_node_image_version_request_initial( @@ -864,11 +925,13 @@ def _upgrade_node_image_version_initial( agent_pool_name=agent_pool_name, api_version=api_version, template_url=self._upgrade_node_image_version_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -901,7 +964,7 @@ def begin_upgrade_node_image_version( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> LROPoller["_models.AgentPool"]: + ) -> LROPoller[_models.AgentPool]: """Upgrades the node image version of an agent pool to the latest. Upgrading the node image version of an agent pool applies the newest OS and runtime updates to @@ -927,21 +990,26 @@ def begin_upgrade_node_image_version( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_02_01.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._upgrade_node_image_version_initial( + raw_result = self._upgrade_node_image_version_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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) @@ -957,8 +1025,14 @@ def get_long_running_output(pipeline_response): return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/operations/_maintenance_configurations_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/operations/_maintenance_configurations_operations.py index 04f6a63b3591..cf5cea6582d8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/operations/_maintenance_configurations_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/operations/_maintenance_configurations_operations.py @@ -16,12 +16,12 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -33,9 +33,12 @@ def build_list_by_managed_cluster_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations") # pylint: disable=line-too-long path_format_arguments = { @@ -47,18 +50,16 @@ def build_list_by_managed_cluster_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -70,9 +71,12 @@ def build_get_request( config_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long path_format_arguments = { @@ -85,18 +89,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -107,14 +109,17 @@ def build_create_or_update_request( resource_name: str, config_name: str, *, - json: JSONType = None, + json: Optional[_models.MaintenanceConfiguration] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long path_format_arguments = { @@ -127,20 +132,18 @@ def build_create_or_update_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -154,9 +157,12 @@ def build_delete_request( config_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long path_format_arguments = { @@ -169,42 +175,38 @@ def build_delete_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class MaintenanceConfigurationsOperations(object): - """MaintenanceConfigurationsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class MaintenanceConfigurationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_02_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_02_01.ContainerServiceClient`'s + :attr:`maintenance_configurations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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_by_managed_cluster( @@ -212,7 +214,7 @@ def list_by_managed_cluster( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Iterable["_models.MaintenanceConfigurationListResult"]: + ) -> Iterable[_models.MaintenanceConfigurationListResult]: """Gets a list of maintenance configurations in the specified managed cluster. Gets a list of maintenance configurations in the specified managed cluster. @@ -228,13 +230,16 @@ def list_by_managed_cluster( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_02_01.models.MaintenanceConfigurationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfigurationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfigurationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -244,9 +249,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=self.list_by_managed_cluster.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -256,9 +263,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -298,7 +307,7 @@ def get( resource_name: str, config_name: str, **kwargs: Any - ) -> "_models.MaintenanceConfiguration": + ) -> _models.MaintenanceConfiguration: """Gets the specified maintenance configuration of a managed cluster. Gets the specified maintenance configuration of a managed cluster. @@ -314,13 +323,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.MaintenanceConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfiguration"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] request = build_get_request( @@ -330,11 +342,13 @@ def get( config_name=config_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -361,9 +375,9 @@ def create_or_update( resource_group_name: str, resource_name: str, config_name: str, - parameters: "_models.MaintenanceConfiguration", + parameters: _models.MaintenanceConfiguration, **kwargs: Any - ) -> "_models.MaintenanceConfiguration": + ) -> _models.MaintenanceConfiguration: """Creates or updates a maintenance configuration in the specified managed cluster. Creates or updates a maintenance configuration in the specified managed cluster. @@ -381,14 +395,17 @@ def create_or_update( :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.MaintenanceConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfiguration"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] _json = self._serialize.body(parameters, 'MaintenanceConfiguration') @@ -401,11 +418,13 @@ def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -449,13 +468,16 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -465,11 +487,13 @@ def delete( # pylint: disable=inconsistent-return-statements config_name=config_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/operations/_managed_clusters_operations.py index f57ce9231814..5e6712ae479e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/operations/_managed_clusters_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -36,9 +36,12 @@ def build_get_os_options_request( resource_type: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default") # pylint: disable=line-too-long path_format_arguments = { @@ -49,20 +52,18 @@ def build_get_os_options_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if resource_type is not None: - _query_parameters['resource-type'] = _SERIALIZER.query("resource_type", resource_type, 'str') + _params['resource-type'] = _SERIALIZER.query("resource_type", resource_type, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -71,9 +72,12 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters") path_format_arguments = { @@ -83,18 +87,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -104,9 +106,12 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters") # pylint: disable=line-too-long path_format_arguments = { @@ -117,18 +122,16 @@ def build_list_by_resource_group_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -139,9 +142,12 @@ def build_get_upgrade_profile_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default") # pylint: disable=line-too-long path_format_arguments = { @@ -153,18 +159,16 @@ def build_get_upgrade_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -176,9 +180,12 @@ def build_get_access_profile_request( role_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -191,18 +198,16 @@ def build_get_access_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -215,9 +220,12 @@ def build_list_cluster_admin_credentials_request( server_fqdn: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -229,20 +237,18 @@ def build_list_cluster_admin_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if server_fqdn is not None: - _query_parameters['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -256,9 +262,12 @@ def build_list_cluster_user_credentials_request( format: Optional[Union[str, "_models.Format"]] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -270,22 +279,20 @@ def build_list_cluster_user_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if server_fqdn is not None: - _query_parameters['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') if format is not None: - _query_parameters['format'] = _SERIALIZER.query("format", format, 'str') + _params['format'] = _SERIALIZER.query("format", format, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -298,9 +305,12 @@ def build_list_cluster_monitoring_user_credentials_request( server_fqdn: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -312,20 +322,18 @@ def build_list_cluster_monitoring_user_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if server_fqdn is not None: - _query_parameters['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -336,9 +344,12 @@ def build_get_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -350,18 +361,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -371,14 +380,17 @@ def build_create_or_update_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedCluster] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -390,20 +402,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -415,14 +425,17 @@ def build_update_tags_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.TagsObject] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -434,20 +447,18 @@ def build_update_tags_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -460,9 +471,12 @@ def build_delete_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -474,18 +488,16 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -495,14 +507,17 @@ def build_reset_service_principal_profile_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedClusterServicePrincipalProfile] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile") # pylint: disable=line-too-long path_format_arguments = { @@ -514,20 +529,18 @@ def build_reset_service_principal_profile_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -539,14 +552,17 @@ def build_reset_aad_profile_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedClusterAADProfile] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile") # pylint: disable=line-too-long path_format_arguments = { @@ -558,20 +574,18 @@ def build_reset_aad_profile_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -584,9 +598,12 @@ def build_rotate_cluster_certificates_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates") # pylint: disable=line-too-long path_format_arguments = { @@ -598,18 +615,16 @@ def build_rotate_cluster_certificates_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -620,9 +635,12 @@ def build_stop_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop") # pylint: disable=line-too-long path_format_arguments = { @@ -634,18 +652,16 @@ def build_stop_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -656,9 +672,12 @@ def build_start_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start") # pylint: disable=line-too-long path_format_arguments = { @@ -670,18 +689,16 @@ def build_start_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -691,14 +708,17 @@ def build_run_command_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.RunCommandRequest] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand") # pylint: disable=line-too-long path_format_arguments = { @@ -710,20 +730,18 @@ def build_run_command_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -737,9 +755,12 @@ def build_get_command_result_request( command_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}") # pylint: disable=line-too-long path_format_arguments = { @@ -752,18 +773,16 @@ def build_get_command_result_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -774,9 +793,12 @@ def build_list_outbound_network_dependencies_endpoints_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints") # pylint: disable=line-too-long path_format_arguments = { @@ -788,42 +810,38 @@ def build_list_outbound_network_dependencies_endpoints_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class ManagedClustersOperations(object): # pylint: disable=too-many-public-methods - """ManagedClustersOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ManagedClustersOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_02_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_02_01.ContainerServiceClient`'s + :attr:`managed_clusters` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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_os_options( @@ -831,7 +849,7 @@ def get_os_options( location: str, resource_type: Optional[str] = None, **kwargs: Any - ) -> "_models.OSOptionProfile": + ) -> _models.OSOptionProfile: """Gets supported OS options in the specified subscription. Gets supported OS options in the specified subscription. @@ -846,13 +864,16 @@ def get_os_options( :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.OSOptionProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OSOptionProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OSOptionProfile] request = build_get_os_options_request( @@ -861,11 +882,13 @@ def get_os_options( api_version=api_version, resource_type=resource_type, template_url=self.get_os_options.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -890,7 +913,7 @@ def get_os_options( def list( self, **kwargs: Any - ) -> Iterable["_models.ManagedClusterListResult"]: + ) -> Iterable[_models.ManagedClusterListResult]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. @@ -902,13 +925,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_02_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -916,9 +942,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -926,9 +954,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -966,7 +996,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.ManagedClusterListResult"]: + ) -> Iterable[_models.ManagedClusterListResult]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. @@ -980,13 +1010,16 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_02_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -995,9 +1028,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -1006,9 +1041,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -1047,7 +1084,7 @@ def get_upgrade_profile( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedClusterUpgradeProfile": + ) -> _models.ManagedClusterUpgradeProfile: """Gets the upgrade profile of a managed cluster. Gets the upgrade profile of a managed cluster. @@ -1061,13 +1098,16 @@ def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.ManagedClusterUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] request = build_get_upgrade_profile_request( @@ -1076,11 +1116,13 @@ def get_upgrade_profile( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1108,7 +1150,7 @@ def get_access_profile( resource_name: str, role_name: str, **kwargs: Any - ) -> "_models.ManagedClusterAccessProfile": + ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. **WARNING**\ : This API will be deprecated. Instead use `ListClusterUserCredentials @@ -1127,13 +1169,16 @@ def get_access_profile( :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.ManagedClusterAccessProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterAccessProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] request = build_get_access_profile_request( @@ -1143,11 +1188,13 @@ def get_access_profile( role_name=role_name, api_version=api_version, template_url=self.get_access_profile.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1175,7 +1222,7 @@ def list_cluster_admin_credentials( resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Lists the admin credentials of a managed cluster. Lists the admin credentials of a managed cluster. @@ -1191,13 +1238,16 @@ def list_cluster_admin_credentials( :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_admin_credentials_request( @@ -1207,11 +1257,13 @@ def list_cluster_admin_credentials( api_version=api_version, server_fqdn=server_fqdn, template_url=self.list_cluster_admin_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1240,7 +1292,7 @@ def list_cluster_user_credentials( server_fqdn: Optional[str] = None, format: Optional[Union[str, "_models.Format"]] = None, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Lists the user credentials of a managed cluster. Lists the user credentials of a managed cluster. @@ -1260,13 +1312,16 @@ def list_cluster_user_credentials( :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_user_credentials_request( @@ -1277,11 +1332,13 @@ def list_cluster_user_credentials( server_fqdn=server_fqdn, format=format, template_url=self.list_cluster_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1309,7 +1366,7 @@ def list_cluster_monitoring_user_credentials( resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Lists the cluster monitoring user credentials of a managed cluster. Lists the cluster monitoring user credentials of a managed cluster. @@ -1325,13 +1382,16 @@ def list_cluster_monitoring_user_credentials( :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_monitoring_user_credentials_request( @@ -1341,11 +1401,13 @@ def list_cluster_monitoring_user_credentials( api_version=api_version, server_fqdn=server_fqdn, template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1372,7 +1434,7 @@ def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedCluster": + ) -> _models.ManagedCluster: """Gets a managed cluster. Gets a managed cluster. @@ -1386,13 +1448,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.ManagedCluster :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] request = build_get_request( @@ -1401,11 +1466,13 @@ def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1430,17 +1497,20 @@ def _create_or_update_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'ManagedCluster') @@ -1452,11 +1522,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1486,9 +1558,9 @@ def begin_create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> LROPoller["_models.ManagedCluster"]: + ) -> LROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. Creates or updates a managed cluster. @@ -1513,37 +1585,47 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_02_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1560,17 +1642,20 @@ def _update_tags_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'TagsObject') @@ -1582,11 +1667,13 @@ def _update_tags_initial( content_type=content_type, json=_json, template_url=self._update_tags_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1612,9 +1699,9 @@ def begin_update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> LROPoller["_models.ManagedCluster"]: + ) -> LROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates tags on a managed cluster. @@ -1639,37 +1726,47 @@ def begin_update_tags( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_02_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._update_tags_initial( + raw_result = self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1688,13 +1785,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -1703,11 +1803,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1751,20 +1853,25 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_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) @@ -1774,8 +1881,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1792,17 +1905,20 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') @@ -1814,11 +1930,13 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re content_type=content_type, json=_json, template_url=self._reset_service_principal_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1840,7 +1958,7 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> LROPoller[None]: """Reset the Service Principal Profile of a managed cluster. @@ -1866,23 +1984,28 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._reset_service_principal_profile_initial( + raw_result = self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1892,8 +2015,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1910,17 +2039,20 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') @@ -1932,11 +2064,13 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement content_type=content_type, json=_json, template_url=self._reset_aad_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1958,7 +2092,7 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> LROPoller[None]: """Reset the AAD Profile of a managed cluster. @@ -1983,23 +2117,28 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._reset_aad_profile_initial( + raw_result = self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -2009,8 +2148,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2029,13 +2174,16 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_rotate_cluster_certificates_request_initial( @@ -2044,11 +2192,13 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return resource_name=resource_name, api_version=api_version, template_url=self._rotate_cluster_certificates_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2093,20 +2243,25 @@ def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-st :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._rotate_cluster_certificates_initial( + raw_result = self._rotate_cluster_certificates_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) @@ -2116,8 +2271,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2136,13 +2297,16 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_stop_request_initial( @@ -2151,11 +2315,13 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_name, api_version=api_version, template_url=self._stop_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2203,20 +2369,25 @@ def begin_stop( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._stop_initial( + raw_result = self._stop_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) @@ -2226,8 +2397,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2246,13 +2423,16 @@ def _start_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_start_request_initial( @@ -2261,11 +2441,13 @@ def _start_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_name, api_version=api_version, template_url=self._start_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2310,20 +2492,25 @@ def begin_start( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._start_initial( + raw_result = self._start_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) @@ -2333,8 +2520,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2351,17 +2544,20 @@ def _run_command_initial( self, resource_group_name: str, resource_name: str, - request_payload: "_models.RunCommandRequest", + request_payload: _models.RunCommandRequest, **kwargs: Any - ) -> Optional["_models.RunCommandResult"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RunCommandResult"]] + ) -> Optional[_models.RunCommandResult]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] _json = self._serialize.body(request_payload, 'RunCommandRequest') @@ -2373,11 +2569,13 @@ def _run_command_initial( content_type=content_type, json=_json, template_url=self._run_command_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2405,9 +2603,9 @@ def begin_run_command( self, resource_group_name: str, resource_name: str, - request_payload: "_models.RunCommandRequest", + request_payload: _models.RunCommandRequest, **kwargs: Any - ) -> LROPoller["_models.RunCommandResult"]: + ) -> LROPoller[_models.RunCommandResult]: """Submits a command to run against the Managed Cluster. AKS will create a pod to run the command. This is primarily useful for private clusters. For @@ -2434,37 +2632,47 @@ def begin_run_command( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_02_01.models.RunCommandResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.RunCommandResult] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._run_command_initial( + raw_result = self._run_command_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, request_payload=request_payload, 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): - response = pipeline_response.http_response deserialized = self._deserialize('RunCommandResult', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2484,7 +2692,7 @@ def get_command_result( resource_name: str, command_id: str, **kwargs: Any - ) -> Optional["_models.RunCommandResult"]: + ) -> Optional[_models.RunCommandResult]: """Gets the results of a command which has been run on the Managed Cluster. Gets the results of a command which has been run on the Managed Cluster. @@ -2500,13 +2708,16 @@ def get_command_result( :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.RunCommandResult or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RunCommandResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] request = build_get_command_result_request( @@ -2516,11 +2727,13 @@ def get_command_result( command_id=command_id, api_version=api_version, template_url=self.get_command_result.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2549,7 +2762,7 @@ def list_outbound_network_dependencies_endpoints( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Iterable["_models.OutboundEnvironmentEndpointCollection"]: + ) -> Iterable[_models.OutboundEnvironmentEndpointCollection]: """Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. @@ -2567,13 +2780,16 @@ def list_outbound_network_dependencies_endpoints( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_02_01.models.OutboundEnvironmentEndpointCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OutboundEnvironmentEndpointCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -2583,9 +2799,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=self.list_outbound_network_dependencies_endpoints.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -2595,9 +2813,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/operations/_operations.py index b96066209701..e877fb4797ba 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/operations/_operations.py @@ -16,6 +16,7 @@ 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 @@ -29,55 +30,54 @@ def build_list_request( **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.ContainerService/operations") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class Operations(object): - """Operations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_02_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_02_01.ContainerServiceClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> Iterable["_models.OperationListResult"]: + ) -> Iterable[_models.OperationListResult]: """Gets a list of operations. Gets a list of operations. @@ -88,31 +88,38 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_02_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/operations/_private_endpoint_connections_operations.py index da44f76d4590..6e9668571059 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/operations/_private_endpoint_connections_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast from msrest import Serializer @@ -16,13 +16,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -34,9 +34,12 @@ def build_list_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections") # pylint: disable=line-too-long path_format_arguments = { @@ -48,18 +51,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -71,9 +72,12 @@ def build_get_request( private_endpoint_connection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -86,18 +90,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -108,14 +110,17 @@ def build_update_request( resource_name: str, private_endpoint_connection_name: str, *, - json: JSONType = None, + json: Optional[_models.PrivateEndpointConnection] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -128,20 +133,18 @@ def build_update_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -155,9 +158,12 @@ def build_delete_request_initial( private_endpoint_connection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -170,42 +176,38 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class PrivateEndpointConnectionsOperations(object): - """PrivateEndpointConnectionsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class PrivateEndpointConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_02_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_02_01.ContainerServiceClient`'s + :attr:`private_endpoint_connections` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -213,7 +215,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnectionListResult": + ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. To learn more about private clusters, see: @@ -228,13 +230,16 @@ def list( :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.PrivateEndpointConnectionListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] request = build_list_request( @@ -243,11 +248,13 @@ def list( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -275,7 +282,7 @@ def get( resource_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Gets the specified private endpoint connection. To learn more about private clusters, see: @@ -292,13 +299,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] request = build_get_request( @@ -308,11 +318,13 @@ def get( private_endpoint_connection_name=private_endpoint_connection_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -339,9 +351,9 @@ def update( resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - parameters: "_models.PrivateEndpointConnection", + parameters: _models.PrivateEndpointConnection, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. Updates a private endpoint connection. @@ -359,14 +371,17 @@ def update( :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] _json = self._serialize.body(parameters, 'PrivateEndpointConnection') @@ -379,11 +394,13 @@ def update( content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -411,13 +428,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -427,11 +447,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name=private_endpoint_connection_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -478,21 +500,26 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -502,8 +529,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/operations/_private_link_resources_operations.py index b9d3e4aa0e87..9848dc3a74ad 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/operations/_private_link_resources_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/operations/_private_link_resources_operations.py @@ -15,6 +15,7 @@ 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 @@ -31,9 +32,12 @@ def build_list_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources") # pylint: disable=line-too-long path_format_arguments = { @@ -45,42 +49,38 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class PrivateLinkResourcesOperations(object): - """PrivateLinkResourcesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class PrivateLinkResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_02_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_02_01.ContainerServiceClient`'s + :attr:`private_link_resources` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -88,7 +88,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.PrivateLinkResourcesListResult": + ) -> _models.PrivateLinkResourcesListResult: """Gets a list of private link resources in the specified managed cluster. To learn more about private clusters, see: @@ -103,13 +103,16 @@ def list( :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.PrivateLinkResourcesListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourcesListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] request = build_list_request( @@ -118,11 +121,13 @@ def list( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/operations/_resolve_private_link_service_id_operations.py index 22e9deb6ab45..29b2f4ce75ad 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/operations/_resolve_private_link_service_id_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/operations/_resolve_private_link_service_id_operations.py @@ -15,12 +15,12 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -31,14 +31,17 @@ def build_post_request( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.PrivateLinkResource] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId") # pylint: disable=line-too-long path_format_arguments = { @@ -50,55 +53,51 @@ def build_post_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs ) -class ResolvePrivateLinkServiceIdOperations(object): - """ResolvePrivateLinkServiceIdOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ResolvePrivateLinkServiceIdOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_02_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_02_01.ContainerServiceClient`'s + :attr:`resolve_private_link_service_id` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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 post( self, resource_group_name: str, resource_name: str, - parameters: "_models.PrivateLinkResource", + parameters: _models.PrivateLinkResource, **kwargs: Any - ) -> "_models.PrivateLinkResource": + ) -> _models.PrivateLinkResource: """Gets the private link service ID for the specified managed cluster. Gets the private link service ID for the specified managed cluster. @@ -114,14 +113,17 @@ def post( :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.PrivateLinkResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] _json = self._serialize.body(parameters, 'PrivateLinkResource') @@ -133,11 +135,13 @@ def post( content_type=content_type, json=_json, template_url=self.post.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/operations/_snapshots_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/operations/_snapshots_operations.py index fd67e6c6543a..eeb59418f064 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/operations/_snapshots_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_01/operations/_snapshots_operations.py @@ -16,12 +16,12 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -31,9 +31,12 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots") path_format_arguments = { @@ -43,18 +46,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -64,9 +65,12 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots") # pylint: disable=line-too-long path_format_arguments = { @@ -77,18 +81,16 @@ def build_list_by_resource_group_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -99,9 +101,12 @@ def build_get_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -113,18 +118,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -134,14 +137,17 @@ def build_create_or_update_request( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.Snapshot] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -153,20 +159,18 @@ def build_create_or_update_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -178,14 +182,17 @@ def build_update_tags_request( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.TagsObject] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -197,20 +204,18 @@ def build_update_tags_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -223,9 +228,12 @@ def build_delete_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -237,48 +245,44 @@ def build_delete_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class SnapshotsOperations(object): - """SnapshotsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class SnapshotsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_02_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_02_01.ContainerServiceClient`'s + :attr:`snapshots` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> Iterable["_models.SnapshotListResult"]: + ) -> Iterable[_models.SnapshotListResult]: """Gets a list of snapshots in the specified subscription. Gets a list of snapshots in the specified subscription. @@ -289,13 +293,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_02_01.models.SnapshotListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -303,9 +310,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -313,9 +322,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -353,7 +364,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.SnapshotListResult"]: + ) -> Iterable[_models.SnapshotListResult]: """Lists snapshots in the specified subscription and resource group. Lists snapshots in the specified subscription and resource group. @@ -366,13 +377,16 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_02_01.models.SnapshotListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -381,9 +395,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -392,9 +408,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -433,7 +451,7 @@ def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.Snapshot": + ) -> _models.Snapshot: """Gets a snapshot. Gets a snapshot. @@ -447,13 +465,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.Snapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] request = build_get_request( @@ -462,11 +483,13 @@ def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -492,9 +515,9 @@ def create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.Snapshot", + parameters: _models.Snapshot, **kwargs: Any - ) -> "_models.Snapshot": + ) -> _models.Snapshot: """Creates or updates a snapshot. Creates or updates a snapshot. @@ -510,14 +533,17 @@ def create_or_update( :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.Snapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] _json = self._serialize.body(parameters, 'Snapshot') @@ -529,11 +555,13 @@ def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -563,9 +591,9 @@ def update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.Snapshot": + ) -> _models.Snapshot: """Updates tags on a snapshot. Updates tags on a snapshot. @@ -581,14 +609,17 @@ def update_tags( :rtype: ~azure.mgmt.containerservice.v2022_02_01.models.Snapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] _json = self._serialize.body(parameters, 'TagsObject') @@ -600,11 +631,13 @@ def update_tags( content_type=content_type, json=_json, template_url=self.update_tags.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -645,13 +678,16 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -660,11 +696,13 @@ def delete( # pylint: disable=inconsistent-return-statements resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/__init__.py index 53c675bd95e2..37a5f9e02e6f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._container_service_client import ContainerServiceClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['ContainerServiceClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/_container_service_client.py index 5ce36a1d74a1..2eb0b6d81cda 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/_container_service_client.py @@ -78,15 +78,33 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.managed_clusters = ManagedClustersOperations(self._client, self._config, self._serialize, self._deserialize) - self.maintenance_configurations = MaintenanceConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) - self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) - self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations(self._client, self._config, self._serialize, self._deserialize) - self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) - self.managed_cluster_snapshots = ManagedClusterSnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_clusters = ManagedClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.maintenance_configurations = MaintenanceConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.agent_pools = AgentPoolsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.snapshots = SnapshotsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_cluster_snapshots = ManagedClusterSnapshotsOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/__init__.py index 53c675bd95e2..37a5f9e02e6f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._container_service_client import ContainerServiceClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['ContainerServiceClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/_container_service_client.py index 3bc1a1bf9c7d..87f65111688d 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/_container_service_client.py @@ -78,15 +78,33 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.managed_clusters = ManagedClustersOperations(self._client, self._config, self._serialize, self._deserialize) - self.maintenance_configurations = MaintenanceConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) - self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) - self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations(self._client, self._config, self._serialize, self._deserialize) - self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) - self.managed_cluster_snapshots = ManagedClusterSnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_clusters = ManagedClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.maintenance_configurations = MaintenanceConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.agent_pools = AgentPoolsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.snapshots = SnapshotsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_cluster_snapshots = ManagedClusterSnapshotsOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/operations/__init__.py index 78e2791463ed..d3b41c8a72b0 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/operations/__init__.py @@ -16,6 +16,9 @@ from ._snapshots_operations import SnapshotsOperations from ._managed_cluster_snapshots_operations import ManagedClusterSnapshotsOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'Operations', 'ManagedClustersOperations', @@ -27,3 +30,5 @@ 'SnapshotsOperations', 'ManagedClusterSnapshotsOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/operations/_agent_pools_operations.py index 705bf00c6f4a..8f5df18c0bff 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/operations/_agent_pools_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. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ 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 @@ -26,26 +27,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class AgentPoolsOperations: - """AgentPoolsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_02_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_02_02_preview.aio.ContainerServiceClient`'s + :attr:`agent_pools` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -53,7 +52,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> AsyncIterable["_models.AgentPoolListResult"]: + ) -> AsyncIterable[_models.AgentPoolListResult]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. @@ -68,13 +67,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_02_02_preview.models.AgentPoolListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -84,9 +86,11 @@ def prepare_request(next_link=None): resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -96,9 +100,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -138,7 +144,7 @@ async def get( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPool": + ) -> _models.AgentPool: """Gets the specified managed cluster agent pool. Gets the specified managed cluster agent pool. @@ -154,13 +160,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.AgentPool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] request = build_get_request( @@ -170,11 +179,13 @@ async def get( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -200,17 +211,20 @@ async def _create_or_update_initial( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> "_models.AgentPool": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] + ) -> _models.AgentPool: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-02-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] _json = self._serialize.body(parameters, 'AgentPool') @@ -223,11 +237,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -258,9 +274,9 @@ async def begin_create_or_update( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> AsyncLROPoller["_models.AgentPool"]: + ) -> AsyncLROPoller[_models.AgentPool]: """Creates or updates an agent pool in the specified managed cluster. Creates or updates an agent pool in the specified managed cluster. @@ -287,17 +303,20 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_02_02_preview.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, @@ -305,20 +324,27 @@ async def begin_create_or_update( 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): - response = pipeline_response.http_response deserialized = self._deserialize('AgentPool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -338,13 +364,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements agent_pool_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -354,11 +383,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -405,21 +436,26 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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) @@ -429,8 +465,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -450,7 +492,7 @@ async def get_upgrade_profile( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPoolUpgradeProfile": + ) -> _models.AgentPoolUpgradeProfile: """Gets the upgrade profile for an agent pool. Gets the upgrade profile for an agent pool. @@ -466,13 +508,16 @@ async def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.AgentPoolUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] request = build_get_upgrade_profile_request( @@ -482,11 +527,13 @@ async def get_upgrade_profile( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -513,7 +560,7 @@ async def get_available_agent_pool_versions( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.AgentPoolAvailableVersions": + ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported Kubernetes versions for the specified agent pool. See `supported Kubernetes versions @@ -529,13 +576,16 @@ async def get_available_agent_pool_versions( :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.AgentPoolAvailableVersions :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolAvailableVersions"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] request = build_get_available_agent_pool_versions_request( @@ -544,11 +594,13 @@ async def get_available_agent_pool_versions( resource_name=resource_name, api_version=api_version, template_url=self.get_available_agent_pool_versions.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -575,14 +627,17 @@ async def _upgrade_node_image_version_initial( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> Optional["_models.AgentPool"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.AgentPool"]] + ) -> Optional[_models.AgentPool]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] request = build_upgrade_node_image_version_request_initial( @@ -592,11 +647,13 @@ async def _upgrade_node_image_version_initial( agent_pool_name=agent_pool_name, api_version=api_version, template_url=self._upgrade_node_image_version_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -629,7 +686,7 @@ async def begin_upgrade_node_image_version( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> AsyncLROPoller["_models.AgentPool"]: + ) -> AsyncLROPoller[_models.AgentPool]: """Upgrades the node image version of an agent pool to the latest. Upgrading the node image version of an agent pool applies the newest OS and runtime updates to @@ -656,21 +713,26 @@ async def begin_upgrade_node_image_version( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_02_02_preview.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._upgrade_node_image_version_initial( + raw_result = await self._upgrade_node_image_version_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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) @@ -686,8 +748,14 @@ def get_long_running_output(pipeline_response): return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/operations/_maintenance_configurations_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/operations/_maintenance_configurations_operations.py index 7c339179d6b0..2918677ea9a2 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/operations/_maintenance_configurations_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/operations/_maintenance_configurations_operations.py @@ -15,6 +15,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -24,26 +25,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class MaintenanceConfigurationsOperations: - """MaintenanceConfigurationsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_02_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_02_02_preview.aio.ContainerServiceClient`'s + :attr:`maintenance_configurations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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_by_managed_cluster( @@ -51,7 +50,7 @@ def list_by_managed_cluster( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> AsyncIterable["_models.MaintenanceConfigurationListResult"]: + ) -> AsyncIterable[_models.MaintenanceConfigurationListResult]: """Gets a list of maintenance configurations in the specified managed cluster. Gets a list of maintenance configurations in the specified managed cluster. @@ -67,13 +66,16 @@ def list_by_managed_cluster( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_02_02_preview.models.MaintenanceConfigurationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfigurationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfigurationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -83,9 +85,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=self.list_by_managed_cluster.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -95,9 +99,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -137,7 +143,7 @@ async def get( resource_name: str, config_name: str, **kwargs: Any - ) -> "_models.MaintenanceConfiguration": + ) -> _models.MaintenanceConfiguration: """Gets the specified maintenance configuration of a managed cluster. Gets the specified maintenance configuration of a managed cluster. @@ -153,13 +159,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.MaintenanceConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfiguration"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] request = build_get_request( @@ -169,11 +178,13 @@ async def get( config_name=config_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -200,9 +211,9 @@ async def create_or_update( resource_group_name: str, resource_name: str, config_name: str, - parameters: "_models.MaintenanceConfiguration", + parameters: _models.MaintenanceConfiguration, **kwargs: Any - ) -> "_models.MaintenanceConfiguration": + ) -> _models.MaintenanceConfiguration: """Creates or updates a maintenance configuration in the specified managed cluster. Creates or updates a maintenance configuration in the specified managed cluster. @@ -221,14 +232,17 @@ async def create_or_update( :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.MaintenanceConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfiguration"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] _json = self._serialize.body(parameters, 'MaintenanceConfiguration') @@ -241,11 +255,13 @@ async def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -289,13 +305,16 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -305,11 +324,13 @@ async def delete( # pylint: disable=inconsistent-return-statements config_name=config_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/operations/_managed_cluster_snapshots_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/operations/_managed_cluster_snapshots_operations.py index 280462f451ba..6b05185e6313 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/operations/_managed_cluster_snapshots_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/operations/_managed_cluster_snapshots_operations.py @@ -15,6 +15,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -24,32 +25,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ManagedClusterSnapshotsOperations: - """ManagedClusterSnapshotsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_02_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_02_02_preview.aio.ContainerServiceClient`'s + :attr:`managed_cluster_snapshots` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.ManagedClusterSnapshotListResult"]: + ) -> AsyncIterable[_models.ManagedClusterSnapshotListResult]: """Gets a list of managed cluster snapshots in the specified subscription. Gets a list of managed cluster snapshots in the specified subscription. @@ -61,13 +60,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedClusterSnapshotListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshotListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterSnapshotListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -75,9 +77,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -85,9 +89,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -125,7 +131,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ManagedClusterSnapshotListResult"]: + ) -> AsyncIterable[_models.ManagedClusterSnapshotListResult]: """Lists managed cluster snapshots in the specified subscription and resource group. Lists managed cluster snapshots in the specified subscription and resource group. @@ -139,13 +145,16 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedClusterSnapshotListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshotListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterSnapshotListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -154,9 +163,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -165,9 +176,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -206,7 +219,7 @@ async def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedClusterSnapshot": + ) -> _models.ManagedClusterSnapshot: """Gets a managed cluster snapshot. Gets a managed cluster snapshot. @@ -220,13 +233,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedClusterSnapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterSnapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshot] request = build_get_request( @@ -235,11 +251,13 @@ async def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -265,9 +283,9 @@ async def create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterSnapshot", + parameters: _models.ManagedClusterSnapshot, **kwargs: Any - ) -> "_models.ManagedClusterSnapshot": + ) -> _models.ManagedClusterSnapshot: """Creates or updates a managed cluster snapshot. Creates or updates a managed cluster snapshot. @@ -284,14 +302,17 @@ async def create_or_update( :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedClusterSnapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterSnapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshot] _json = self._serialize.body(parameters, 'ManagedClusterSnapshot') @@ -303,11 +324,13 @@ async def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -337,9 +360,9 @@ async def update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.ManagedClusterSnapshot": + ) -> _models.ManagedClusterSnapshot: """Updates tags on a managed cluster snapshot. Updates tags on a managed cluster snapshot. @@ -355,14 +378,17 @@ async def update_tags( :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedClusterSnapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterSnapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-02-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshot] _json = self._serialize.body(parameters, 'TagsObject') @@ -374,11 +400,13 @@ async def update_tags( content_type=content_type, json=_json, template_url=self.update_tags.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -419,13 +447,16 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -434,11 +465,13 @@ async def delete( # pylint: disable=inconsistent-return-statements resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/operations/_managed_clusters_operations.py index 9d86e7fdf50d..12808f72985a 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/operations/_managed_clusters_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. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ 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 @@ -26,26 +27,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ManagedClustersOperations: # pylint: disable=too-many-public-methods - """ManagedClustersOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_02_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_02_02_preview.aio.ContainerServiceClient`'s + :attr:`managed_clusters` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace_async async def get_os_options( @@ -53,7 +52,7 @@ async def get_os_options( location: str, resource_type: Optional[str] = None, **kwargs: Any - ) -> "_models.OSOptionProfile": + ) -> _models.OSOptionProfile: """Gets supported OS options in the specified subscription. Gets supported OS options in the specified subscription. @@ -68,13 +67,16 @@ async def get_os_options( :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.OSOptionProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OSOptionProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OSOptionProfile] request = build_get_os_options_request( @@ -83,11 +85,13 @@ async def get_os_options( api_version=api_version, resource_type=resource_type, template_url=self.get_os_options.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -112,7 +116,7 @@ async def get_os_options( def list( self, **kwargs: Any - ) -> AsyncIterable["_models.ManagedClusterListResult"]: + ) -> AsyncIterable[_models.ManagedClusterListResult]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. @@ -124,13 +128,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -138,9 +145,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -148,9 +157,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -188,7 +199,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ManagedClusterListResult"]: + ) -> AsyncIterable[_models.ManagedClusterListResult]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. @@ -202,13 +213,16 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -217,9 +231,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -228,9 +244,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -269,7 +287,7 @@ async def get_upgrade_profile( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedClusterUpgradeProfile": + ) -> _models.ManagedClusterUpgradeProfile: """Gets the upgrade profile of a managed cluster. Gets the upgrade profile of a managed cluster. @@ -283,13 +301,16 @@ async def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedClusterUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] request = build_get_upgrade_profile_request( @@ -298,11 +319,13 @@ async def get_upgrade_profile( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -330,7 +353,7 @@ async def get_access_profile( resource_name: str, role_name: str, **kwargs: Any - ) -> "_models.ManagedClusterAccessProfile": + ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. **WARNING**\ : This API will be deprecated. Instead use `ListClusterUserCredentials @@ -349,13 +372,16 @@ async def get_access_profile( :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedClusterAccessProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterAccessProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] request = build_get_access_profile_request( @@ -365,11 +391,13 @@ async def get_access_profile( role_name=role_name, api_version=api_version, template_url=self.get_access_profile.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -397,7 +425,7 @@ async def list_cluster_admin_credentials( resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Lists the admin credentials of a managed cluster. Lists the admin credentials of a managed cluster. @@ -413,13 +441,16 @@ async def list_cluster_admin_credentials( :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_admin_credentials_request( @@ -429,11 +460,13 @@ async def list_cluster_admin_credentials( api_version=api_version, server_fqdn=server_fqdn, template_url=self.list_cluster_admin_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -462,7 +495,7 @@ async def list_cluster_user_credentials( server_fqdn: Optional[str] = None, format: Optional[Union[str, "_models.Format"]] = None, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Lists the user credentials of a managed cluster. Lists the user credentials of a managed cluster. @@ -482,13 +515,16 @@ async def list_cluster_user_credentials( :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_user_credentials_request( @@ -499,11 +535,13 @@ async def list_cluster_user_credentials( server_fqdn=server_fqdn, format=format, template_url=self.list_cluster_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -531,7 +569,7 @@ async def list_cluster_monitoring_user_credentials( resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Lists the cluster monitoring user credentials of a managed cluster. Lists the cluster monitoring user credentials of a managed cluster. @@ -547,13 +585,16 @@ async def list_cluster_monitoring_user_credentials( :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_monitoring_user_credentials_request( @@ -563,11 +604,13 @@ async def list_cluster_monitoring_user_credentials( api_version=api_version, server_fqdn=server_fqdn, template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -594,7 +637,7 @@ async def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedCluster": + ) -> _models.ManagedCluster: """Gets a managed cluster. Gets a managed cluster. @@ -608,13 +651,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedCluster :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] request = build_get_request( @@ -623,11 +669,13 @@ async def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -652,17 +700,20 @@ async def _create_or_update_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-02-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'ManagedCluster') @@ -674,11 +725,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -708,9 +761,9 @@ async def begin_create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> AsyncLROPoller["_models.ManagedCluster"]: + ) -> AsyncLROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. Creates or updates a managed cluster. @@ -735,37 +788,47 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -782,17 +845,20 @@ async def _update_tags_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-02-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'TagsObject') @@ -804,11 +870,13 @@ async def _update_tags_initial( content_type=content_type, json=_json, template_url=self._update_tags_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -834,9 +902,9 @@ async def begin_update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> AsyncLROPoller["_models.ManagedCluster"]: + ) -> AsyncLROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates tags on a managed cluster. @@ -861,37 +929,47 @@ async def begin_update_tags( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._update_tags_initial( + raw_result = await self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -910,13 +988,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -925,11 +1006,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -973,20 +1056,25 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_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) @@ -996,8 +1084,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1014,17 +1108,20 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-02-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') @@ -1036,11 +1133,13 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist content_type=content_type, json=_json, template_url=self._reset_service_principal_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1062,7 +1161,7 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> AsyncLROPoller[None]: """Reset the Service Principal Profile of a managed cluster. @@ -1088,23 +1187,28 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._reset_service_principal_profile_initial( + raw_result = await self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1114,8 +1218,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1132,17 +1242,20 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') @@ -1154,11 +1267,13 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta content_type=content_type, json=_json, template_url=self._reset_aad_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1180,7 +1295,7 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> AsyncLROPoller[None]: """Reset the AAD Profile of a managed cluster. @@ -1206,23 +1321,28 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._reset_aad_profile_initial( + raw_result = await self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1232,8 +1352,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1252,13 +1378,16 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_rotate_cluster_certificates_request_initial( @@ -1267,11 +1396,13 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- resource_name=resource_name, api_version=api_version, template_url=self._rotate_cluster_certificates_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1316,20 +1447,25 @@ async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-ret :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._rotate_cluster_certificates_initial( + raw_result = await self._rotate_cluster_certificates_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) @@ -1339,8 +1475,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1359,13 +1501,16 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_stop_request_initial( @@ -1374,11 +1519,13 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_name, api_version=api_version, template_url=self._stop_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1426,20 +1573,25 @@ async def begin_stop( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._stop_initial( + raw_result = await self._stop_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) @@ -1449,8 +1601,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1469,13 +1627,16 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_start_request_initial( @@ -1484,11 +1645,13 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_name, api_version=api_version, template_url=self._start_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1533,20 +1696,25 @@ async def begin_start( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._start_initial( + raw_result = await self._start_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) @@ -1556,8 +1724,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1574,17 +1748,20 @@ async def _run_command_initial( self, resource_group_name: str, resource_name: str, - request_payload: "_models.RunCommandRequest", + request_payload: _models.RunCommandRequest, **kwargs: Any - ) -> Optional["_models.RunCommandResult"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RunCommandResult"]] + ) -> Optional[_models.RunCommandResult]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-02-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] _json = self._serialize.body(request_payload, 'RunCommandRequest') @@ -1596,11 +1773,13 @@ async def _run_command_initial( content_type=content_type, json=_json, template_url=self._run_command_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1628,9 +1807,9 @@ async def begin_run_command( self, resource_group_name: str, resource_name: str, - request_payload: "_models.RunCommandRequest", + request_payload: _models.RunCommandRequest, **kwargs: Any - ) -> AsyncLROPoller["_models.RunCommandResult"]: + ) -> AsyncLROPoller[_models.RunCommandResult]: """Submits a command to run against the Managed Cluster. AKS will create a pod to run the command. This is primarily useful for private clusters. For @@ -1658,37 +1837,47 @@ async def begin_run_command( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_02_02_preview.models.RunCommandResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.RunCommandResult] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._run_command_initial( + raw_result = await self._run_command_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, request_payload=request_payload, 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): - response = pipeline_response.http_response deserialized = self._deserialize('RunCommandResult', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1708,7 +1897,7 @@ async def get_command_result( resource_name: str, command_id: str, **kwargs: Any - ) -> Optional["_models.RunCommandResult"]: + ) -> Optional[_models.RunCommandResult]: """Gets the results of a command which has been run on the Managed Cluster. Gets the results of a command which has been run on the Managed Cluster. @@ -1724,13 +1913,16 @@ async def get_command_result( :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.RunCommandResult or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RunCommandResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] request = build_get_command_result_request( @@ -1740,11 +1932,13 @@ async def get_command_result( command_id=command_id, api_version=api_version, template_url=self.get_command_result.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1773,7 +1967,7 @@ def list_outbound_network_dependencies_endpoints( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> AsyncIterable["_models.OutboundEnvironmentEndpointCollection"]: + ) -> AsyncIterable[_models.OutboundEnvironmentEndpointCollection]: """Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. @@ -1791,13 +1985,16 @@ def list_outbound_network_dependencies_endpoints( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_02_02_preview.models.OutboundEnvironmentEndpointCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OutboundEnvironmentEndpointCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -1807,9 +2004,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=self.list_outbound_network_dependencies_endpoints.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -1819,9 +2018,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/operations/_operations.py index 5b943781e83e..632fa81ac1c5 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/operations/_operations.py @@ -14,6 +14,7 @@ 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 @@ -23,32 +24,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class Operations: - """Operations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_02_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_02_02_preview.aio.ContainerServiceClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.OperationListResult"]: + ) -> AsyncIterable[_models.OperationListResult]: """Gets a list of operations. Gets a list of operations. @@ -59,31 +58,38 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_02_02_preview.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/operations/_private_endpoint_connections_operations.py index 22fa04cf9cf2..8dbe43d887fd 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/operations/_private_endpoint_connections_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -14,6 +14,7 @@ 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 @@ -24,26 +25,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class PrivateEndpointConnectionsOperations: - """PrivateEndpointConnectionsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_02_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_02_02_preview.aio.ContainerServiceClient`'s + :attr:`private_endpoint_connections` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -51,7 +50,7 @@ async def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnectionListResult": + ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. To learn more about private clusters, see: @@ -67,13 +66,16 @@ async def list( ~azure.mgmt.containerservice.v2022_02_02_preview.models.PrivateEndpointConnectionListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] request = build_list_request( @@ -82,11 +84,13 @@ async def list( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -114,7 +118,7 @@ async def get( resource_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Gets the specified private endpoint connection. To learn more about private clusters, see: @@ -131,13 +135,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] request = build_get_request( @@ -147,11 +154,13 @@ async def get( private_endpoint_connection_name=private_endpoint_connection_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -178,9 +187,9 @@ async def update( resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - parameters: "_models.PrivateEndpointConnection", + parameters: _models.PrivateEndpointConnection, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. Updates a private endpoint connection. @@ -199,14 +208,17 @@ async def update( :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-02-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] _json = self._serialize.body(parameters, 'PrivateEndpointConnection') @@ -219,11 +231,13 @@ async def update( content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -251,13 +265,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -267,11 +284,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name=private_endpoint_connection_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -318,21 +337,26 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -342,8 +366,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/operations/_private_link_resources_operations.py index 07c9fcd642e4..07dc63801af4 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/operations/_private_link_resources_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/operations/_private_link_resources_operations.py @@ -13,6 +13,7 @@ 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 @@ -22,26 +23,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class PrivateLinkResourcesOperations: - """PrivateLinkResourcesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_02_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_02_02_preview.aio.ContainerServiceClient`'s + :attr:`private_link_resources` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -49,7 +48,7 @@ async def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.PrivateLinkResourcesListResult": + ) -> _models.PrivateLinkResourcesListResult: """Gets a list of private link resources in the specified managed cluster. To learn more about private clusters, see: @@ -64,13 +63,16 @@ async def list( :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.PrivateLinkResourcesListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourcesListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] request = build_list_request( @@ -79,11 +81,13 @@ async def list( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/operations/_resolve_private_link_service_id_operations.py index 579dfd85ef23..be0d353c750a 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/operations/_resolve_private_link_service_id_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/operations/_resolve_private_link_service_id_operations.py @@ -13,6 +13,7 @@ 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 @@ -22,35 +23,33 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ResolvePrivateLinkServiceIdOperations: - """ResolvePrivateLinkServiceIdOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_02_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_02_02_preview.aio.ContainerServiceClient`'s + :attr:`resolve_private_link_service_id` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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 post( self, resource_group_name: str, resource_name: str, - parameters: "_models.PrivateLinkResource", + parameters: _models.PrivateLinkResource, **kwargs: Any - ) -> "_models.PrivateLinkResource": + ) -> _models.PrivateLinkResource: """Gets the private link service ID for the specified managed cluster. Gets the private link service ID for the specified managed cluster. @@ -66,14 +65,17 @@ async def post( :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.PrivateLinkResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-02-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] _json = self._serialize.body(parameters, 'PrivateLinkResource') @@ -85,11 +87,13 @@ async def post( content_type=content_type, json=_json, template_url=self.post.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/operations/_snapshots_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/operations/_snapshots_operations.py index 0e89b8167f4b..4d39003c6ea4 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/operations/_snapshots_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/aio/operations/_snapshots_operations.py @@ -15,6 +15,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -24,32 +25,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class SnapshotsOperations: - """SnapshotsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_02_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_02_02_preview.aio.ContainerServiceClient`'s + :attr:`snapshots` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.SnapshotListResult"]: + ) -> AsyncIterable[_models.SnapshotListResult]: """Gets a list of snapshots in the specified subscription. Gets a list of snapshots in the specified subscription. @@ -60,13 +59,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_02_02_preview.models.SnapshotListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -74,9 +76,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -84,9 +88,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -124,7 +130,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.SnapshotListResult"]: + ) -> AsyncIterable[_models.SnapshotListResult]: """Lists snapshots in the specified subscription and resource group. Lists snapshots in the specified subscription and resource group. @@ -137,13 +143,16 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_02_02_preview.models.SnapshotListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -152,9 +161,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -163,9 +174,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -204,7 +217,7 @@ async def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.Snapshot": + ) -> _models.Snapshot: """Gets a snapshot. Gets a snapshot. @@ -218,13 +231,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.Snapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] request = build_get_request( @@ -233,11 +249,13 @@ async def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -263,9 +281,9 @@ async def create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.Snapshot", + parameters: _models.Snapshot, **kwargs: Any - ) -> "_models.Snapshot": + ) -> _models.Snapshot: """Creates or updates a snapshot. Creates or updates a snapshot. @@ -281,14 +299,17 @@ async def create_or_update( :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.Snapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] _json = self._serialize.body(parameters, 'Snapshot') @@ -300,11 +321,13 @@ async def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -334,9 +357,9 @@ async def update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.Snapshot": + ) -> _models.Snapshot: """Updates tags on a snapshot. Updates tags on a snapshot. @@ -352,14 +375,17 @@ async def update_tags( :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.Snapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-02-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] _json = self._serialize.body(parameters, 'TagsObject') @@ -371,11 +397,13 @@ async def update_tags( content_type=content_type, json=_json, template_url=self.update_tags.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -416,13 +444,16 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -431,11 +462,13 @@ async def delete( # pylint: disable=inconsistent-return-statements resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/models/__init__.py index 992c9c7bd17d..6b6acf7cb4ef 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/models/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/models/__init__.py @@ -138,7 +138,9 @@ WeekDay, WorkloadRuntime, ) - +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'AgentPool', 'AgentPoolAvailableVersions', @@ -269,3 +271,5 @@ 'WeekDay', 'WorkloadRuntime', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/models/_container_service_client_enums.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/models/_container_service_client_enums.py index 375009a44e5b..c66d7c8a922b 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/models/_container_service_client_enums.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/models/_container_service_client_enums.py @@ -7,11 +7,10 @@ # -------------------------------------------------------------------------- from enum import Enum -from six import with_metaclass from azure.core import CaseInsensitiveEnumMeta -class AgentPoolMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class AgentPoolMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: https://docs.microsoft.com/azure/aks/use-system-pools @@ -24,7 +23,7 @@ class AgentPoolMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: User agent pools are primarily for hosting your application pods. USER = "User" -class AgentPoolType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class AgentPoolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of Agent Pool. """ @@ -33,7 +32,7 @@ class AgentPoolType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Use of this is strongly discouraged. AVAILABILITY_SET = "AvailabilitySet" -class Code(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class Code(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Tells whether the cluster is Running or Stopped """ @@ -42,7 +41,7 @@ class Code(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: The cluster is stopped. STOPPED = "Stopped" -class ConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The private link service connection status. """ @@ -51,7 +50,7 @@ class ConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): REJECTED = "Rejected" DISCONNECTED = "Disconnected" -class ContainerServiceStorageProfileTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Specifies what kind of storage to use. If omitted, the default will be chosen on your behalf based on the choice of orchestrator. """ @@ -59,7 +58,7 @@ class ContainerServiceStorageProfileTypes(with_metaclass(CaseInsensitiveEnumMeta STORAGE_ACCOUNT = "StorageAccount" MANAGED_DISKS = "ManagedDisks" -class ContainerServiceVMSizeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Size of agent VMs. Note: This is no longer maintained. """ @@ -238,7 +237,7 @@ class ContainerServiceVMSizeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, E STANDARD_NV24 = "Standard_NV24" STANDARD_NV6 = "Standard_NV6" -class Count(with_metaclass(CaseInsensitiveEnumMeta, int, Enum)): +class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): """Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, and 5. The default value is 1. """ @@ -247,7 +246,7 @@ class Count(with_metaclass(CaseInsensitiveEnumMeta, int, Enum)): THREE = 3 FIVE = 5 -class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of identity that created the resource. """ @@ -256,7 +255,7 @@ class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class Expander(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class Expander(str, Enum, metaclass=CaseInsensitiveEnumMeta): """If not specified, the default is 'random'. See `expanders `_ for more information. @@ -279,13 +278,13 @@ class Expander(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Used when you don't have a particular need for the node groups to scale differently. RANDOM = "random" -class ExtendedLocationTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ExtendedLocationTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of extendedLocation. """ EDGE_ZONE = "EdgeZone" -class Format(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class Format(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Return azure auth-provider kubeconfig. This format is deprecated in 1.22 and will be fully #: removed in 1.25. @@ -293,7 +292,7 @@ class Format(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Return exec format kubeconfig. This format requires kubelogin binary in the path. EXEC_ENUM = "exec" -class GPUInstanceProfile(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class GPUInstanceProfile(str, Enum, metaclass=CaseInsensitiveEnumMeta): """GPUInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU. """ @@ -303,14 +302,14 @@ class GPUInstanceProfile(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MIG4_G = "MIG4g" MIG7_G = "MIG7g" -class IpFamily(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class IpFamily(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The IP version to use for cluster networking and IP assignment. """ I_PV4 = "IPv4" I_PV6 = "IPv6" -class KubeletDiskType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class KubeletDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. """ @@ -320,7 +319,7 @@ class KubeletDiskType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Kubelet will use the temporary disk for its data. TEMPORARY = "Temporary" -class LicenseType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class LicenseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The license type to use for Windows VMs. See `Azure Hybrid User Benefits `_ for more details. """ @@ -330,7 +329,7 @@ class LicenseType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Enables Azure Hybrid User Benefits for Windows VMs. WINDOWS_SERVER = "Windows_Server" -class LoadBalancerSku(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class LoadBalancerSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the differences between load balancer SKUs. @@ -343,7 +342,7 @@ class LoadBalancerSku(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Use a basic Load Balancer with limited functionality. BASIC = "basic" -class ManagedClusterPodIdentityProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ManagedClusterPodIdentityProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The current provisioning state of the pod identity. """ @@ -352,13 +351,13 @@ class ManagedClusterPodIdentityProvisioningState(with_metaclass(CaseInsensitiveE DELETING = "Deleting" FAILED = "Failed" -class ManagedClusterSKUName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ManagedClusterSKUName(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The name of a managed cluster SKU. """ BASIC = "Basic" -class ManagedClusterSKUTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ManagedClusterSKUTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): """If not specified, the default is 'Free'. See `uptime SLA `_ for more details. """ @@ -369,7 +368,7 @@ class ManagedClusterSKUTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: No guaranteed SLA, no additional charges. Free tier clusters have an SLO of 99.5%. FREE = "Free" -class NetworkMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """This cannot be specified if networkPlugin is anything other than 'azure'. """ @@ -380,7 +379,7 @@ class NetworkMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: This is no longer supported. BRIDGE = "bridge" -class NetworkPlugin(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkPlugin(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Network plugin used for building the Kubernetes network. """ @@ -396,7 +395,7 @@ class NetworkPlugin(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: networking functionality. NONE = "none" -class NetworkPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Network policy used for building the Kubernetes network. """ @@ -409,7 +408,7 @@ class NetworkPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: for more information. AZURE = "azure" -class OSDiskType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OSDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS @@ -425,14 +424,14 @@ class OSDiskType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: provides lower read/write latency, along with faster node scaling and cluster upgrades. EPHEMERAL = "Ephemeral" -class OSSKU(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OSSKU(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Specifies an OS SKU. This value must not be specified if OSType is Windows. """ UBUNTU = "Ubuntu" CBL_MARINER = "CBLMariner" -class OSType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The operating system type. The default is Linux. """ @@ -441,7 +440,7 @@ class OSType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Use Windows. WINDOWS = "Windows" -class OutboundType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OutboundType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type `_. """ @@ -461,7 +460,7 @@ class OutboundType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: advanced scenario and requires proper network configuration. USER_ASSIGNED_NAT_GATEWAY = "userAssignedNATGateway" -class PrivateEndpointConnectionProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class PrivateEndpointConnectionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The current provisioning state. """ @@ -470,14 +469,14 @@ class PrivateEndpointConnectionProvisioningState(with_metaclass(CaseInsensitiveE DELETING = "Deleting" FAILED = "Failed" -class PublicNetworkAccess(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class PublicNetworkAccess(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Allow or deny public network access for AKS """ ENABLED = "Enabled" DISABLED = "Disabled" -class ResourceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """For more information see `use managed identities in AKS `_. """ @@ -493,7 +492,7 @@ class ResourceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Do not use a managed identity for the Managed Cluster, service principal will be used instead. NONE = "None" -class ScaleDownMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ScaleDownMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Describes how VMs are added to or removed from Agent Pools. See `billing states `_. """ @@ -504,7 +503,7 @@ class ScaleDownMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: during scale down. DEALLOCATE = "Deallocate" -class ScaleSetEvictionPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The eviction policy specifies what to do with the VM when it is evicted. The default is Delete. For more information about eviction see `spot VMs `_ @@ -517,7 +516,7 @@ class ScaleSetEvictionPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)) #: cause issues with cluster scaling or upgrading. DEALLOCATE = "Deallocate" -class ScaleSetPriority(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ScaleSetPriority(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The Virtual Machine Scale Set priority. """ @@ -527,7 +526,7 @@ class ScaleSetPriority(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Regular VMs will be used. REGULAR = "Regular" -class SnapshotType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SnapshotType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of a snapshot. The default is NodePool. """ @@ -536,7 +535,7 @@ class SnapshotType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: The snapshot is a snapshot of a managed cluster. MANAGED_CLUSTER = "ManagedCluster" -class UpgradeChannel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class UpgradeChannel(str, Enum, metaclass=CaseInsensitiveEnumMeta): """For more information see `setting the AKS cluster auto-upgrade channel `_. """ @@ -566,7 +565,7 @@ class UpgradeChannel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Disables auto-upgrades and keeps the cluster at its current version of Kubernetes. NONE = "none" -class WeekDay(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class WeekDay(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The weekday enum. """ @@ -578,7 +577,7 @@ class WeekDay(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): FRIDAY = "Friday" SATURDAY = "Saturday" -class WorkloadRuntime(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class WorkloadRuntime(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Determines the type of workload a node can run. """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/models/_models_py3.py index 27b55c4284ca..559241ff4796 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/models/_models_py3.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/models/_models_py3.py @@ -7,11 +7,13 @@ # -------------------------------------------------------------------------- import datetime -from typing import Dict, List, Optional, Union +from typing import Dict, List, Optional, TYPE_CHECKING, Union import msrest.serialization -from ._container_service_client_enums import * +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + import __init__ as _models class SubResource(msrest.serialization.Model): @@ -79,16 +81,16 @@ class AgentPool(SubResource): :ivar os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS - `_. Possible values - include: "Managed", "Ephemeral". + `_. Known values are: + "Managed", "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Possible values include: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.KubeletDiskType - :ivar workload_runtime: Determines the type of workload a node can run. Possible values - include: "OCIContainer", "WasmWasi". + :ivar workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer", "WasmWasi". :vartype workload_runtime: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.WorkloadRuntime :ivar message_of_the_day: A base64-encoded string which will be written to /etc/motd after @@ -107,11 +109,11 @@ class AgentPool(SubResource): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.OSType - :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Possible values include: "Ubuntu", "CBLMariner". + :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known + values are: "Ubuntu", "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. :vartype max_count: int @@ -120,17 +122,16 @@ class AgentPool(SubResource): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it - defaults to Delete. Possible values include: "Delete", "Deallocate". + defaults to Delete. Known values are: "Delete", "Deallocate". :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.ScaleDownMode - :ivar type_properties_type: The type of Agent Pool. Possible values include: + :ivar type_properties_type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :vartype type_properties_type: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Possible values include: "System", - "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". :vartype mode: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.AgentPoolMode :ivar orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -165,12 +166,12 @@ class AgentPool(SubResource): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Possible values include: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Possible values include: "Delete", - "Deallocate". Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which @@ -202,7 +203,7 @@ class AgentPool(SubResource): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.GPUInstanceProfile :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool @@ -281,41 +282,41 @@ def __init__( count: Optional[int] = None, vm_size: Optional[str] = None, os_disk_size_gb: Optional[int] = None, - os_disk_type: Optional[Union[str, "OSDiskType"]] = None, - kubelet_disk_type: Optional[Union[str, "KubeletDiskType"]] = None, - workload_runtime: Optional[Union[str, "WorkloadRuntime"]] = None, + os_disk_type: Optional[Union[str, "_models.OSDiskType"]] = None, + kubelet_disk_type: Optional[Union[str, "_models.KubeletDiskType"]] = None, + workload_runtime: Optional[Union[str, "_models.WorkloadRuntime"]] = None, message_of_the_day: Optional[str] = None, vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", - os_sku: Optional[Union[str, "OSSKU"]] = None, + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - scale_down_mode: Optional[Union[str, "ScaleDownMode"]] = None, - type_properties_type: Optional[Union[str, "AgentPoolType"]] = None, - mode: Optional[Union[str, "AgentPoolMode"]] = None, + scale_down_mode: Optional[Union[str, "_models.ScaleDownMode"]] = None, + type_properties_type: Optional[Union[str, "_models.AgentPoolType"]] = None, + mode: Optional[Union[str, "_models.AgentPoolMode"]] = None, orchestrator_version: Optional[str] = None, - upgrade_settings: Optional["AgentPoolUpgradeSettings"] = None, - power_state: Optional["PowerState"] = None, + upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, + power_state: Optional["_models.PowerState"] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", spot_max_price: Optional[float] = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, proximity_placement_group_id: Optional[str] = None, - kubelet_config: Optional["KubeletConfig"] = None, - linux_os_config: Optional["LinuxOSConfig"] = None, + kubelet_config: Optional["_models.KubeletConfig"] = None, + linux_os_config: Optional["_models.LinuxOSConfig"] = None, enable_encryption_at_host: Optional[bool] = None, enable_ultra_ssd: Optional[bool] = None, enable_fips: Optional[bool] = None, - gpu_instance_profile: Optional[Union[str, "GPUInstanceProfile"]] = None, - creation_data: Optional["CreationData"] = None, + gpu_instance_profile: Optional[Union[str, "_models.GPUInstanceProfile"]] = None, + creation_data: Optional["_models.CreationData"] = None, capacity_reservation_group_id: Optional[str] = None, host_group_id: Optional[str] = None, **kwargs @@ -336,16 +337,16 @@ def __init__( :keyword os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS - `_. Possible values - include: "Managed", "Ephemeral". + `_. Known values are: + "Managed", "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Possible values include: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.KubeletDiskType - :keyword workload_runtime: Determines the type of workload a node can run. Possible values - include: "OCIContainer", "WasmWasi". + :keyword workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer", "WasmWasi". :paramtype workload_runtime: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.WorkloadRuntime :keyword message_of_the_day: A base64-encoded string which will be written to /etc/motd after @@ -364,11 +365,11 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.OSType :keyword os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Possible values include: "Ubuntu", "CBLMariner". + Known values are: "Ubuntu", "CBLMariner". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -377,17 +378,16 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, - it defaults to Delete. Possible values include: "Delete", "Deallocate". + it defaults to Delete. Known values are: "Delete", "Deallocate". :paramtype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.ScaleDownMode - :keyword type_properties_type: The type of Agent Pool. Possible values include: + :keyword type_properties_type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type_properties_type: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Possible values include: "System", - "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.AgentPoolMode :keyword orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -418,12 +418,12 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Possible values include: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Possible values include: "Delete", - "Deallocate". Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which @@ -457,7 +457,7 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.GPUInstanceProfile @@ -550,7 +550,7 @@ class AgentPoolAvailableVersions(msrest.serialization.Model): def __init__( self, *, - agent_pool_versions: Optional[List["AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem"]] = None, + agent_pool_versions: Optional[List["_models.AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem"]] = None, **kwargs ): """ @@ -627,7 +627,7 @@ class AgentPoolListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["AgentPool"]] = None, + value: Optional[List["_models.AgentPool"]] = None, **kwargs ): """ @@ -654,8 +654,8 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): :vartype type: str :ivar kubernetes_version: Required. The Kubernetes version (major.minor.patch). :vartype kubernetes_version: str - :ivar os_type: Required. The operating system type. The default is Linux. Possible values - include: "Linux", "Windows". Default value: "Linux". + :ivar os_type: Required. The operating system type. The default is Linux. Known values are: + "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -686,16 +686,16 @@ def __init__( self, *, kubernetes_version: str, - os_type: Union[str, "OSType"] = "Linux", - upgrades: Optional[List["AgentPoolUpgradeProfilePropertiesUpgradesItem"]] = None, + os_type: Union[str, "_models.OSType"] = "Linux", + upgrades: Optional[List["_models.AgentPoolUpgradeProfilePropertiesUpgradesItem"]] = None, latest_node_image_version: Optional[str] = None, **kwargs ): """ :keyword kubernetes_version: Required. The Kubernetes version (major.minor.patch). :paramtype kubernetes_version: str - :keyword os_type: Required. The operating system type. The default is Linux. Possible values - include: "Linux", "Windows". Default value: "Linux". + :keyword os_type: Required. The operating system type. The default is Linux. Known values are: + "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: @@ -848,7 +848,7 @@ def __init__( code: Optional[str] = None, message: Optional[str] = None, target: Optional[str] = None, - details: Optional[List["CloudErrorBody"]] = None, + details: Optional[List["_models.CloudErrorBody"]] = None, **kwargs ): """ @@ -893,7 +893,7 @@ class ContainerServiceDiagnosticsProfile(msrest.serialization.Model): def __init__( self, *, - vm_diagnostics: "ContainerServiceVMDiagnostics", + vm_diagnostics: "_models.ContainerServiceVMDiagnostics", **kwargs ): """ @@ -931,7 +931,7 @@ def __init__( self, *, admin_username: str, - ssh: "ContainerServiceSshConfiguration", + ssh: "_models.ContainerServiceSshConfiguration", **kwargs ): """ @@ -954,17 +954,17 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar count: Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, - and 5. The default value is 1. Possible values include: 1, 3, 5. Default value: "1". + and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". :vartype count: int or ~azure.mgmt.containerservice.v2022_02_02_preview.models.Count :ivar dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. :vartype dns_prefix: str - :ivar vm_size: Required. Size of agent VMs. Possible values include: "Standard_A1", - "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", - "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", - "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", - "Standard_A8m_v2", "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", - "Standard_B8ms", "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", - "Standard_D12", "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", + :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", + "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", + "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", + "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", "Standard_B8ms", + "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", "Standard_D12", + "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", "Standard_D13_v2_Promo", "Standard_D14", "Standard_D14_v2", "Standard_D14_v2_Promo", "Standard_D15_v2", "Standard_D16_v3", "Standard_D16s_v3", "Standard_D1_v2", "Standard_D2", "Standard_D2_v2", "Standard_D2_v2_Promo", "Standard_D2_v3", "Standard_D2s_v3", "Standard_D3", @@ -1009,7 +1009,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): :vartype first_consecutive_static_ip: str :ivar storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Possible values include: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". :vartype storage_profile: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.ContainerServiceStorageProfileTypes :ivar fqdn: FQDN for the master pool. @@ -1038,27 +1038,27 @@ def __init__( self, *, dns_prefix: str, - vm_size: Union[str, "ContainerServiceVMSizeTypes"], - count: Optional[Union[int, "Count"]] = 1, + vm_size: Union[str, "_models.ContainerServiceVMSizeTypes"], + count: Optional[Union[int, "_models.Count"]] = 1, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, first_consecutive_static_ip: Optional[str] = "10.240.255.5", - storage_profile: Optional[Union[str, "ContainerServiceStorageProfileTypes"]] = None, + storage_profile: Optional[Union[str, "_models.ContainerServiceStorageProfileTypes"]] = None, **kwargs ): """ :keyword count: Number of masters (VMs) in the container service cluster. Allowed values are 1, - 3, and 5. The default value is 1. Possible values include: 1, 3, 5. Default value: "1". + 3, and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". :paramtype count: int or ~azure.mgmt.containerservice.v2022_02_02_preview.models.Count :keyword dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. :paramtype dns_prefix: str - :keyword vm_size: Required. Size of agent VMs. Possible values include: "Standard_A1", - "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", - "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", - "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", - "Standard_A8m_v2", "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", - "Standard_B8ms", "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", - "Standard_D12", "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", + :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", + "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", + "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", + "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", "Standard_B8ms", + "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", "Standard_D12", + "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", "Standard_D13_v2_Promo", "Standard_D14", "Standard_D14_v2", "Standard_D14_v2_Promo", "Standard_D15_v2", "Standard_D16_v3", "Standard_D16s_v3", "Standard_D1_v2", "Standard_D2", "Standard_D2_v2", "Standard_D2_v2_Promo", "Standard_D2_v3", "Standard_D2s_v3", "Standard_D3", @@ -1103,7 +1103,7 @@ def __init__( :paramtype first_consecutive_static_ip: str :keyword storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Possible values include: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". :paramtype storage_profile: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.ContainerServiceStorageProfileTypes """ @@ -1121,16 +1121,16 @@ def __init__( class ContainerServiceNetworkProfile(msrest.serialization.Model): """Profile of network configuration. - :ivar network_plugin: Network plugin used for building the Kubernetes network. Possible values - include: "azure", "kubenet", "none". Default value: "kubenet". + :ivar network_plugin: Network plugin used for building the Kubernetes network. Known values + are: "azure", "kubenet", "none". Default value: "kubenet". :vartype network_plugin: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.NetworkPlugin - :ivar network_policy: Network policy used for building the Kubernetes network. Possible values - include: "calico", "azure". + :ivar network_policy: Network policy used for building the Kubernetes network. Known values + are: "calico", "azure". :vartype network_policy: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.NetworkPolicy :ivar network_mode: This cannot be specified if networkPlugin is anything other than 'azure'. - Possible values include: "transparent", "bridge". + Known values are: "transparent", "bridge". :vartype network_mode: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.NetworkMode :ivar pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. @@ -1146,14 +1146,14 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): :vartype docker_bridge_cidr: str :ivar outbound_type: This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type - `_. Possible values include: - "loadBalancer", "userDefinedRouting", "managedNATGateway", "userAssignedNATGateway". Default - value: "loadBalancer". + `_. Known values are: "loadBalancer", + "userDefinedRouting", "managedNATGateway", "userAssignedNATGateway". Default value: + "loadBalancer". :vartype outbound_type: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.OutboundType :ivar load_balancer_sku: The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the - differences between load balancer SKUs. Possible values include: "standard", "basic". + differences between load balancer SKUs. Known values are: "standard", "basic". :vartype load_balancer_sku: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.LoadBalancerSku :ivar load_balancer_profile: Profile of the cluster load balancer. @@ -1203,33 +1203,33 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): def __init__( self, *, - network_plugin: Optional[Union[str, "NetworkPlugin"]] = "kubenet", - network_policy: Optional[Union[str, "NetworkPolicy"]] = None, - network_mode: Optional[Union[str, "NetworkMode"]] = None, + network_plugin: Optional[Union[str, "_models.NetworkPlugin"]] = "kubenet", + network_policy: Optional[Union[str, "_models.NetworkPolicy"]] = None, + network_mode: Optional[Union[str, "_models.NetworkMode"]] = None, pod_cidr: Optional[str] = "10.244.0.0/16", service_cidr: Optional[str] = "10.0.0.0/16", dns_service_ip: Optional[str] = "10.0.0.10", docker_bridge_cidr: Optional[str] = "172.17.0.1/16", - outbound_type: Optional[Union[str, "OutboundType"]] = "loadBalancer", - load_balancer_sku: Optional[Union[str, "LoadBalancerSku"]] = None, - load_balancer_profile: Optional["ManagedClusterLoadBalancerProfile"] = None, - nat_gateway_profile: Optional["ManagedClusterNATGatewayProfile"] = None, + outbound_type: Optional[Union[str, "_models.OutboundType"]] = "loadBalancer", + load_balancer_sku: Optional[Union[str, "_models.LoadBalancerSku"]] = None, + load_balancer_profile: Optional["_models.ManagedClusterLoadBalancerProfile"] = None, + nat_gateway_profile: Optional["_models.ManagedClusterNATGatewayProfile"] = None, pod_cidrs: Optional[List[str]] = None, service_cidrs: Optional[List[str]] = None, - ip_families: Optional[List[Union[str, "IpFamily"]]] = None, + ip_families: Optional[List[Union[str, "_models.IpFamily"]]] = None, **kwargs ): """ - :keyword network_plugin: Network plugin used for building the Kubernetes network. Possible - values include: "azure", "kubenet", "none". Default value: "kubenet". + :keyword network_plugin: Network plugin used for building the Kubernetes network. Known values + are: "azure", "kubenet", "none". Default value: "kubenet". :paramtype network_plugin: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.NetworkPlugin - :keyword network_policy: Network policy used for building the Kubernetes network. Possible - values include: "calico", "azure". + :keyword network_policy: Network policy used for building the Kubernetes network. Known values + are: "calico", "azure". :paramtype network_policy: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.NetworkPolicy :keyword network_mode: This cannot be specified if networkPlugin is anything other than - 'azure'. Possible values include: "transparent", "bridge". + 'azure'. Known values are: "transparent", "bridge". :paramtype network_mode: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.NetworkMode :keyword pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. @@ -1245,14 +1245,14 @@ def __init__( :paramtype docker_bridge_cidr: str :keyword outbound_type: This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type - `_. Possible values include: - "loadBalancer", "userDefinedRouting", "managedNATGateway", "userAssignedNATGateway". Default - value: "loadBalancer". + `_. Known values are: "loadBalancer", + "userDefinedRouting", "managedNATGateway", "userAssignedNATGateway". Default value: + "loadBalancer". :paramtype outbound_type: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.OutboundType :keyword load_balancer_sku: The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the - differences between load balancer SKUs. Possible values include: "standard", "basic". + differences between load balancer SKUs. Known values are: "standard", "basic". :paramtype load_balancer_sku: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.LoadBalancerSku :keyword load_balancer_profile: Profile of the cluster load balancer. @@ -1313,7 +1313,7 @@ class ContainerServiceSshConfiguration(msrest.serialization.Model): def __init__( self, *, - public_keys: List["ContainerServiceSshPublicKey"], + public_keys: List["_models.ContainerServiceSshPublicKey"], **kwargs ): """ @@ -1503,7 +1503,7 @@ def __init__( self, *, domain_name: Optional[str] = None, - endpoint_details: Optional[List["EndpointDetail"]] = None, + endpoint_details: Optional[List["_models.EndpointDetail"]] = None, **kwargs ): """ @@ -1569,7 +1569,7 @@ class ExtendedLocation(msrest.serialization.Model): :ivar name: The name of the extended location. :vartype name: str - :ivar type: The type of the extended location. Possible values include: "EdgeZone". + :ivar type: The type of the extended location. Known values are: "EdgeZone". :vartype type: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.ExtendedLocationTypes """ @@ -1583,13 +1583,13 @@ def __init__( self, *, name: Optional[str] = None, - type: Optional[Union[str, "ExtendedLocationTypes"]] = None, + type: Optional[Union[str, "_models.ExtendedLocationTypes"]] = None, **kwargs ): """ :keyword name: The name of the extended location. :paramtype name: str - :keyword type: The type of the extended location. Possible values include: "EdgeZone". + :keyword type: The type of the extended location. Known values are: "EdgeZone". :paramtype type: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.ExtendedLocationTypes """ @@ -1749,7 +1749,7 @@ class LinuxOSConfig(msrest.serialization.Model): def __init__( self, *, - sysctls: Optional["SysctlConfig"] = None, + sysctls: Optional["_models.SysctlConfig"] = None, transparent_huge_page_enabled: Optional[str] = None, transparent_huge_page_defrag: Optional[str] = None, swap_file_size_mb: Optional[int] = None, @@ -1818,8 +1818,8 @@ class MaintenanceConfiguration(SubResource): def __init__( self, *, - time_in_week: Optional[List["TimeInWeek"]] = None, - not_allowed_time: Optional[List["TimeSpan"]] = None, + time_in_week: Optional[List["_models.TimeInWeek"]] = None, + not_allowed_time: Optional[List["_models.TimeSpan"]] = None, **kwargs ): """ @@ -1861,7 +1861,7 @@ class MaintenanceConfigurationListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["MaintenanceConfiguration"]] = None, + value: Optional[List["_models.MaintenanceConfiguration"]] = None, **kwargs ): """ @@ -2064,8 +2064,8 @@ class ManagedCluster(Resource): :ivar security_profile: Security profile for the managed cluster. :vartype security_profile: ~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedClusterSecurityProfile - :ivar public_network_access: Allow or deny public network access for AKS. Possible values - include: "Enabled", "Disabled". + :ivar public_network_access: Allow or deny public network access for AKS. Known values are: + "Enabled", "Disabled". :vartype public_network_access: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.PublicNetworkAccess """ @@ -2135,35 +2135,35 @@ def __init__( *, location: str, tags: Optional[Dict[str, str]] = None, - sku: Optional["ManagedClusterSKU"] = None, - extended_location: Optional["ExtendedLocation"] = None, - identity: Optional["ManagedClusterIdentity"] = None, + sku: Optional["_models.ManagedClusterSKU"] = None, + extended_location: Optional["_models.ExtendedLocation"] = None, + identity: Optional["_models.ManagedClusterIdentity"] = None, kubernetes_version: Optional[str] = None, dns_prefix: Optional[str] = None, fqdn_subdomain: Optional[str] = None, - agent_pool_profiles: Optional[List["ManagedClusterAgentPoolProfile"]] = None, - linux_profile: Optional["ContainerServiceLinuxProfile"] = None, - windows_profile: Optional["ManagedClusterWindowsProfile"] = None, - service_principal_profile: Optional["ManagedClusterServicePrincipalProfile"] = None, - addon_profiles: Optional[Dict[str, "ManagedClusterAddonProfile"]] = None, - pod_identity_profile: Optional["ManagedClusterPodIdentityProfile"] = None, - oidc_issuer_profile: Optional["ManagedClusterOIDCIssuerProfile"] = None, + agent_pool_profiles: Optional[List["_models.ManagedClusterAgentPoolProfile"]] = None, + linux_profile: Optional["_models.ContainerServiceLinuxProfile"] = None, + windows_profile: Optional["_models.ManagedClusterWindowsProfile"] = None, + service_principal_profile: Optional["_models.ManagedClusterServicePrincipalProfile"] = None, + addon_profiles: Optional[Dict[str, "_models.ManagedClusterAddonProfile"]] = None, + pod_identity_profile: Optional["_models.ManagedClusterPodIdentityProfile"] = None, + oidc_issuer_profile: Optional["_models.ManagedClusterOIDCIssuerProfile"] = None, node_resource_group: Optional[str] = None, enable_rbac: Optional[bool] = None, enable_pod_security_policy: Optional[bool] = None, enable_namespace_resources: Optional[bool] = None, - network_profile: Optional["ContainerServiceNetworkProfile"] = None, - aad_profile: Optional["ManagedClusterAADProfile"] = None, - auto_upgrade_profile: Optional["ManagedClusterAutoUpgradeProfile"] = None, - auto_scaler_profile: Optional["ManagedClusterPropertiesAutoScalerProfile"] = None, - api_server_access_profile: Optional["ManagedClusterAPIServerAccessProfile"] = None, + network_profile: Optional["_models.ContainerServiceNetworkProfile"] = None, + aad_profile: Optional["_models.ManagedClusterAADProfile"] = None, + auto_upgrade_profile: Optional["_models.ManagedClusterAutoUpgradeProfile"] = None, + auto_scaler_profile: Optional["_models.ManagedClusterPropertiesAutoScalerProfile"] = None, + api_server_access_profile: Optional["_models.ManagedClusterAPIServerAccessProfile"] = None, disk_encryption_set_id: Optional[str] = None, - identity_profile: Optional[Dict[str, "UserAssignedIdentity"]] = None, - private_link_resources: Optional[List["PrivateLinkResource"]] = None, + identity_profile: Optional[Dict[str, "_models.UserAssignedIdentity"]] = None, + private_link_resources: Optional[List["_models.PrivateLinkResource"]] = None, disable_local_accounts: Optional[bool] = None, - http_proxy_config: Optional["ManagedClusterHTTPProxyConfig"] = None, - security_profile: Optional["ManagedClusterSecurityProfile"] = None, - public_network_access: Optional[Union[str, "PublicNetworkAccess"]] = None, + http_proxy_config: Optional["_models.ManagedClusterHTTPProxyConfig"] = None, + security_profile: Optional["_models.ManagedClusterSecurityProfile"] = None, + public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None, **kwargs ): """ @@ -2261,8 +2261,8 @@ def __init__( :keyword security_profile: Security profile for the managed cluster. :paramtype security_profile: ~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedClusterSecurityProfile - :keyword public_network_access: Allow or deny public network access for AKS. Possible values - include: "Enabled", "Disabled". + :keyword public_network_access: Allow or deny public network access for AKS. Known values are: + "Enabled", "Disabled". :paramtype public_network_access: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.PublicNetworkAccess """ @@ -2581,16 +2581,16 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS - `_. Possible values - include: "Managed", "Ephemeral". + `_. Known values are: + "Managed", "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Possible values include: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.KubeletDiskType - :ivar workload_runtime: Determines the type of workload a node can run. Possible values - include: "OCIContainer", "WasmWasi". + :ivar workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer", "WasmWasi". :vartype workload_runtime: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.WorkloadRuntime :ivar message_of_the_day: A base64-encoded string which will be written to /etc/motd after @@ -2609,11 +2609,11 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.OSType - :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Possible values include: "Ubuntu", "CBLMariner". + :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known + values are: "Ubuntu", "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. :vartype max_count: int @@ -2622,16 +2622,15 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it - defaults to Delete. Possible values include: "Delete", "Deallocate". + defaults to Delete. Known values are: "Delete", "Deallocate". :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.ScaleDownMode - :ivar type: The type of Agent Pool. Possible values include: "VirtualMachineScaleSets", + :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Possible values include: "System", - "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". :vartype mode: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.AgentPoolMode :ivar orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -2666,12 +2665,12 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Possible values include: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Possible values include: "Delete", - "Deallocate". Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which @@ -2703,7 +2702,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.GPUInstanceProfile :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool @@ -2776,41 +2775,41 @@ def __init__( count: Optional[int] = None, vm_size: Optional[str] = None, os_disk_size_gb: Optional[int] = None, - os_disk_type: Optional[Union[str, "OSDiskType"]] = None, - kubelet_disk_type: Optional[Union[str, "KubeletDiskType"]] = None, - workload_runtime: Optional[Union[str, "WorkloadRuntime"]] = None, + os_disk_type: Optional[Union[str, "_models.OSDiskType"]] = None, + kubelet_disk_type: Optional[Union[str, "_models.KubeletDiskType"]] = None, + workload_runtime: Optional[Union[str, "_models.WorkloadRuntime"]] = None, message_of_the_day: Optional[str] = None, vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", - os_sku: Optional[Union[str, "OSSKU"]] = None, + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - scale_down_mode: Optional[Union[str, "ScaleDownMode"]] = None, - type: Optional[Union[str, "AgentPoolType"]] = None, - mode: Optional[Union[str, "AgentPoolMode"]] = None, + scale_down_mode: Optional[Union[str, "_models.ScaleDownMode"]] = None, + type: Optional[Union[str, "_models.AgentPoolType"]] = None, + mode: Optional[Union[str, "_models.AgentPoolMode"]] = None, orchestrator_version: Optional[str] = None, - upgrade_settings: Optional["AgentPoolUpgradeSettings"] = None, - power_state: Optional["PowerState"] = None, + upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, + power_state: Optional["_models.PowerState"] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", spot_max_price: Optional[float] = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, proximity_placement_group_id: Optional[str] = None, - kubelet_config: Optional["KubeletConfig"] = None, - linux_os_config: Optional["LinuxOSConfig"] = None, + kubelet_config: Optional["_models.KubeletConfig"] = None, + linux_os_config: Optional["_models.LinuxOSConfig"] = None, enable_encryption_at_host: Optional[bool] = None, enable_ultra_ssd: Optional[bool] = None, enable_fips: Optional[bool] = None, - gpu_instance_profile: Optional[Union[str, "GPUInstanceProfile"]] = None, - creation_data: Optional["CreationData"] = None, + gpu_instance_profile: Optional[Union[str, "_models.GPUInstanceProfile"]] = None, + creation_data: Optional["_models.CreationData"] = None, capacity_reservation_group_id: Optional[str] = None, host_group_id: Optional[str] = None, **kwargs @@ -2831,16 +2830,16 @@ def __init__( :keyword os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS - `_. Possible values - include: "Managed", "Ephemeral". + `_. Known values are: + "Managed", "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Possible values include: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.KubeletDiskType - :keyword workload_runtime: Determines the type of workload a node can run. Possible values - include: "OCIContainer", "WasmWasi". + :keyword workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer", "WasmWasi". :paramtype workload_runtime: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.WorkloadRuntime :keyword message_of_the_day: A base64-encoded string which will be written to /etc/motd after @@ -2859,11 +2858,11 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.OSType :keyword os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Possible values include: "Ubuntu", "CBLMariner". + Known values are: "Ubuntu", "CBLMariner". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -2872,16 +2871,15 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, - it defaults to Delete. Possible values include: "Delete", "Deallocate". + it defaults to Delete. Known values are: "Delete", "Deallocate". :paramtype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.ScaleDownMode - :keyword type: The type of Agent Pool. Possible values include: "VirtualMachineScaleSets", + :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Possible values include: "System", - "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.AgentPoolMode :keyword orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -2912,12 +2910,12 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Possible values include: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Possible values include: "Delete", - "Deallocate". Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which @@ -2951,7 +2949,7 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.GPUInstanceProfile @@ -3034,16 +3032,16 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS - `_. Possible values - include: "Managed", "Ephemeral". + `_. Known values are: + "Managed", "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Possible values include: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.KubeletDiskType - :ivar workload_runtime: Determines the type of workload a node can run. Possible values - include: "OCIContainer", "WasmWasi". + :ivar workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer", "WasmWasi". :vartype workload_runtime: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.WorkloadRuntime :ivar message_of_the_day: A base64-encoded string which will be written to /etc/motd after @@ -3062,11 +3060,11 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.OSType - :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Possible values include: "Ubuntu", "CBLMariner". + :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known + values are: "Ubuntu", "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. :vartype max_count: int @@ -3075,16 +3073,15 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it - defaults to Delete. Possible values include: "Delete", "Deallocate". + defaults to Delete. Known values are: "Delete", "Deallocate". :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.ScaleDownMode - :ivar type: The type of Agent Pool. Possible values include: "VirtualMachineScaleSets", + :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Possible values include: "System", - "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". :vartype mode: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.AgentPoolMode :ivar orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -3119,12 +3116,12 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Possible values include: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Possible values include: "Delete", - "Deallocate". Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which @@ -3156,7 +3153,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.GPUInstanceProfile :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool @@ -3234,41 +3231,41 @@ def __init__( count: Optional[int] = None, vm_size: Optional[str] = None, os_disk_size_gb: Optional[int] = None, - os_disk_type: Optional[Union[str, "OSDiskType"]] = None, - kubelet_disk_type: Optional[Union[str, "KubeletDiskType"]] = None, - workload_runtime: Optional[Union[str, "WorkloadRuntime"]] = None, + os_disk_type: Optional[Union[str, "_models.OSDiskType"]] = None, + kubelet_disk_type: Optional[Union[str, "_models.KubeletDiskType"]] = None, + workload_runtime: Optional[Union[str, "_models.WorkloadRuntime"]] = None, message_of_the_day: Optional[str] = None, vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", - os_sku: Optional[Union[str, "OSSKU"]] = None, + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - scale_down_mode: Optional[Union[str, "ScaleDownMode"]] = None, - type: Optional[Union[str, "AgentPoolType"]] = None, - mode: Optional[Union[str, "AgentPoolMode"]] = None, + scale_down_mode: Optional[Union[str, "_models.ScaleDownMode"]] = None, + type: Optional[Union[str, "_models.AgentPoolType"]] = None, + mode: Optional[Union[str, "_models.AgentPoolMode"]] = None, orchestrator_version: Optional[str] = None, - upgrade_settings: Optional["AgentPoolUpgradeSettings"] = None, - power_state: Optional["PowerState"] = None, + upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, + power_state: Optional["_models.PowerState"] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", spot_max_price: Optional[float] = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, proximity_placement_group_id: Optional[str] = None, - kubelet_config: Optional["KubeletConfig"] = None, - linux_os_config: Optional["LinuxOSConfig"] = None, + kubelet_config: Optional["_models.KubeletConfig"] = None, + linux_os_config: Optional["_models.LinuxOSConfig"] = None, enable_encryption_at_host: Optional[bool] = None, enable_ultra_ssd: Optional[bool] = None, enable_fips: Optional[bool] = None, - gpu_instance_profile: Optional[Union[str, "GPUInstanceProfile"]] = None, - creation_data: Optional["CreationData"] = None, + gpu_instance_profile: Optional[Union[str, "_models.GPUInstanceProfile"]] = None, + creation_data: Optional["_models.CreationData"] = None, capacity_reservation_group_id: Optional[str] = None, host_group_id: Optional[str] = None, **kwargs @@ -3289,16 +3286,16 @@ def __init__( :keyword os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS - `_. Possible values - include: "Managed", "Ephemeral". + `_. Known values are: + "Managed", "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Possible values include: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.KubeletDiskType - :keyword workload_runtime: Determines the type of workload a node can run. Possible values - include: "OCIContainer", "WasmWasi". + :keyword workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer", "WasmWasi". :paramtype workload_runtime: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.WorkloadRuntime :keyword message_of_the_day: A base64-encoded string which will be written to /etc/motd after @@ -3317,11 +3314,11 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.OSType :keyword os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Possible values include: "Ubuntu", "CBLMariner". + Known values are: "Ubuntu", "CBLMariner". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -3330,16 +3327,15 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, - it defaults to Delete. Possible values include: "Delete", "Deallocate". + it defaults to Delete. Known values are: "Delete", "Deallocate". :paramtype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.ScaleDownMode - :keyword type: The type of Agent Pool. Possible values include: "VirtualMachineScaleSets", + :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Possible values include: "System", - "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.AgentPoolMode :keyword orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -3370,12 +3366,12 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Possible values include: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Possible values include: "Delete", - "Deallocate". Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which @@ -3409,7 +3405,7 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.GPUInstanceProfile @@ -3502,8 +3498,8 @@ class ManagedClusterAutoUpgradeProfile(msrest.serialization.Model): """Auto upgrade profile for a managed cluster. :ivar upgrade_channel: For more information see `setting the AKS cluster auto-upgrade channel - `_. Possible - values include: "rapid", "stable", "patch", "node-image", "none". + `_. Known values + are: "rapid", "stable", "patch", "node-image", "none". :vartype upgrade_channel: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.UpgradeChannel """ @@ -3515,13 +3511,13 @@ class ManagedClusterAutoUpgradeProfile(msrest.serialization.Model): def __init__( self, *, - upgrade_channel: Optional[Union[str, "UpgradeChannel"]] = None, + upgrade_channel: Optional[Union[str, "_models.UpgradeChannel"]] = None, **kwargs ): """ :keyword upgrade_channel: For more information see `setting the AKS cluster auto-upgrade channel `_. - Possible values include: "rapid", "stable", "patch", "node-image", "none". + Known values are: "rapid", "stable", "patch", "node-image", "none". :paramtype upgrade_channel: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.UpgradeChannel """ @@ -3587,7 +3583,7 @@ class ManagedClusterIdentity(msrest.serialization.Model): components. :vartype tenant_id: str :ivar type: For more information see `use managed identities in AKS - `_. Possible values include: + `_. Known values are: "SystemAssigned", "UserAssigned", "None". :vartype type: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.ResourceIdentityType @@ -3612,13 +3608,13 @@ class ManagedClusterIdentity(msrest.serialization.Model): def __init__( self, *, - type: Optional[Union[str, "ResourceIdentityType"]] = None, - user_assigned_identities: Optional[Dict[str, "ManagedServiceIdentityUserAssignedIdentitiesValue"]] = None, + type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, + user_assigned_identities: Optional[Dict[str, "_models.ManagedServiceIdentityUserAssignedIdentitiesValue"]] = None, **kwargs ): """ :keyword type: For more information see `use managed identities in AKS - `_. Possible values include: + `_. Known values are: "SystemAssigned", "UserAssigned", "None". :paramtype type: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.ResourceIdentityType @@ -3657,7 +3653,7 @@ class ManagedClusterListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["ManagedCluster"]] = None, + value: Optional[List["_models.ManagedCluster"]] = None, **kwargs ): """ @@ -3715,10 +3711,10 @@ class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): def __init__( self, *, - managed_outbound_i_ps: Optional["ManagedClusterLoadBalancerProfileManagedOutboundIPs"] = None, - outbound_ip_prefixes: Optional["ManagedClusterLoadBalancerProfileOutboundIPPrefixes"] = None, - outbound_i_ps: Optional["ManagedClusterLoadBalancerProfileOutboundIPs"] = None, - effective_outbound_i_ps: Optional[List["ResourceReference"]] = None, + managed_outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileManagedOutboundIPs"] = None, + outbound_ip_prefixes: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPPrefixes"] = None, + outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPs"] = None, + effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, allocated_outbound_ports: Optional[int] = 0, idle_timeout_in_minutes: Optional[int] = 30, enable_multiple_standard_load_balancers: Optional[bool] = None, @@ -3820,7 +3816,7 @@ class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.M def __init__( self, *, - public_ip_prefixes: Optional[List["ResourceReference"]] = None, + public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, **kwargs ): """ @@ -3847,7 +3843,7 @@ class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): def __init__( self, *, - public_i_ps: Optional[List["ResourceReference"]] = None, + public_i_ps: Optional[List["_models.ResourceReference"]] = None, **kwargs ): """ @@ -3918,8 +3914,8 @@ class ManagedClusterNATGatewayProfile(msrest.serialization.Model): def __init__( self, *, - managed_outbound_ip_profile: Optional["ManagedClusterManagedOutboundIPProfile"] = None, - effective_outbound_i_ps: Optional[List["ResourceReference"]] = None, + managed_outbound_ip_profile: Optional["_models.ManagedClusterManagedOutboundIPProfile"] = None, + effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, idle_timeout_in_minutes: Optional[int] = 4, **kwargs ): @@ -3992,8 +3988,8 @@ class ManagedClusterPodIdentity(msrest.serialization.Model): :vartype binding_selector: str :ivar identity: Required. The user assigned identity details. :vartype identity: ~azure.mgmt.containerservice.v2022_02_02_preview.models.UserAssignedIdentity - :ivar provisioning_state: The current provisioning state of the pod identity. Possible values - include: "Assigned", "Updating", "Deleting", "Failed". + :ivar provisioning_state: The current provisioning state of the pod identity. Known values are: + "Assigned", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedClusterPodIdentityProvisioningState :ivar provisioning_info: @@ -4023,7 +4019,7 @@ def __init__( *, name: str, namespace: str, - identity: "UserAssignedIdentity", + identity: "_models.UserAssignedIdentity", binding_selector: Optional[str] = None, **kwargs ): @@ -4125,8 +4121,8 @@ def __init__( *, enabled: Optional[bool] = None, allow_network_plugin_kubenet: Optional[bool] = None, - user_assigned_identities: Optional[List["ManagedClusterPodIdentity"]] = None, - user_assigned_identity_exceptions: Optional[List["ManagedClusterPodIdentityException"]] = None, + user_assigned_identities: Optional[List["_models.ManagedClusterPodIdentity"]] = None, + user_assigned_identity_exceptions: Optional[List["_models.ManagedClusterPodIdentityException"]] = None, **kwargs ): """ @@ -4167,7 +4163,7 @@ class ManagedClusterPodIdentityProvisioningError(msrest.serialization.Model): def __init__( self, *, - error: Optional["ManagedClusterPodIdentityProvisioningErrorBody"] = None, + error: Optional["_models.ManagedClusterPodIdentityProvisioningErrorBody"] = None, **kwargs ): """ @@ -4209,7 +4205,7 @@ def __init__( code: Optional[str] = None, message: Optional[str] = None, target: Optional[str] = None, - details: Optional[List["ManagedClusterPodIdentityProvisioningErrorBody"]] = None, + details: Optional[List["_models.ManagedClusterPodIdentityProvisioningErrorBody"]] = None, **kwargs ): """ @@ -4248,7 +4244,7 @@ class ManagedClusterPodIdentityProvisioningInfo(msrest.serialization.Model): def __init__( self, *, - error: Optional["ManagedClusterPodIdentityProvisioningError"] = None, + error: Optional["_models.ManagedClusterPodIdentityProvisioningError"] = None, **kwargs ): """ @@ -4269,8 +4265,8 @@ class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): :vartype kubernetes_version: str :ivar name: The Agent Pool name. :vartype name: str - :ivar os_type: Required. The operating system type. The default is Linux. Possible values - include: "Linux", "Windows". Default value: "Linux". + :ivar os_type: Required. The operating system type. The default is Linux. Known values are: + "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -4293,9 +4289,9 @@ def __init__( self, *, kubernetes_version: str, - os_type: Union[str, "OSType"] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", name: Optional[str] = None, - upgrades: Optional[List["ManagedClusterPoolUpgradeProfileUpgradesItem"]] = None, + upgrades: Optional[List["_models.ManagedClusterPoolUpgradeProfileUpgradesItem"]] = None, **kwargs ): """ @@ -4303,8 +4299,8 @@ def __init__( :paramtype kubernetes_version: str :keyword name: The Agent Pool name. :paramtype name: str - :keyword os_type: Required. The operating system type. The default is Linux. Possible values - include: "Linux", "Windows". Default value: "Linux". + :keyword os_type: Required. The operating system type. The default is Linux. Known values are: + "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: @@ -4356,8 +4352,7 @@ class ManagedClusterPropertiesAutoScalerProfile(msrest.serialization.Model): :vartype balance_similar_node_groups: str :ivar expander: If not specified, the default is 'random'. See `expanders `_ - for more information. Possible values include: "least-waste", "most-pods", "priority", - "random". + for more information. Known values are: "least-waste", "most-pods", "priority", "random". :vartype expander: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.Expander :ivar max_empty_bulk_delete: The default is 10. :vartype max_empty_bulk_delete: str @@ -4424,7 +4419,7 @@ def __init__( self, *, balance_similar_node_groups: Optional[str] = None, - expander: Optional[Union[str, "Expander"]] = None, + expander: Optional[Union[str, "_models.Expander"]] = None, max_empty_bulk_delete: Optional[str] = None, max_graceful_termination_sec: Optional[str] = None, max_node_provision_time: Optional[str] = None, @@ -4447,8 +4442,7 @@ def __init__( :paramtype balance_similar_node_groups: str :keyword expander: If not specified, the default is 'random'. See `expanders `_ - for more information. Possible values include: "least-waste", "most-pods", "priority", - "random". + for more information. Known values are: "least-waste", "most-pods", "priority", "random". :paramtype expander: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.Expander :keyword max_empty_bulk_delete: The default is 10. :paramtype max_empty_bulk_delete: str @@ -4542,7 +4536,7 @@ def __init__( self, *, kubernetes_version: Optional[str] = None, - sku: Optional["ManagedClusterSKU"] = None, + sku: Optional["_models.ManagedClusterSKU"] = None, enable_rbac: Optional[bool] = None, **kwargs ): @@ -4583,8 +4577,8 @@ class ManagedClusterSecurityProfile(msrest.serialization.Model): def __init__( self, *, - azure_defender: Optional["ManagedClusterSecurityProfileAzureDefender"] = None, - azure_key_vault_kms: Optional["AzureKeyVaultKms"] = None, + azure_defender: Optional["_models.ManagedClusterSecurityProfileAzureDefender"] = None, + azure_key_vault_kms: Optional["_models.AzureKeyVaultKms"] = None, **kwargs ): """ @@ -4679,12 +4673,12 @@ def __init__( class ManagedClusterSKU(msrest.serialization.Model): """The SKU of a Managed Cluster. - :ivar name: The name of a managed cluster SKU. Possible values include: "Basic". + :ivar name: The name of a managed cluster SKU. Known values are: "Basic". :vartype name: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedClusterSKUName :ivar tier: If not specified, the default is 'Free'. See `uptime SLA - `_ for more details. Possible values include: - "Paid", "Free". + `_ for more details. Known values are: "Paid", + "Free". :vartype tier: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedClusterSKUTier """ @@ -4697,17 +4691,17 @@ class ManagedClusterSKU(msrest.serialization.Model): def __init__( self, *, - name: Optional[Union[str, "ManagedClusterSKUName"]] = None, - tier: Optional[Union[str, "ManagedClusterSKUTier"]] = None, + name: Optional[Union[str, "_models.ManagedClusterSKUName"]] = None, + tier: Optional[Union[str, "_models.ManagedClusterSKUTier"]] = None, **kwargs ): """ - :keyword name: The name of a managed cluster SKU. Possible values include: "Basic". + :keyword name: The name of a managed cluster SKU. Known values are: "Basic". :paramtype name: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedClusterSKUName :keyword tier: If not specified, the default is 'Free'. See `uptime SLA - `_ for more details. Possible values include: - "Paid", "Free". + `_ for more details. Known values are: "Paid", + "Free". :paramtype tier: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedClusterSKUTier """ @@ -4741,7 +4735,7 @@ class ManagedClusterSnapshot(Resource): :ivar creation_data: CreationData to be used to specify the source resource ID to create this snapshot. :vartype creation_data: ~azure.mgmt.containerservice.v2022_02_02_preview.models.CreationData - :ivar snapshot_type: The type of a snapshot. The default is NodePool. Possible values include: + :ivar snapshot_type: The type of a snapshot. The default is NodePool. Known values are: "NodePool", "ManagedCluster". Default value: "NodePool". :vartype snapshot_type: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.SnapshotType @@ -4777,8 +4771,8 @@ def __init__( *, location: str, tags: Optional[Dict[str, str]] = None, - creation_data: Optional["CreationData"] = None, - snapshot_type: Optional[Union[str, "SnapshotType"]] = "NodePool", + creation_data: Optional["_models.CreationData"] = None, + snapshot_type: Optional[Union[str, "_models.SnapshotType"]] = "NodePool", **kwargs ): """ @@ -4789,8 +4783,8 @@ def __init__( :keyword creation_data: CreationData to be used to specify the source resource ID to create this snapshot. :paramtype creation_data: ~azure.mgmt.containerservice.v2022_02_02_preview.models.CreationData - :keyword snapshot_type: The type of a snapshot. The default is NodePool. Possible values - include: "NodePool", "ManagedCluster". Default value: "NodePool". + :keyword snapshot_type: The type of a snapshot. The default is NodePool. Known values are: + "NodePool", "ManagedCluster". Default value: "NodePool". :paramtype snapshot_type: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.SnapshotType """ @@ -4824,7 +4818,7 @@ class ManagedClusterSnapshotListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["ManagedClusterSnapshot"]] = None, + value: Optional[List["_models.ManagedClusterSnapshot"]] = None, **kwargs ): """ @@ -4878,8 +4872,8 @@ class ManagedClusterUpgradeProfile(msrest.serialization.Model): def __init__( self, *, - control_plane_profile: "ManagedClusterPoolUpgradeProfile", - agent_pool_profiles: List["ManagedClusterPoolUpgradeProfile"], + control_plane_profile: "_models.ManagedClusterPoolUpgradeProfile", + agent_pool_profiles: List["_models.ManagedClusterPoolUpgradeProfile"], **kwargs ): """ @@ -4921,8 +4915,8 @@ class ManagedClusterWindowsProfile(msrest.serialization.Model): "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!". :vartype admin_password: str :ivar license_type: The license type to use for Windows VMs. See `Azure Hybrid User Benefits - `_ for more details. Possible values - include: "None", "Windows_Server". + `_ for more details. Known values are: + "None", "Windows_Server". :vartype license_type: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.LicenseType :ivar enable_csi_proxy: For more details on CSI proxy, see the `CSI proxy GitHub repo @@ -4950,9 +4944,9 @@ def __init__( *, admin_username: str, admin_password: Optional[str] = None, - license_type: Optional[Union[str, "LicenseType"]] = None, + license_type: Optional[Union[str, "_models.LicenseType"]] = None, enable_csi_proxy: Optional[bool] = None, - gmsa_profile: Optional["WindowsGmsaProfile"] = None, + gmsa_profile: Optional["_models.WindowsGmsaProfile"] = None, **kwargs ): """ @@ -4973,8 +4967,8 @@ def __init__( "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!". :paramtype admin_password: str :keyword license_type: The license type to use for Windows VMs. See `Azure Hybrid User Benefits - `_ for more details. Possible values - include: "None", "Windows_Server". + `_ for more details. Known values are: + "None", "Windows_Server". :paramtype license_type: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.LicenseType :keyword enable_csi_proxy: For more details on CSI proxy, see the `CSI proxy GitHub repo @@ -5027,19 +5021,19 @@ def __init__( class NetworkProfileForSnapshot(msrest.serialization.Model): """network profile for managed cluster snapshot, these properties are read only. - :ivar network_plugin: networkPlugin for managed cluster snapshot. Possible values include: - "azure", "kubenet", "none". Default value: "kubenet". + :ivar network_plugin: networkPlugin for managed cluster snapshot. Known values are: "azure", + "kubenet", "none". Default value: "kubenet". :vartype network_plugin: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.NetworkPlugin - :ivar network_policy: networkPolicy for managed cluster snapshot. Possible values include: - "calico", "azure". + :ivar network_policy: networkPolicy for managed cluster snapshot. Known values are: "calico", + "azure". :vartype network_policy: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.NetworkPolicy - :ivar network_mode: networkMode for managed cluster snapshot. Possible values include: - "transparent", "bridge". + :ivar network_mode: networkMode for managed cluster snapshot. Known values are: "transparent", + "bridge". :vartype network_mode: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.NetworkMode - :ivar load_balancer_sku: loadBalancerSku for managed cluster snapshot. Possible values include: + :ivar load_balancer_sku: loadBalancerSku for managed cluster snapshot. Known values are: "standard", "basic". :vartype load_balancer_sku: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.LoadBalancerSku @@ -5055,27 +5049,27 @@ class NetworkProfileForSnapshot(msrest.serialization.Model): def __init__( self, *, - network_plugin: Optional[Union[str, "NetworkPlugin"]] = "kubenet", - network_policy: Optional[Union[str, "NetworkPolicy"]] = None, - network_mode: Optional[Union[str, "NetworkMode"]] = None, - load_balancer_sku: Optional[Union[str, "LoadBalancerSku"]] = None, + network_plugin: Optional[Union[str, "_models.NetworkPlugin"]] = "kubenet", + network_policy: Optional[Union[str, "_models.NetworkPolicy"]] = None, + network_mode: Optional[Union[str, "_models.NetworkMode"]] = None, + load_balancer_sku: Optional[Union[str, "_models.LoadBalancerSku"]] = None, **kwargs ): """ - :keyword network_plugin: networkPlugin for managed cluster snapshot. Possible values include: - "azure", "kubenet", "none". Default value: "kubenet". + :keyword network_plugin: networkPlugin for managed cluster snapshot. Known values are: "azure", + "kubenet", "none". Default value: "kubenet". :paramtype network_plugin: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.NetworkPlugin - :keyword network_policy: networkPolicy for managed cluster snapshot. Possible values include: + :keyword network_policy: networkPolicy for managed cluster snapshot. Known values are: "calico", "azure". :paramtype network_policy: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.NetworkPolicy - :keyword network_mode: networkMode for managed cluster snapshot. Possible values include: + :keyword network_mode: networkMode for managed cluster snapshot. Known values are: "transparent", "bridge". :paramtype network_mode: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.NetworkMode - :keyword load_balancer_sku: loadBalancerSku for managed cluster snapshot. Possible values - include: "standard", "basic". + :keyword load_balancer_sku: loadBalancerSku for managed cluster snapshot. Known values are: + "standard", "basic". :paramtype load_balancer_sku: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.LoadBalancerSku """ @@ -5200,7 +5194,7 @@ class OSOptionProfile(msrest.serialization.Model): def __init__( self, *, - os_option_property_list: List["OSOptionProperty"], + os_option_property_list: List["_models.OSOptionProperty"], **kwargs ): """ @@ -5274,7 +5268,7 @@ def __init__( self, *, category: Optional[str] = None, - endpoints: Optional[List["EndpointDependency"]] = None, + endpoints: Optional[List["_models.EndpointDependency"]] = None, **kwargs ): """ @@ -5317,7 +5311,7 @@ class OutboundEnvironmentEndpointCollection(msrest.serialization.Model): def __init__( self, *, - value: List["OutboundEnvironmentEndpoint"], + value: List["_models.OutboundEnvironmentEndpoint"], **kwargs ): """ @@ -5333,8 +5327,8 @@ def __init__( class PowerState(msrest.serialization.Model): """Describes the Power State of the cluster. - :ivar code: Tells whether the cluster is Running or Stopped. Possible values include: - "Running", "Stopped". + :ivar code: Tells whether the cluster is Running or Stopped. Known values are: "Running", + "Stopped". :vartype code: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.Code """ @@ -5345,12 +5339,12 @@ class PowerState(msrest.serialization.Model): def __init__( self, *, - code: Optional[Union[str, "Code"]] = None, + code: Optional[Union[str, "_models.Code"]] = None, **kwargs ): """ - :keyword code: Tells whether the cluster is Running or Stopped. Possible values include: - "Running", "Stopped". + :keyword code: Tells whether the cluster is Running or Stopped. Known values are: "Running", + "Stopped". :paramtype code: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.Code """ super(PowerState, self).__init__(**kwargs) @@ -5393,7 +5387,7 @@ class PrivateEndpointConnection(msrest.serialization.Model): :vartype name: str :ivar type: The resource type. :vartype type: str - :ivar provisioning_state: The current provisioning state. Possible values include: "Succeeded", + :ivar provisioning_state: The current provisioning state. Known values are: "Succeeded", "Creating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.PrivateEndpointConnectionProvisioningState @@ -5425,8 +5419,8 @@ class PrivateEndpointConnection(msrest.serialization.Model): def __init__( self, *, - private_endpoint: Optional["PrivateEndpoint"] = None, - private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, + private_endpoint: Optional["_models.PrivateEndpoint"] = None, + private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionState"] = None, **kwargs ): """ @@ -5462,7 +5456,7 @@ class PrivateEndpointConnectionListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["PrivateEndpointConnection"]] = None, + value: Optional[List["_models.PrivateEndpointConnection"]] = None, **kwargs ): """ @@ -5553,7 +5547,7 @@ class PrivateLinkResourcesListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["PrivateLinkResource"]] = None, + value: Optional[List["_models.PrivateLinkResource"]] = None, **kwargs ): """ @@ -5568,7 +5562,7 @@ def __init__( class PrivateLinkServiceConnectionState(msrest.serialization.Model): """The state of a private link service connection. - :ivar status: The private link service connection status. Possible values include: "Pending", + :ivar status: The private link service connection status. Known values are: "Pending", "Approved", "Rejected", "Disconnected". :vartype status: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.ConnectionStatus @@ -5584,13 +5578,13 @@ class PrivateLinkServiceConnectionState(msrest.serialization.Model): def __init__( self, *, - status: Optional[Union[str, "ConnectionStatus"]] = None, + status: Optional[Union[str, "_models.ConnectionStatus"]] = None, description: Optional[str] = None, **kwargs ): """ - :keyword status: The private link service connection status. Possible values include: - "Pending", "Approved", "Rejected", "Disconnected". + :keyword status: The private link service connection status. Known values are: "Pending", + "Approved", "Rejected", "Disconnected". :paramtype status: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.ConnectionStatus :keyword description: The private link service connection description. @@ -5753,7 +5747,7 @@ class Snapshot(Resource): :ivar creation_data: CreationData to be used to specify the source agent pool resource ID to create this snapshot. :vartype creation_data: ~azure.mgmt.containerservice.v2022_02_02_preview.models.CreationData - :ivar snapshot_type: The type of a snapshot. The default is NodePool. Possible values include: + :ivar snapshot_type: The type of a snapshot. The default is NodePool. Known values are: "NodePool", "ManagedCluster". Default value: "NodePool". :vartype snapshot_type: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.SnapshotType @@ -5761,11 +5755,11 @@ class Snapshot(Resource): :vartype kubernetes_version: str :ivar node_image_version: The version of node image. :vartype node_image_version: str - :ivar os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.OSType - :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Possible values include: "Ubuntu", "CBLMariner". + :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known + values are: "Ubuntu", "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.OSSKU :ivar vm_size: The size of the VM. :vartype vm_size: str @@ -5809,8 +5803,8 @@ def __init__( *, location: str, tags: Optional[Dict[str, str]] = None, - creation_data: Optional["CreationData"] = None, - snapshot_type: Optional[Union[str, "SnapshotType"]] = "NodePool", + creation_data: Optional["_models.CreationData"] = None, + snapshot_type: Optional[Union[str, "_models.SnapshotType"]] = "NodePool", **kwargs ): """ @@ -5821,8 +5815,8 @@ def __init__( :keyword creation_data: CreationData to be used to specify the source agent pool resource ID to create this snapshot. :paramtype creation_data: ~azure.mgmt.containerservice.v2022_02_02_preview.models.CreationData - :keyword snapshot_type: The type of a snapshot. The default is NodePool. Possible values - include: "NodePool", "ManagedCluster". Default value: "NodePool". + :keyword snapshot_type: The type of a snapshot. The default is NodePool. Known values are: + "NodePool", "ManagedCluster". Default value: "NodePool". :paramtype snapshot_type: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.SnapshotType """ @@ -5860,7 +5854,7 @@ class SnapshotListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["Snapshot"]] = None, + value: Optional[List["_models.Snapshot"]] = None, **kwargs ): """ @@ -6091,7 +6085,7 @@ class SystemData(msrest.serialization.Model): :ivar created_by: The identity that created the resource. :vartype created_by: str - :ivar created_by_type: The type of identity that created the resource. Possible values include: + :ivar created_by_type: The type of identity that created the resource. Known values are: "User", "Application", "ManagedIdentity", "Key". :vartype created_by_type: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.CreatedByType @@ -6099,8 +6093,8 @@ class SystemData(msrest.serialization.Model): :vartype created_at: ~datetime.datetime :ivar last_modified_by: The identity that last modified the resource. :vartype last_modified_by: str - :ivar last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". + :ivar last_modified_by_type: The type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", "Key". :vartype last_modified_by_type: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.CreatedByType :ivar last_modified_at: The timestamp of resource last modification (UTC). @@ -6120,26 +6114,26 @@ def __init__( self, *, created_by: Optional[str] = None, - created_by_type: Optional[Union[str, "CreatedByType"]] = None, + created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, created_at: Optional[datetime.datetime] = None, last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[Union[str, "CreatedByType"]] = None, + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, last_modified_at: Optional[datetime.datetime] = None, **kwargs ): """ :keyword created_by: The identity that created the resource. :paramtype created_by: str - :keyword created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". + :keyword created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", "Key". :paramtype created_by_type: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.CreatedByType :keyword created_at: The timestamp of resource creation (UTC). :paramtype created_at: ~datetime.datetime :keyword last_modified_by: The identity that last modified the resource. :paramtype last_modified_by: str - :keyword last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". + :keyword last_modified_by_type: The type of identity that last modified the resource. Known + values are: "User", "Application", "ManagedIdentity", "Key". :paramtype last_modified_by_type: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.CreatedByType :keyword last_modified_at: The timestamp of resource last modification (UTC). @@ -6182,8 +6176,8 @@ def __init__( class TimeInWeek(msrest.serialization.Model): """Time in a week. - :ivar day: The day of the week. Possible values include: "Sunday", "Monday", "Tuesday", - "Wednesday", "Thursday", "Friday", "Saturday". + :ivar day: The day of the week. Known values are: "Sunday", "Monday", "Tuesday", "Wednesday", + "Thursday", "Friday", "Saturday". :vartype day: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.WeekDay :ivar hour_slots: Each integer hour represents a time range beginning at 0m after the hour ending at the next hour (non-inclusive). 0 corresponds to 00:00 UTC, 23 corresponds to 23:00 @@ -6199,12 +6193,12 @@ class TimeInWeek(msrest.serialization.Model): def __init__( self, *, - day: Optional[Union[str, "WeekDay"]] = None, + day: Optional[Union[str, "_models.WeekDay"]] = None, hour_slots: Optional[List[int]] = None, **kwargs ): """ - :keyword day: The day of the week. Possible values include: "Sunday", "Monday", "Tuesday", + :keyword day: The day of the week. Known values are: "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday". :paramtype day: str or ~azure.mgmt.containerservice.v2022_02_02_preview.models.WeekDay :keyword hour_slots: Each integer hour represents a time range beginning at 0m after the hour diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/models/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/models/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/operations/__init__.py index 78e2791463ed..d3b41c8a72b0 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/operations/__init__.py @@ -16,6 +16,9 @@ from ._snapshots_operations import SnapshotsOperations from ._managed_cluster_snapshots_operations import ManagedClusterSnapshotsOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'Operations', 'ManagedClustersOperations', @@ -27,3 +30,5 @@ 'SnapshotsOperations', 'ManagedClusterSnapshotsOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/operations/_agent_pools_operations.py index 6749a7949d21..b7a261f108fb 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/operations/_agent_pools_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -35,9 +35,12 @@ def build_list_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools") # pylint: disable=line-too-long path_format_arguments = { @@ -49,18 +52,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -72,9 +73,12 @@ def build_get_request( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -87,18 +91,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -109,14 +111,17 @@ def build_create_or_update_request_initial( resource_name: str, agent_pool_name: str, *, - json: JSONType = None, + json: Optional[_models.AgentPool] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -129,20 +134,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -156,9 +159,12 @@ def build_delete_request_initial( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -171,18 +177,16 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -194,9 +198,12 @@ def build_get_upgrade_profile_request( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default") # pylint: disable=line-too-long path_format_arguments = { @@ -209,18 +216,16 @@ def build_get_upgrade_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -231,9 +236,12 @@ def build_get_available_agent_pool_versions_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions") # pylint: disable=line-too-long path_format_arguments = { @@ -245,18 +253,16 @@ def build_get_available_agent_pool_versions_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -268,9 +274,12 @@ def build_upgrade_node_image_version_request_initial( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion") # pylint: disable=line-too-long path_format_arguments = { @@ -283,42 +292,38 @@ def build_upgrade_node_image_version_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class AgentPoolsOperations(object): - """AgentPoolsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class AgentPoolsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_02_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_02_02_preview.ContainerServiceClient`'s + :attr:`agent_pools` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -326,7 +331,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Iterable["_models.AgentPoolListResult"]: + ) -> Iterable[_models.AgentPoolListResult]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. @@ -341,13 +346,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_02_02_preview.models.AgentPoolListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -357,9 +365,11 @@ def prepare_request(next_link=None): resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -369,9 +379,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -411,7 +423,7 @@ def get( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPool": + ) -> _models.AgentPool: """Gets the specified managed cluster agent pool. Gets the specified managed cluster agent pool. @@ -427,13 +439,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.AgentPool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] request = build_get_request( @@ -443,11 +458,13 @@ def get( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -473,17 +490,20 @@ def _create_or_update_initial( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> "_models.AgentPool": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] + ) -> _models.AgentPool: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-02-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] _json = self._serialize.body(parameters, 'AgentPool') @@ -496,11 +516,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -531,9 +553,9 @@ def begin_create_or_update( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> LROPoller["_models.AgentPool"]: + ) -> LROPoller[_models.AgentPool]: """Creates or updates an agent pool in the specified managed cluster. Creates or updates an agent pool in the specified managed cluster. @@ -559,17 +581,20 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_02_02_preview.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, @@ -577,20 +602,27 @@ def begin_create_or_update( 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): - response = pipeline_response.http_response deserialized = self._deserialize('AgentPool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -610,13 +642,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements agent_pool_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -626,11 +661,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -677,21 +714,26 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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) @@ -701,8 +743,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -722,7 +770,7 @@ def get_upgrade_profile( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPoolUpgradeProfile": + ) -> _models.AgentPoolUpgradeProfile: """Gets the upgrade profile for an agent pool. Gets the upgrade profile for an agent pool. @@ -738,13 +786,16 @@ def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.AgentPoolUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] request = build_get_upgrade_profile_request( @@ -754,11 +805,13 @@ def get_upgrade_profile( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -785,7 +838,7 @@ def get_available_agent_pool_versions( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.AgentPoolAvailableVersions": + ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported Kubernetes versions for the specified agent pool. See `supported Kubernetes versions @@ -801,13 +854,16 @@ def get_available_agent_pool_versions( :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.AgentPoolAvailableVersions :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolAvailableVersions"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] request = build_get_available_agent_pool_versions_request( @@ -816,11 +872,13 @@ def get_available_agent_pool_versions( resource_name=resource_name, api_version=api_version, template_url=self.get_available_agent_pool_versions.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -847,14 +905,17 @@ def _upgrade_node_image_version_initial( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> Optional["_models.AgentPool"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.AgentPool"]] + ) -> Optional[_models.AgentPool]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] request = build_upgrade_node_image_version_request_initial( @@ -864,11 +925,13 @@ def _upgrade_node_image_version_initial( agent_pool_name=agent_pool_name, api_version=api_version, template_url=self._upgrade_node_image_version_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -901,7 +964,7 @@ def begin_upgrade_node_image_version( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> LROPoller["_models.AgentPool"]: + ) -> LROPoller[_models.AgentPool]: """Upgrades the node image version of an agent pool to the latest. Upgrading the node image version of an agent pool applies the newest OS and runtime updates to @@ -927,21 +990,26 @@ def begin_upgrade_node_image_version( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_02_02_preview.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._upgrade_node_image_version_initial( + raw_result = self._upgrade_node_image_version_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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) @@ -957,8 +1025,14 @@ def get_long_running_output(pipeline_response): return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/operations/_maintenance_configurations_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/operations/_maintenance_configurations_operations.py index 44cb450864b0..3fa1d72240c7 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/operations/_maintenance_configurations_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/operations/_maintenance_configurations_operations.py @@ -16,12 +16,12 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -33,9 +33,12 @@ def build_list_by_managed_cluster_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations") # pylint: disable=line-too-long path_format_arguments = { @@ -47,18 +50,16 @@ def build_list_by_managed_cluster_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -70,9 +71,12 @@ def build_get_request( config_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long path_format_arguments = { @@ -85,18 +89,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -107,14 +109,17 @@ def build_create_or_update_request( resource_name: str, config_name: str, *, - json: JSONType = None, + json: Optional[_models.MaintenanceConfiguration] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long path_format_arguments = { @@ -127,20 +132,18 @@ def build_create_or_update_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -154,9 +157,12 @@ def build_delete_request( config_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long path_format_arguments = { @@ -169,42 +175,38 @@ def build_delete_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class MaintenanceConfigurationsOperations(object): - """MaintenanceConfigurationsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class MaintenanceConfigurationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_02_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_02_02_preview.ContainerServiceClient`'s + :attr:`maintenance_configurations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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_by_managed_cluster( @@ -212,7 +214,7 @@ def list_by_managed_cluster( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Iterable["_models.MaintenanceConfigurationListResult"]: + ) -> Iterable[_models.MaintenanceConfigurationListResult]: """Gets a list of maintenance configurations in the specified managed cluster. Gets a list of maintenance configurations in the specified managed cluster. @@ -228,13 +230,16 @@ def list_by_managed_cluster( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_02_02_preview.models.MaintenanceConfigurationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfigurationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfigurationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -244,9 +249,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=self.list_by_managed_cluster.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -256,9 +263,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -298,7 +307,7 @@ def get( resource_name: str, config_name: str, **kwargs: Any - ) -> "_models.MaintenanceConfiguration": + ) -> _models.MaintenanceConfiguration: """Gets the specified maintenance configuration of a managed cluster. Gets the specified maintenance configuration of a managed cluster. @@ -314,13 +323,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.MaintenanceConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfiguration"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] request = build_get_request( @@ -330,11 +342,13 @@ def get( config_name=config_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -361,9 +375,9 @@ def create_or_update( resource_group_name: str, resource_name: str, config_name: str, - parameters: "_models.MaintenanceConfiguration", + parameters: _models.MaintenanceConfiguration, **kwargs: Any - ) -> "_models.MaintenanceConfiguration": + ) -> _models.MaintenanceConfiguration: """Creates or updates a maintenance configuration in the specified managed cluster. Creates or updates a maintenance configuration in the specified managed cluster. @@ -382,14 +396,17 @@ def create_or_update( :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.MaintenanceConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfiguration"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-02-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] _json = self._serialize.body(parameters, 'MaintenanceConfiguration') @@ -402,11 +419,13 @@ def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -450,13 +469,16 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -466,11 +488,13 @@ def delete( # pylint: disable=inconsistent-return-statements config_name=config_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/operations/_managed_cluster_snapshots_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/operations/_managed_cluster_snapshots_operations.py index a66e127479e4..6b37ecba75ec 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/operations/_managed_cluster_snapshots_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/operations/_managed_cluster_snapshots_operations.py @@ -16,12 +16,12 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -31,9 +31,12 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedclustersnapshots") # pylint: disable=line-too-long path_format_arguments = { @@ -43,18 +46,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -64,9 +65,12 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots") # pylint: disable=line-too-long path_format_arguments = { @@ -77,18 +81,16 @@ def build_list_by_resource_group_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -99,9 +101,12 @@ def build_get_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -113,18 +118,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -134,14 +137,17 @@ def build_create_or_update_request( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedClusterSnapshot] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -153,20 +159,18 @@ def build_create_or_update_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -178,14 +182,17 @@ def build_update_tags_request( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.TagsObject] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -197,20 +204,18 @@ def build_update_tags_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -223,9 +228,12 @@ def build_delete_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -237,48 +245,44 @@ def build_delete_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class ManagedClusterSnapshotsOperations(object): - """ManagedClusterSnapshotsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ManagedClusterSnapshotsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_02_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_02_02_preview.ContainerServiceClient`'s + :attr:`managed_cluster_snapshots` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> Iterable["_models.ManagedClusterSnapshotListResult"]: + ) -> Iterable[_models.ManagedClusterSnapshotListResult]: """Gets a list of managed cluster snapshots in the specified subscription. Gets a list of managed cluster snapshots in the specified subscription. @@ -290,13 +294,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedClusterSnapshotListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshotListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterSnapshotListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -304,9 +311,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -314,9 +323,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -354,7 +365,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.ManagedClusterSnapshotListResult"]: + ) -> Iterable[_models.ManagedClusterSnapshotListResult]: """Lists managed cluster snapshots in the specified subscription and resource group. Lists managed cluster snapshots in the specified subscription and resource group. @@ -368,13 +379,16 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedClusterSnapshotListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshotListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterSnapshotListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -383,9 +397,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -394,9 +410,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -435,7 +453,7 @@ def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedClusterSnapshot": + ) -> _models.ManagedClusterSnapshot: """Gets a managed cluster snapshot. Gets a managed cluster snapshot. @@ -449,13 +467,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedClusterSnapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterSnapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshot] request = build_get_request( @@ -464,11 +485,13 @@ def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -494,9 +517,9 @@ def create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterSnapshot", + parameters: _models.ManagedClusterSnapshot, **kwargs: Any - ) -> "_models.ManagedClusterSnapshot": + ) -> _models.ManagedClusterSnapshot: """Creates or updates a managed cluster snapshot. Creates or updates a managed cluster snapshot. @@ -513,14 +536,17 @@ def create_or_update( :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedClusterSnapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterSnapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-02-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshot] _json = self._serialize.body(parameters, 'ManagedClusterSnapshot') @@ -532,11 +558,13 @@ def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -566,9 +594,9 @@ def update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.ManagedClusterSnapshot": + ) -> _models.ManagedClusterSnapshot: """Updates tags on a managed cluster snapshot. Updates tags on a managed cluster snapshot. @@ -584,14 +612,17 @@ def update_tags( :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedClusterSnapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterSnapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshot] _json = self._serialize.body(parameters, 'TagsObject') @@ -603,11 +634,13 @@ def update_tags( content_type=content_type, json=_json, template_url=self.update_tags.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -648,13 +681,16 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -663,11 +699,13 @@ def delete( # pylint: disable=inconsistent-return-statements resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/operations/_managed_clusters_operations.py index 13ef573e1cf8..1e6e484add0a 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/operations/_managed_clusters_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -36,9 +36,12 @@ def build_get_os_options_request( resource_type: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default") # pylint: disable=line-too-long path_format_arguments = { @@ -49,20 +52,18 @@ def build_get_os_options_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if resource_type is not None: - _query_parameters['resource-type'] = _SERIALIZER.query("resource_type", resource_type, 'str') + _params['resource-type'] = _SERIALIZER.query("resource_type", resource_type, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -71,9 +72,12 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters") path_format_arguments = { @@ -83,18 +87,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -104,9 +106,12 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters") # pylint: disable=line-too-long path_format_arguments = { @@ -117,18 +122,16 @@ def build_list_by_resource_group_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -139,9 +142,12 @@ def build_get_upgrade_profile_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default") # pylint: disable=line-too-long path_format_arguments = { @@ -153,18 +159,16 @@ def build_get_upgrade_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -176,9 +180,12 @@ def build_get_access_profile_request( role_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -191,18 +198,16 @@ def build_get_access_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -215,9 +220,12 @@ def build_list_cluster_admin_credentials_request( server_fqdn: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -229,20 +237,18 @@ def build_list_cluster_admin_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if server_fqdn is not None: - _query_parameters['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -256,9 +262,12 @@ def build_list_cluster_user_credentials_request( format: Optional[Union[str, "_models.Format"]] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -270,22 +279,20 @@ def build_list_cluster_user_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if server_fqdn is not None: - _query_parameters['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') if format is not None: - _query_parameters['format'] = _SERIALIZER.query("format", format, 'str') + _params['format'] = _SERIALIZER.query("format", format, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -298,9 +305,12 @@ def build_list_cluster_monitoring_user_credentials_request( server_fqdn: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -312,20 +322,18 @@ def build_list_cluster_monitoring_user_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if server_fqdn is not None: - _query_parameters['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -336,9 +344,12 @@ def build_get_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -350,18 +361,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -371,14 +380,17 @@ def build_create_or_update_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedCluster] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -390,20 +402,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -415,14 +425,17 @@ def build_update_tags_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.TagsObject] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -434,20 +447,18 @@ def build_update_tags_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -460,9 +471,12 @@ def build_delete_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -474,18 +488,16 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -495,14 +507,17 @@ def build_reset_service_principal_profile_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedClusterServicePrincipalProfile] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile") # pylint: disable=line-too-long path_format_arguments = { @@ -514,20 +529,18 @@ def build_reset_service_principal_profile_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -539,14 +552,17 @@ def build_reset_aad_profile_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedClusterAADProfile] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile") # pylint: disable=line-too-long path_format_arguments = { @@ -558,20 +574,18 @@ def build_reset_aad_profile_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -584,9 +598,12 @@ def build_rotate_cluster_certificates_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates") # pylint: disable=line-too-long path_format_arguments = { @@ -598,18 +615,16 @@ def build_rotate_cluster_certificates_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -620,9 +635,12 @@ def build_stop_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop") # pylint: disable=line-too-long path_format_arguments = { @@ -634,18 +652,16 @@ def build_stop_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -656,9 +672,12 @@ def build_start_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start") # pylint: disable=line-too-long path_format_arguments = { @@ -670,18 +689,16 @@ def build_start_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -691,14 +708,17 @@ def build_run_command_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.RunCommandRequest] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand") # pylint: disable=line-too-long path_format_arguments = { @@ -710,20 +730,18 @@ def build_run_command_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -737,9 +755,12 @@ def build_get_command_result_request( command_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}") # pylint: disable=line-too-long path_format_arguments = { @@ -752,18 +773,16 @@ def build_get_command_result_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -774,9 +793,12 @@ def build_list_outbound_network_dependencies_endpoints_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints") # pylint: disable=line-too-long path_format_arguments = { @@ -788,42 +810,38 @@ def build_list_outbound_network_dependencies_endpoints_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class ManagedClustersOperations(object): # pylint: disable=too-many-public-methods - """ManagedClustersOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ManagedClustersOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_02_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_02_02_preview.ContainerServiceClient`'s + :attr:`managed_clusters` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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_os_options( @@ -831,7 +849,7 @@ def get_os_options( location: str, resource_type: Optional[str] = None, **kwargs: Any - ) -> "_models.OSOptionProfile": + ) -> _models.OSOptionProfile: """Gets supported OS options in the specified subscription. Gets supported OS options in the specified subscription. @@ -846,13 +864,16 @@ def get_os_options( :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.OSOptionProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OSOptionProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OSOptionProfile] request = build_get_os_options_request( @@ -861,11 +882,13 @@ def get_os_options( api_version=api_version, resource_type=resource_type, template_url=self.get_os_options.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -890,7 +913,7 @@ def get_os_options( def list( self, **kwargs: Any - ) -> Iterable["_models.ManagedClusterListResult"]: + ) -> Iterable[_models.ManagedClusterListResult]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. @@ -902,13 +925,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -916,9 +942,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -926,9 +954,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -966,7 +996,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.ManagedClusterListResult"]: + ) -> Iterable[_models.ManagedClusterListResult]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. @@ -980,13 +1010,16 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -995,9 +1028,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -1006,9 +1041,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -1047,7 +1084,7 @@ def get_upgrade_profile( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedClusterUpgradeProfile": + ) -> _models.ManagedClusterUpgradeProfile: """Gets the upgrade profile of a managed cluster. Gets the upgrade profile of a managed cluster. @@ -1061,13 +1098,16 @@ def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedClusterUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] request = build_get_upgrade_profile_request( @@ -1076,11 +1116,13 @@ def get_upgrade_profile( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1108,7 +1150,7 @@ def get_access_profile( resource_name: str, role_name: str, **kwargs: Any - ) -> "_models.ManagedClusterAccessProfile": + ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. **WARNING**\ : This API will be deprecated. Instead use `ListClusterUserCredentials @@ -1127,13 +1169,16 @@ def get_access_profile( :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedClusterAccessProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterAccessProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] request = build_get_access_profile_request( @@ -1143,11 +1188,13 @@ def get_access_profile( role_name=role_name, api_version=api_version, template_url=self.get_access_profile.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1175,7 +1222,7 @@ def list_cluster_admin_credentials( resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Lists the admin credentials of a managed cluster. Lists the admin credentials of a managed cluster. @@ -1191,13 +1238,16 @@ def list_cluster_admin_credentials( :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_admin_credentials_request( @@ -1207,11 +1257,13 @@ def list_cluster_admin_credentials( api_version=api_version, server_fqdn=server_fqdn, template_url=self.list_cluster_admin_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1240,7 +1292,7 @@ def list_cluster_user_credentials( server_fqdn: Optional[str] = None, format: Optional[Union[str, "_models.Format"]] = None, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Lists the user credentials of a managed cluster. Lists the user credentials of a managed cluster. @@ -1260,13 +1312,16 @@ def list_cluster_user_credentials( :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_user_credentials_request( @@ -1277,11 +1332,13 @@ def list_cluster_user_credentials( server_fqdn=server_fqdn, format=format, template_url=self.list_cluster_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1309,7 +1366,7 @@ def list_cluster_monitoring_user_credentials( resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Lists the cluster monitoring user credentials of a managed cluster. Lists the cluster monitoring user credentials of a managed cluster. @@ -1325,13 +1382,16 @@ def list_cluster_monitoring_user_credentials( :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_monitoring_user_credentials_request( @@ -1341,11 +1401,13 @@ def list_cluster_monitoring_user_credentials( api_version=api_version, server_fqdn=server_fqdn, template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1372,7 +1434,7 @@ def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedCluster": + ) -> _models.ManagedCluster: """Gets a managed cluster. Gets a managed cluster. @@ -1386,13 +1448,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedCluster :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] request = build_get_request( @@ -1401,11 +1466,13 @@ def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1430,17 +1497,20 @@ def _create_or_update_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-02-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'ManagedCluster') @@ -1452,11 +1522,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1486,9 +1558,9 @@ def begin_create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> LROPoller["_models.ManagedCluster"]: + ) -> LROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. Creates or updates a managed cluster. @@ -1513,37 +1585,47 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1560,17 +1642,20 @@ def _update_tags_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-02-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'TagsObject') @@ -1582,11 +1667,13 @@ def _update_tags_initial( content_type=content_type, json=_json, template_url=self._update_tags_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1612,9 +1699,9 @@ def begin_update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> LROPoller["_models.ManagedCluster"]: + ) -> LROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates tags on a managed cluster. @@ -1639,37 +1726,47 @@ def begin_update_tags( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_02_02_preview.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._update_tags_initial( + raw_result = self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1688,13 +1785,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -1703,11 +1803,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1751,20 +1853,25 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_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) @@ -1774,8 +1881,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1792,17 +1905,20 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-02-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') @@ -1814,11 +1930,13 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re content_type=content_type, json=_json, template_url=self._reset_service_principal_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1840,7 +1958,7 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> LROPoller[None]: """Reset the Service Principal Profile of a managed cluster. @@ -1866,23 +1984,28 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._reset_service_principal_profile_initial( + raw_result = self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1892,8 +2015,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1910,17 +2039,20 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') @@ -1932,11 +2064,13 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement content_type=content_type, json=_json, template_url=self._reset_aad_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1958,7 +2092,7 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> LROPoller[None]: """Reset the AAD Profile of a managed cluster. @@ -1984,23 +2118,28 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._reset_aad_profile_initial( + raw_result = self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -2010,8 +2149,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2030,13 +2175,16 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_rotate_cluster_certificates_request_initial( @@ -2045,11 +2193,13 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return resource_name=resource_name, api_version=api_version, template_url=self._rotate_cluster_certificates_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2094,20 +2244,25 @@ def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-st :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._rotate_cluster_certificates_initial( + raw_result = self._rotate_cluster_certificates_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) @@ -2117,8 +2272,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2137,13 +2298,16 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_stop_request_initial( @@ -2152,11 +2316,13 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_name, api_version=api_version, template_url=self._stop_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2204,20 +2370,25 @@ def begin_stop( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._stop_initial( + raw_result = self._stop_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) @@ -2227,8 +2398,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2247,13 +2424,16 @@ def _start_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_start_request_initial( @@ -2262,11 +2442,13 @@ def _start_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_name, api_version=api_version, template_url=self._start_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2311,20 +2493,25 @@ def begin_start( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._start_initial( + raw_result = self._start_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) @@ -2334,8 +2521,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2352,17 +2545,20 @@ def _run_command_initial( self, resource_group_name: str, resource_name: str, - request_payload: "_models.RunCommandRequest", + request_payload: _models.RunCommandRequest, **kwargs: Any - ) -> Optional["_models.RunCommandResult"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RunCommandResult"]] + ) -> Optional[_models.RunCommandResult]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-02-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] _json = self._serialize.body(request_payload, 'RunCommandRequest') @@ -2374,11 +2570,13 @@ def _run_command_initial( content_type=content_type, json=_json, template_url=self._run_command_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2406,9 +2604,9 @@ def begin_run_command( self, resource_group_name: str, resource_name: str, - request_payload: "_models.RunCommandRequest", + request_payload: _models.RunCommandRequest, **kwargs: Any - ) -> LROPoller["_models.RunCommandResult"]: + ) -> LROPoller[_models.RunCommandResult]: """Submits a command to run against the Managed Cluster. AKS will create a pod to run the command. This is primarily useful for private clusters. For @@ -2436,37 +2634,47 @@ def begin_run_command( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_02_02_preview.models.RunCommandResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.RunCommandResult] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._run_command_initial( + raw_result = self._run_command_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, request_payload=request_payload, 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): - response = pipeline_response.http_response deserialized = self._deserialize('RunCommandResult', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2486,7 +2694,7 @@ def get_command_result( resource_name: str, command_id: str, **kwargs: Any - ) -> Optional["_models.RunCommandResult"]: + ) -> Optional[_models.RunCommandResult]: """Gets the results of a command which has been run on the Managed Cluster. Gets the results of a command which has been run on the Managed Cluster. @@ -2502,13 +2710,16 @@ def get_command_result( :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.RunCommandResult or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RunCommandResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] request = build_get_command_result_request( @@ -2518,11 +2729,13 @@ def get_command_result( command_id=command_id, api_version=api_version, template_url=self.get_command_result.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2551,7 +2764,7 @@ def list_outbound_network_dependencies_endpoints( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Iterable["_models.OutboundEnvironmentEndpointCollection"]: + ) -> Iterable[_models.OutboundEnvironmentEndpointCollection]: """Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. @@ -2569,13 +2782,16 @@ def list_outbound_network_dependencies_endpoints( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_02_02_preview.models.OutboundEnvironmentEndpointCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OutboundEnvironmentEndpointCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -2585,9 +2801,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=self.list_outbound_network_dependencies_endpoints.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -2597,9 +2815,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/operations/_operations.py index ac09c6409447..14c30c824aa5 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/operations/_operations.py @@ -16,6 +16,7 @@ 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 @@ -29,55 +30,54 @@ def build_list_request( **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.ContainerService/operations") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class Operations(object): - """Operations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_02_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_02_02_preview.ContainerServiceClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> Iterable["_models.OperationListResult"]: + ) -> Iterable[_models.OperationListResult]: """Gets a list of operations. Gets a list of operations. @@ -88,31 +88,38 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_02_02_preview.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/operations/_private_endpoint_connections_operations.py index d9dc425a43e3..a091e33e7fba 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/operations/_private_endpoint_connections_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast from msrest import Serializer @@ -16,13 +16,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -34,9 +34,12 @@ def build_list_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections") # pylint: disable=line-too-long path_format_arguments = { @@ -48,18 +51,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -71,9 +72,12 @@ def build_get_request( private_endpoint_connection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -86,18 +90,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -108,14 +110,17 @@ def build_update_request( resource_name: str, private_endpoint_connection_name: str, *, - json: JSONType = None, + json: Optional[_models.PrivateEndpointConnection] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -128,20 +133,18 @@ def build_update_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -155,9 +158,12 @@ def build_delete_request_initial( private_endpoint_connection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -170,42 +176,38 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class PrivateEndpointConnectionsOperations(object): - """PrivateEndpointConnectionsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class PrivateEndpointConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_02_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_02_02_preview.ContainerServiceClient`'s + :attr:`private_endpoint_connections` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -213,7 +215,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnectionListResult": + ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. To learn more about private clusters, see: @@ -229,13 +231,16 @@ def list( ~azure.mgmt.containerservice.v2022_02_02_preview.models.PrivateEndpointConnectionListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] request = build_list_request( @@ -244,11 +249,13 @@ def list( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -276,7 +283,7 @@ def get( resource_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Gets the specified private endpoint connection. To learn more about private clusters, see: @@ -293,13 +300,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] request = build_get_request( @@ -309,11 +319,13 @@ def get( private_endpoint_connection_name=private_endpoint_connection_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -340,9 +352,9 @@ def update( resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - parameters: "_models.PrivateEndpointConnection", + parameters: _models.PrivateEndpointConnection, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. Updates a private endpoint connection. @@ -361,14 +373,17 @@ def update( :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] _json = self._serialize.body(parameters, 'PrivateEndpointConnection') @@ -381,11 +396,13 @@ def update( content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -413,13 +430,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -429,11 +449,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name=private_endpoint_connection_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -480,21 +502,26 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -504,8 +531,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/operations/_private_link_resources_operations.py index b87c353d50e6..5596b7f7f905 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/operations/_private_link_resources_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/operations/_private_link_resources_operations.py @@ -15,6 +15,7 @@ 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 @@ -31,9 +32,12 @@ def build_list_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources") # pylint: disable=line-too-long path_format_arguments = { @@ -45,42 +49,38 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class PrivateLinkResourcesOperations(object): - """PrivateLinkResourcesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class PrivateLinkResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_02_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_02_02_preview.ContainerServiceClient`'s + :attr:`private_link_resources` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -88,7 +88,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.PrivateLinkResourcesListResult": + ) -> _models.PrivateLinkResourcesListResult: """Gets a list of private link resources in the specified managed cluster. To learn more about private clusters, see: @@ -103,13 +103,16 @@ def list( :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.PrivateLinkResourcesListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourcesListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] request = build_list_request( @@ -118,11 +121,13 @@ def list( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/operations/_resolve_private_link_service_id_operations.py index 841f4a340d3f..3098b43e4fd2 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/operations/_resolve_private_link_service_id_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/operations/_resolve_private_link_service_id_operations.py @@ -15,12 +15,12 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -31,14 +31,17 @@ def build_post_request( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.PrivateLinkResource] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId") # pylint: disable=line-too-long path_format_arguments = { @@ -50,55 +53,51 @@ def build_post_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs ) -class ResolvePrivateLinkServiceIdOperations(object): - """ResolvePrivateLinkServiceIdOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ResolvePrivateLinkServiceIdOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_02_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_02_02_preview.ContainerServiceClient`'s + :attr:`resolve_private_link_service_id` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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 post( self, resource_group_name: str, resource_name: str, - parameters: "_models.PrivateLinkResource", + parameters: _models.PrivateLinkResource, **kwargs: Any - ) -> "_models.PrivateLinkResource": + ) -> _models.PrivateLinkResource: """Gets the private link service ID for the specified managed cluster. Gets the private link service ID for the specified managed cluster. @@ -114,14 +113,17 @@ def post( :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.PrivateLinkResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-02-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] _json = self._serialize.body(parameters, 'PrivateLinkResource') @@ -133,11 +135,13 @@ def post( content_type=content_type, json=_json, template_url=self.post.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/operations/_snapshots_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/operations/_snapshots_operations.py index d522fa508977..f2afcde09570 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/operations/_snapshots_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_02_02_preview/operations/_snapshots_operations.py @@ -16,12 +16,12 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -31,9 +31,12 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots") path_format_arguments = { @@ -43,18 +46,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -64,9 +65,12 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots") # pylint: disable=line-too-long path_format_arguments = { @@ -77,18 +81,16 @@ def build_list_by_resource_group_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -99,9 +101,12 @@ def build_get_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -113,18 +118,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -134,14 +137,17 @@ def build_create_or_update_request( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.Snapshot] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -153,20 +159,18 @@ def build_create_or_update_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -178,14 +182,17 @@ def build_update_tags_request( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.TagsObject] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -197,20 +204,18 @@ def build_update_tags_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -223,9 +228,12 @@ def build_delete_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -237,48 +245,44 @@ def build_delete_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class SnapshotsOperations(object): - """SnapshotsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class SnapshotsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_02_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_02_02_preview.ContainerServiceClient`'s + :attr:`snapshots` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> Iterable["_models.SnapshotListResult"]: + ) -> Iterable[_models.SnapshotListResult]: """Gets a list of snapshots in the specified subscription. Gets a list of snapshots in the specified subscription. @@ -289,13 +293,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_02_02_preview.models.SnapshotListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -303,9 +310,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -313,9 +322,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -353,7 +364,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.SnapshotListResult"]: + ) -> Iterable[_models.SnapshotListResult]: """Lists snapshots in the specified subscription and resource group. Lists snapshots in the specified subscription and resource group. @@ -366,13 +377,16 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_02_02_preview.models.SnapshotListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -381,9 +395,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -392,9 +408,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -433,7 +451,7 @@ def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.Snapshot": + ) -> _models.Snapshot: """Gets a snapshot. Gets a snapshot. @@ -447,13 +465,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.Snapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] request = build_get_request( @@ -462,11 +483,13 @@ def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -492,9 +515,9 @@ def create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.Snapshot", + parameters: _models.Snapshot, **kwargs: Any - ) -> "_models.Snapshot": + ) -> _models.Snapshot: """Creates or updates a snapshot. Creates or updates a snapshot. @@ -510,14 +533,17 @@ def create_or_update( :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.Snapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-02-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] _json = self._serialize.body(parameters, 'Snapshot') @@ -529,11 +555,13 @@ def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -563,9 +591,9 @@ def update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.Snapshot": + ) -> _models.Snapshot: """Updates tags on a snapshot. Updates tags on a snapshot. @@ -581,14 +609,17 @@ def update_tags( :rtype: ~azure.mgmt.containerservice.v2022_02_02_preview.models.Snapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] _json = self._serialize.body(parameters, 'TagsObject') @@ -600,11 +631,13 @@ def update_tags( content_type=content_type, json=_json, template_url=self.update_tags.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -645,13 +678,16 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-02-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-02-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -660,11 +696,13 @@ def delete( # pylint: disable=inconsistent-return-statements resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/__init__.py index 53c675bd95e2..37a5f9e02e6f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._container_service_client import ContainerServiceClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['ContainerServiceClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/_container_service_client.py index 5fe0711ab056..f38666aef450 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/_container_service_client.py @@ -73,14 +73,30 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.managed_clusters = ManagedClustersOperations(self._client, self._config, self._serialize, self._deserialize) - self.maintenance_configurations = MaintenanceConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) - self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) - self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations(self._client, self._config, self._serialize, self._deserialize) - self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_clusters = ManagedClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.maintenance_configurations = MaintenanceConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.agent_pools = AgentPoolsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.snapshots = SnapshotsOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/__init__.py index 53c675bd95e2..37a5f9e02e6f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._container_service_client import ContainerServiceClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['ContainerServiceClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/_container_service_client.py index bf72d275df4a..3b24b8239d0a 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/_container_service_client.py @@ -74,14 +74,30 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.managed_clusters = ManagedClustersOperations(self._client, self._config, self._serialize, self._deserialize) - self.maintenance_configurations = MaintenanceConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) - self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) - self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations(self._client, self._config, self._serialize, self._deserialize) - self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_clusters = ManagedClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.maintenance_configurations = MaintenanceConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.agent_pools = AgentPoolsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.snapshots = SnapshotsOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/operations/__init__.py index 5e1e5e72fa59..e0748876288c 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/operations/__init__.py @@ -15,6 +15,9 @@ from ._resolve_private_link_service_id_operations import ResolvePrivateLinkServiceIdOperations from ._snapshots_operations import SnapshotsOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'Operations', 'ManagedClustersOperations', @@ -25,3 +28,5 @@ 'ResolvePrivateLinkServiceIdOperations', 'SnapshotsOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/operations/_agent_pools_operations.py index f12a572241bc..a1ace665b086 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/operations/_agent_pools_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. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ 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 @@ -26,26 +27,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class AgentPoolsOperations: - """AgentPoolsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_03_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_03_01.aio.ContainerServiceClient`'s + :attr:`agent_pools` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -53,7 +52,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> AsyncIterable["_models.AgentPoolListResult"]: + ) -> AsyncIterable[_models.AgentPoolListResult]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. @@ -68,13 +67,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_03_01.models.AgentPoolListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -84,9 +86,11 @@ def prepare_request(next_link=None): resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -96,9 +100,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -138,7 +144,7 @@ async def get( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPool": + ) -> _models.AgentPool: """Gets the specified managed cluster agent pool. Gets the specified managed cluster agent pool. @@ -154,13 +160,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.AgentPool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] request = build_get_request( @@ -170,11 +179,13 @@ async def get( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -200,17 +211,20 @@ async def _create_or_update_initial( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> "_models.AgentPool": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] + ) -> _models.AgentPool: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] _json = self._serialize.body(parameters, 'AgentPool') @@ -223,11 +237,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -258,9 +274,9 @@ async def begin_create_or_update( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> AsyncLROPoller["_models.AgentPool"]: + ) -> AsyncLROPoller[_models.AgentPool]: """Creates or updates an agent pool in the specified managed cluster. Creates or updates an agent pool in the specified managed cluster. @@ -287,17 +303,20 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_03_01.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, @@ -305,20 +324,27 @@ async def begin_create_or_update( 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): - response = pipeline_response.http_response deserialized = self._deserialize('AgentPool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -338,13 +364,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements agent_pool_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -354,11 +383,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -405,21 +436,26 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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) @@ -429,8 +465,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -450,7 +492,7 @@ async def get_upgrade_profile( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPoolUpgradeProfile": + ) -> _models.AgentPoolUpgradeProfile: """Gets the upgrade profile for an agent pool. Gets the upgrade profile for an agent pool. @@ -466,13 +508,16 @@ async def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.AgentPoolUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] request = build_get_upgrade_profile_request( @@ -482,11 +527,13 @@ async def get_upgrade_profile( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -513,7 +560,7 @@ async def get_available_agent_pool_versions( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.AgentPoolAvailableVersions": + ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported Kubernetes versions for the specified agent pool. See `supported Kubernetes versions @@ -529,13 +576,16 @@ async def get_available_agent_pool_versions( :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.AgentPoolAvailableVersions :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolAvailableVersions"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] request = build_get_available_agent_pool_versions_request( @@ -544,11 +594,13 @@ async def get_available_agent_pool_versions( resource_name=resource_name, api_version=api_version, template_url=self.get_available_agent_pool_versions.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -575,14 +627,17 @@ async def _upgrade_node_image_version_initial( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> Optional["_models.AgentPool"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.AgentPool"]] + ) -> Optional[_models.AgentPool]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] request = build_upgrade_node_image_version_request_initial( @@ -592,11 +647,13 @@ async def _upgrade_node_image_version_initial( agent_pool_name=agent_pool_name, api_version=api_version, template_url=self._upgrade_node_image_version_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -629,7 +686,7 @@ async def begin_upgrade_node_image_version( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> AsyncLROPoller["_models.AgentPool"]: + ) -> AsyncLROPoller[_models.AgentPool]: """Upgrades the node image version of an agent pool to the latest. Upgrading the node image version of an agent pool applies the newest OS and runtime updates to @@ -656,21 +713,26 @@ async def begin_upgrade_node_image_version( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_03_01.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._upgrade_node_image_version_initial( + raw_result = await self._upgrade_node_image_version_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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) @@ -686,8 +748,14 @@ def get_long_running_output(pipeline_response): return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/operations/_maintenance_configurations_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/operations/_maintenance_configurations_operations.py index 679e41de98c3..8c9a0f3b1c3e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/operations/_maintenance_configurations_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/operations/_maintenance_configurations_operations.py @@ -15,6 +15,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -24,26 +25,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class MaintenanceConfigurationsOperations: - """MaintenanceConfigurationsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_03_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_03_01.aio.ContainerServiceClient`'s + :attr:`maintenance_configurations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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_by_managed_cluster( @@ -51,7 +50,7 @@ def list_by_managed_cluster( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> AsyncIterable["_models.MaintenanceConfigurationListResult"]: + ) -> AsyncIterable[_models.MaintenanceConfigurationListResult]: """Gets a list of maintenance configurations in the specified managed cluster. Gets a list of maintenance configurations in the specified managed cluster. @@ -67,13 +66,16 @@ def list_by_managed_cluster( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_03_01.models.MaintenanceConfigurationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfigurationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfigurationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -83,9 +85,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=self.list_by_managed_cluster.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -95,9 +99,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -137,7 +143,7 @@ async def get( resource_name: str, config_name: str, **kwargs: Any - ) -> "_models.MaintenanceConfiguration": + ) -> _models.MaintenanceConfiguration: """Gets the specified maintenance configuration of a managed cluster. Gets the specified maintenance configuration of a managed cluster. @@ -153,13 +159,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.MaintenanceConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfiguration"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] request = build_get_request( @@ -169,11 +178,13 @@ async def get( config_name=config_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -200,9 +211,9 @@ async def create_or_update( resource_group_name: str, resource_name: str, config_name: str, - parameters: "_models.MaintenanceConfiguration", + parameters: _models.MaintenanceConfiguration, **kwargs: Any - ) -> "_models.MaintenanceConfiguration": + ) -> _models.MaintenanceConfiguration: """Creates or updates a maintenance configuration in the specified managed cluster. Creates or updates a maintenance configuration in the specified managed cluster. @@ -220,14 +231,17 @@ async def create_or_update( :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.MaintenanceConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfiguration"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] _json = self._serialize.body(parameters, 'MaintenanceConfiguration') @@ -240,11 +254,13 @@ async def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -288,13 +304,16 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -304,11 +323,13 @@ async def delete( # pylint: disable=inconsistent-return-statements config_name=config_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/operations/_managed_clusters_operations.py index 2ea78f7d0c47..1b69708903e9 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/operations/_managed_clusters_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. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ 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 @@ -26,26 +27,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ManagedClustersOperations: # pylint: disable=too-many-public-methods - """ManagedClustersOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_03_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_03_01.aio.ContainerServiceClient`'s + :attr:`managed_clusters` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace_async async def get_os_options( @@ -53,7 +52,7 @@ async def get_os_options( location: str, resource_type: Optional[str] = None, **kwargs: Any - ) -> "_models.OSOptionProfile": + ) -> _models.OSOptionProfile: """Gets supported OS options in the specified subscription. Gets supported OS options in the specified subscription. @@ -68,13 +67,16 @@ async def get_os_options( :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.OSOptionProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OSOptionProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OSOptionProfile] request = build_get_os_options_request( @@ -83,11 +85,13 @@ async def get_os_options( api_version=api_version, resource_type=resource_type, template_url=self.get_os_options.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -112,7 +116,7 @@ async def get_os_options( def list( self, **kwargs: Any - ) -> AsyncIterable["_models.ManagedClusterListResult"]: + ) -> AsyncIterable[_models.ManagedClusterListResult]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. @@ -124,13 +128,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_03_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -138,9 +145,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -148,9 +157,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -188,7 +199,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ManagedClusterListResult"]: + ) -> AsyncIterable[_models.ManagedClusterListResult]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. @@ -202,13 +213,16 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_03_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -217,9 +231,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -228,9 +244,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -269,7 +287,7 @@ async def get_upgrade_profile( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedClusterUpgradeProfile": + ) -> _models.ManagedClusterUpgradeProfile: """Gets the upgrade profile of a managed cluster. Gets the upgrade profile of a managed cluster. @@ -283,13 +301,16 @@ async def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.ManagedClusterUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] request = build_get_upgrade_profile_request( @@ -298,11 +319,13 @@ async def get_upgrade_profile( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -330,7 +353,7 @@ async def get_access_profile( resource_name: str, role_name: str, **kwargs: Any - ) -> "_models.ManagedClusterAccessProfile": + ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. **WARNING**\ : This API will be deprecated. Instead use `ListClusterUserCredentials @@ -349,13 +372,16 @@ async def get_access_profile( :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.ManagedClusterAccessProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterAccessProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] request = build_get_access_profile_request( @@ -365,11 +391,13 @@ async def get_access_profile( role_name=role_name, api_version=api_version, template_url=self.get_access_profile.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -397,7 +425,7 @@ async def list_cluster_admin_credentials( resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Lists the admin credentials of a managed cluster. Lists the admin credentials of a managed cluster. @@ -413,13 +441,16 @@ async def list_cluster_admin_credentials( :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_admin_credentials_request( @@ -429,11 +460,13 @@ async def list_cluster_admin_credentials( api_version=api_version, server_fqdn=server_fqdn, template_url=self.list_cluster_admin_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -462,7 +495,7 @@ async def list_cluster_user_credentials( server_fqdn: Optional[str] = None, format: Optional[Union[str, "_models.Format"]] = None, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Lists the user credentials of a managed cluster. Lists the user credentials of a managed cluster. @@ -482,13 +515,16 @@ async def list_cluster_user_credentials( :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_user_credentials_request( @@ -499,11 +535,13 @@ async def list_cluster_user_credentials( server_fqdn=server_fqdn, format=format, template_url=self.list_cluster_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -531,7 +569,7 @@ async def list_cluster_monitoring_user_credentials( resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Lists the cluster monitoring user credentials of a managed cluster. Lists the cluster monitoring user credentials of a managed cluster. @@ -547,13 +585,16 @@ async def list_cluster_monitoring_user_credentials( :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_monitoring_user_credentials_request( @@ -563,11 +604,13 @@ async def list_cluster_monitoring_user_credentials( api_version=api_version, server_fqdn=server_fqdn, template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -594,7 +637,7 @@ async def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedCluster": + ) -> _models.ManagedCluster: """Gets a managed cluster. Gets a managed cluster. @@ -608,13 +651,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.ManagedCluster :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] request = build_get_request( @@ -623,11 +669,13 @@ async def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -652,17 +700,20 @@ async def _create_or_update_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'ManagedCluster') @@ -674,11 +725,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -708,9 +761,9 @@ async def begin_create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> AsyncLROPoller["_models.ManagedCluster"]: + ) -> AsyncLROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. Creates or updates a managed cluster. @@ -735,37 +788,47 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_03_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -782,17 +845,20 @@ async def _update_tags_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'TagsObject') @@ -804,11 +870,13 @@ async def _update_tags_initial( content_type=content_type, json=_json, template_url=self._update_tags_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -834,9 +902,9 @@ async def begin_update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> AsyncLROPoller["_models.ManagedCluster"]: + ) -> AsyncLROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates tags on a managed cluster. @@ -861,37 +929,47 @@ async def begin_update_tags( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_03_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._update_tags_initial( + raw_result = await self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -910,13 +988,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -925,11 +1006,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -973,20 +1056,25 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_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) @@ -996,8 +1084,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1014,17 +1108,20 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') @@ -1036,11 +1133,13 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist content_type=content_type, json=_json, template_url=self._reset_service_principal_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1062,7 +1161,7 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> AsyncLROPoller[None]: """Reset the Service Principal Profile of a managed cluster. @@ -1088,23 +1187,28 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._reset_service_principal_profile_initial( + raw_result = await self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1114,8 +1218,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1132,17 +1242,20 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') @@ -1154,11 +1267,13 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta content_type=content_type, json=_json, template_url=self._reset_aad_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1180,7 +1295,7 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> AsyncLROPoller[None]: """Reset the AAD Profile of a managed cluster. @@ -1205,23 +1320,28 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._reset_aad_profile_initial( + raw_result = await self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1231,8 +1351,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1251,13 +1377,16 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_rotate_cluster_certificates_request_initial( @@ -1266,11 +1395,13 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- resource_name=resource_name, api_version=api_version, template_url=self._rotate_cluster_certificates_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1315,20 +1446,25 @@ async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-ret :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._rotate_cluster_certificates_initial( + raw_result = await self._rotate_cluster_certificates_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) @@ -1338,8 +1474,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1358,13 +1500,16 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_stop_request_initial( @@ -1373,11 +1518,13 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_name, api_version=api_version, template_url=self._stop_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1425,20 +1572,25 @@ async def begin_stop( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._stop_initial( + raw_result = await self._stop_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) @@ -1448,8 +1600,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1468,13 +1626,16 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_start_request_initial( @@ -1483,11 +1644,13 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_name, api_version=api_version, template_url=self._start_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1532,20 +1695,25 @@ async def begin_start( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._start_initial( + raw_result = await self._start_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) @@ -1555,8 +1723,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1573,17 +1747,20 @@ async def _run_command_initial( self, resource_group_name: str, resource_name: str, - request_payload: "_models.RunCommandRequest", + request_payload: _models.RunCommandRequest, **kwargs: Any - ) -> Optional["_models.RunCommandResult"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RunCommandResult"]] + ) -> Optional[_models.RunCommandResult]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] _json = self._serialize.body(request_payload, 'RunCommandRequest') @@ -1595,11 +1772,13 @@ async def _run_command_initial( content_type=content_type, json=_json, template_url=self._run_command_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1627,9 +1806,9 @@ async def begin_run_command( self, resource_group_name: str, resource_name: str, - request_payload: "_models.RunCommandRequest", + request_payload: _models.RunCommandRequest, **kwargs: Any - ) -> AsyncLROPoller["_models.RunCommandResult"]: + ) -> AsyncLROPoller[_models.RunCommandResult]: """Submits a command to run against the Managed Cluster. AKS will create a pod to run the command. This is primarily useful for private clusters. For @@ -1656,37 +1835,47 @@ async def begin_run_command( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_03_01.models.RunCommandResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.RunCommandResult] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._run_command_initial( + raw_result = await self._run_command_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, request_payload=request_payload, 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): - response = pipeline_response.http_response deserialized = self._deserialize('RunCommandResult', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1706,7 +1895,7 @@ async def get_command_result( resource_name: str, command_id: str, **kwargs: Any - ) -> Optional["_models.RunCommandResult"]: + ) -> Optional[_models.RunCommandResult]: """Gets the results of a command which has been run on the Managed Cluster. Gets the results of a command which has been run on the Managed Cluster. @@ -1722,13 +1911,16 @@ async def get_command_result( :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.RunCommandResult or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RunCommandResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] request = build_get_command_result_request( @@ -1738,11 +1930,13 @@ async def get_command_result( command_id=command_id, api_version=api_version, template_url=self.get_command_result.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1771,7 +1965,7 @@ def list_outbound_network_dependencies_endpoints( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> AsyncIterable["_models.OutboundEnvironmentEndpointCollection"]: + ) -> AsyncIterable[_models.OutboundEnvironmentEndpointCollection]: """Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. @@ -1789,13 +1983,16 @@ def list_outbound_network_dependencies_endpoints( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_03_01.models.OutboundEnvironmentEndpointCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OutboundEnvironmentEndpointCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -1805,9 +2002,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=self.list_outbound_network_dependencies_endpoints.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -1817,9 +2016,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/operations/_operations.py index aeeb6081ae95..504a0380d27c 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/operations/_operations.py @@ -14,6 +14,7 @@ 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 @@ -23,32 +24,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class Operations: - """Operations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_03_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_03_01.aio.ContainerServiceClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.OperationListResult"]: + ) -> AsyncIterable[_models.OperationListResult]: """Gets a list of operations. Gets a list of operations. @@ -59,31 +58,38 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_03_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/operations/_private_endpoint_connections_operations.py index dc6dff7c8e33..17f17333120a 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/operations/_private_endpoint_connections_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -14,6 +14,7 @@ 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 @@ -24,26 +25,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class PrivateEndpointConnectionsOperations: - """PrivateEndpointConnectionsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_03_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_03_01.aio.ContainerServiceClient`'s + :attr:`private_endpoint_connections` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -51,7 +50,7 @@ async def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnectionListResult": + ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. To learn more about private clusters, see: @@ -66,13 +65,16 @@ async def list( :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.PrivateEndpointConnectionListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] request = build_list_request( @@ -81,11 +83,13 @@ async def list( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -113,7 +117,7 @@ async def get( resource_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Gets the specified private endpoint connection. To learn more about private clusters, see: @@ -130,13 +134,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] request = build_get_request( @@ -146,11 +153,13 @@ async def get( private_endpoint_connection_name=private_endpoint_connection_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -177,9 +186,9 @@ async def update( resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - parameters: "_models.PrivateEndpointConnection", + parameters: _models.PrivateEndpointConnection, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. Updates a private endpoint connection. @@ -197,14 +206,17 @@ async def update( :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] _json = self._serialize.body(parameters, 'PrivateEndpointConnection') @@ -217,11 +229,13 @@ async def update( content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -249,13 +263,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -265,11 +282,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name=private_endpoint_connection_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -316,21 +335,26 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -340,8 +364,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/operations/_private_link_resources_operations.py index 8080093107fc..d4afa7cc6d00 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/operations/_private_link_resources_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/operations/_private_link_resources_operations.py @@ -13,6 +13,7 @@ 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 @@ -22,26 +23,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class PrivateLinkResourcesOperations: - """PrivateLinkResourcesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_03_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_03_01.aio.ContainerServiceClient`'s + :attr:`private_link_resources` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -49,7 +48,7 @@ async def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.PrivateLinkResourcesListResult": + ) -> _models.PrivateLinkResourcesListResult: """Gets a list of private link resources in the specified managed cluster. To learn more about private clusters, see: @@ -64,13 +63,16 @@ async def list( :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.PrivateLinkResourcesListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourcesListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] request = build_list_request( @@ -79,11 +81,13 @@ async def list( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/operations/_resolve_private_link_service_id_operations.py index 6400a0b93abf..a4026a7e560d 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/operations/_resolve_private_link_service_id_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/operations/_resolve_private_link_service_id_operations.py @@ -13,6 +13,7 @@ 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 @@ -22,35 +23,33 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ResolvePrivateLinkServiceIdOperations: - """ResolvePrivateLinkServiceIdOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_03_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_03_01.aio.ContainerServiceClient`'s + :attr:`resolve_private_link_service_id` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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 post( self, resource_group_name: str, resource_name: str, - parameters: "_models.PrivateLinkResource", + parameters: _models.PrivateLinkResource, **kwargs: Any - ) -> "_models.PrivateLinkResource": + ) -> _models.PrivateLinkResource: """Gets the private link service ID for the specified managed cluster. Gets the private link service ID for the specified managed cluster. @@ -66,14 +65,17 @@ async def post( :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.PrivateLinkResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] _json = self._serialize.body(parameters, 'PrivateLinkResource') @@ -85,11 +87,13 @@ async def post( content_type=content_type, json=_json, template_url=self.post.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/operations/_snapshots_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/operations/_snapshots_operations.py index 3afbc9e5903c..32e4c7c6f0c4 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/operations/_snapshots_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/aio/operations/_snapshots_operations.py @@ -15,6 +15,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -24,32 +25,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class SnapshotsOperations: - """SnapshotsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_03_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_03_01.aio.ContainerServiceClient`'s + :attr:`snapshots` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.SnapshotListResult"]: + ) -> AsyncIterable[_models.SnapshotListResult]: """Gets a list of snapshots in the specified subscription. Gets a list of snapshots in the specified subscription. @@ -60,13 +59,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_03_01.models.SnapshotListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -74,9 +76,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -84,9 +88,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -124,7 +130,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.SnapshotListResult"]: + ) -> AsyncIterable[_models.SnapshotListResult]: """Lists snapshots in the specified subscription and resource group. Lists snapshots in the specified subscription and resource group. @@ -137,13 +143,16 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_03_01.models.SnapshotListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -152,9 +161,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -163,9 +174,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -204,7 +217,7 @@ async def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.Snapshot": + ) -> _models.Snapshot: """Gets a snapshot. Gets a snapshot. @@ -218,13 +231,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.Snapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] request = build_get_request( @@ -233,11 +249,13 @@ async def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -263,9 +281,9 @@ async def create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.Snapshot", + parameters: _models.Snapshot, **kwargs: Any - ) -> "_models.Snapshot": + ) -> _models.Snapshot: """Creates or updates a snapshot. Creates or updates a snapshot. @@ -281,14 +299,17 @@ async def create_or_update( :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.Snapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] _json = self._serialize.body(parameters, 'Snapshot') @@ -300,11 +321,13 @@ async def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -334,9 +357,9 @@ async def update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.Snapshot": + ) -> _models.Snapshot: """Updates tags on a snapshot. Updates tags on a snapshot. @@ -352,14 +375,17 @@ async def update_tags( :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.Snapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] _json = self._serialize.body(parameters, 'TagsObject') @@ -371,11 +397,13 @@ async def update_tags( content_type=content_type, json=_json, template_url=self.update_tags.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -416,13 +444,16 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -431,11 +462,13 @@ async def delete( # pylint: disable=inconsistent-return-statements resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/models/__init__.py index c5035d3c2558..4adc3fedca9d 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/models/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/models/__init__.py @@ -137,7 +137,9 @@ WeekDay, WorkloadRuntime, ) - +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'AgentPool', 'AgentPoolAvailableVersions', @@ -267,3 +269,5 @@ 'WeekDay', 'WorkloadRuntime', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/models/_container_service_client_enums.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/models/_container_service_client_enums.py index aa3de5ebe54e..cb066b7fffcc 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/models/_container_service_client_enums.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/models/_container_service_client_enums.py @@ -7,11 +7,10 @@ # -------------------------------------------------------------------------- from enum import Enum -from six import with_metaclass from azure.core import CaseInsensitiveEnumMeta -class AgentPoolMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class AgentPoolMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: https://docs.microsoft.com/azure/aks/use-system-pools @@ -24,7 +23,7 @@ class AgentPoolMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: User agent pools are primarily for hosting your application pods. USER = "User" -class AgentPoolType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class AgentPoolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of Agent Pool. """ @@ -33,7 +32,7 @@ class AgentPoolType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Use of this is strongly discouraged. AVAILABILITY_SET = "AvailabilitySet" -class Code(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class Code(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Tells whether the cluster is Running or Stopped """ @@ -42,7 +41,7 @@ class Code(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: The cluster is stopped. STOPPED = "Stopped" -class ConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The private link service connection status. """ @@ -51,7 +50,7 @@ class ConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): REJECTED = "Rejected" DISCONNECTED = "Disconnected" -class ContainerServiceStorageProfileTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Specifies what kind of storage to use. If omitted, the default will be chosen on your behalf based on the choice of orchestrator. """ @@ -59,7 +58,7 @@ class ContainerServiceStorageProfileTypes(with_metaclass(CaseInsensitiveEnumMeta STORAGE_ACCOUNT = "StorageAccount" MANAGED_DISKS = "ManagedDisks" -class ContainerServiceVMSizeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Size of agent VMs. Note: This is no longer maintained. """ @@ -238,7 +237,7 @@ class ContainerServiceVMSizeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, E STANDARD_NV24 = "Standard_NV24" STANDARD_NV6 = "Standard_NV6" -class Count(with_metaclass(CaseInsensitiveEnumMeta, int, Enum)): +class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): """Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, and 5. The default value is 1. """ @@ -247,7 +246,7 @@ class Count(with_metaclass(CaseInsensitiveEnumMeta, int, Enum)): THREE = 3 FIVE = 5 -class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of identity that created the resource. """ @@ -256,7 +255,7 @@ class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class Expander(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class Expander(str, Enum, metaclass=CaseInsensitiveEnumMeta): """If not specified, the default is 'random'. See `expanders `_ for more information. @@ -279,13 +278,13 @@ class Expander(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Used when you don't have a particular need for the node groups to scale differently. RANDOM = "random" -class ExtendedLocationTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ExtendedLocationTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of extendedLocation. """ EDGE_ZONE = "EdgeZone" -class Format(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class Format(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Return azure auth-provider kubeconfig. This format is deprecated in 1.22 and will be fully #: removed in 1.25. @@ -293,7 +292,7 @@ class Format(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Return exec format kubeconfig. This format requires kubelogin binary in the path. EXEC_ENUM = "exec" -class GPUInstanceProfile(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class GPUInstanceProfile(str, Enum, metaclass=CaseInsensitiveEnumMeta): """GPUInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU. """ @@ -303,14 +302,14 @@ class GPUInstanceProfile(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MIG4_G = "MIG4g" MIG7_G = "MIG7g" -class IpFamily(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class IpFamily(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The IP version to use for cluster networking and IP assignment. """ I_PV4 = "IPv4" I_PV6 = "IPv6" -class KubeletDiskType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class KubeletDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. """ @@ -320,7 +319,7 @@ class KubeletDiskType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Kubelet will use the temporary disk for its data. TEMPORARY = "Temporary" -class LicenseType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class LicenseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The license type to use for Windows VMs. See `Azure Hybrid User Benefits `_ for more details. """ @@ -330,7 +329,7 @@ class LicenseType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Enables Azure Hybrid User Benefits for Windows VMs. WINDOWS_SERVER = "Windows_Server" -class LoadBalancerSku(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class LoadBalancerSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the differences between load balancer SKUs. @@ -343,7 +342,7 @@ class LoadBalancerSku(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Use a basic Load Balancer with limited functionality. BASIC = "basic" -class ManagedClusterPodIdentityProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ManagedClusterPodIdentityProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The current provisioning state of the pod identity. """ @@ -352,13 +351,13 @@ class ManagedClusterPodIdentityProvisioningState(with_metaclass(CaseInsensitiveE DELETING = "Deleting" FAILED = "Failed" -class ManagedClusterSKUName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ManagedClusterSKUName(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The name of a managed cluster SKU. """ BASIC = "Basic" -class ManagedClusterSKUTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ManagedClusterSKUTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): """If not specified, the default is 'Free'. See `uptime SLA `_ for more details. """ @@ -369,7 +368,7 @@ class ManagedClusterSKUTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: No guaranteed SLA, no additional charges. Free tier clusters have an SLO of 99.5%. FREE = "Free" -class NetworkMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """This cannot be specified if networkPlugin is anything other than 'azure'. """ @@ -380,7 +379,7 @@ class NetworkMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: This is no longer supported. BRIDGE = "bridge" -class NetworkPlugin(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkPlugin(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Network plugin used for building the Kubernetes network. """ @@ -393,7 +392,7 @@ class NetworkPlugin(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: information. KUBENET = "kubenet" -class NetworkPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Network policy used for building the Kubernetes network. """ @@ -406,7 +405,7 @@ class NetworkPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: for more information. AZURE = "azure" -class OSDiskType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OSDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS @@ -422,14 +421,14 @@ class OSDiskType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: provides lower read/write latency, along with faster node scaling and cluster upgrades. EPHEMERAL = "Ephemeral" -class OSSKU(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OSSKU(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Specifies an OS SKU. This value must not be specified if OSType is Windows. """ UBUNTU = "Ubuntu" CBL_MARINER = "CBLMariner" -class OSType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The operating system type. The default is Linux. """ @@ -438,7 +437,7 @@ class OSType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Use Windows. WINDOWS = "Windows" -class OutboundType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OutboundType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type `_. """ @@ -458,7 +457,7 @@ class OutboundType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: advanced scenario and requires proper network configuration. USER_ASSIGNED_NAT_GATEWAY = "userAssignedNATGateway" -class PrivateEndpointConnectionProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class PrivateEndpointConnectionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The current provisioning state. """ @@ -467,14 +466,14 @@ class PrivateEndpointConnectionProvisioningState(with_metaclass(CaseInsensitiveE DELETING = "Deleting" FAILED = "Failed" -class PublicNetworkAccess(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class PublicNetworkAccess(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Allow or deny public network access for AKS """ ENABLED = "Enabled" DISABLED = "Disabled" -class ResourceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """For more information see `use managed identities in AKS `_. """ @@ -490,7 +489,7 @@ class ResourceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Do not use a managed identity for the Managed Cluster, service principal will be used instead. NONE = "None" -class ScaleDownMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ScaleDownMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Describes how VMs are added to or removed from Agent Pools. See `billing states `_. """ @@ -501,7 +500,7 @@ class ScaleDownMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: during scale down. DEALLOCATE = "Deallocate" -class ScaleSetEvictionPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The eviction policy specifies what to do with the VM when it is evicted. The default is Delete. For more information about eviction see `spot VMs `_ @@ -514,7 +513,7 @@ class ScaleSetEvictionPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)) #: cause issues with cluster scaling or upgrading. DEALLOCATE = "Deallocate" -class ScaleSetPriority(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ScaleSetPriority(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The Virtual Machine Scale Set priority. """ @@ -524,14 +523,14 @@ class ScaleSetPriority(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Regular VMs will be used. REGULAR = "Regular" -class SnapshotType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SnapshotType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of a snapshot. The default is NodePool. """ #: The snapshot is a snapshot of a node pool. NODE_POOL = "NodePool" -class UpgradeChannel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class UpgradeChannel(str, Enum, metaclass=CaseInsensitiveEnumMeta): """For more information see `setting the AKS cluster auto-upgrade channel `_. """ @@ -561,7 +560,7 @@ class UpgradeChannel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Disables auto-upgrades and keeps the cluster at its current version of Kubernetes. NONE = "none" -class WeekDay(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class WeekDay(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The weekday enum. """ @@ -573,7 +572,7 @@ class WeekDay(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): FRIDAY = "Friday" SATURDAY = "Saturday" -class WorkloadRuntime(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class WorkloadRuntime(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Determines the type of workload a node can run. """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/models/_models_py3.py index 4d2dda17be3c..b501d9885c2a 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/models/_models_py3.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/models/_models_py3.py @@ -7,11 +7,13 @@ # -------------------------------------------------------------------------- import datetime -from typing import Dict, List, Optional, Union +from typing import Dict, List, Optional, TYPE_CHECKING, Union import msrest.serialization -from ._container_service_client_enums import * +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + import __init__ as _models class SubResource(msrest.serialization.Model): @@ -79,15 +81,15 @@ class AgentPool(SubResource): :ivar os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS - `_. Possible values - include: "Managed", "Ephemeral". + `_. Known values are: + "Managed", "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2022_03_01.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Possible values include: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_03_01.models.KubeletDiskType - :ivar workload_runtime: Determines the type of workload a node can run. Possible values - include: "OCIContainer", "WasmWasi". + :ivar workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer", "WasmWasi". :vartype workload_runtime: str or ~azure.mgmt.containerservice.v2022_03_01.models.WorkloadRuntime :ivar vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and used. @@ -101,11 +103,11 @@ class AgentPool(SubResource): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_03_01.models.OSType - :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Possible values include: "Ubuntu", "CBLMariner". + :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known + values are: "Ubuntu", "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2022_03_01.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. :vartype max_count: int @@ -114,16 +116,15 @@ class AgentPool(SubResource): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it - defaults to Delete. Possible values include: "Delete", "Deallocate". + defaults to Delete. Known values are: "Delete", "Deallocate". :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_03_01.models.ScaleDownMode - :ivar type_properties_type: The type of Agent Pool. Possible values include: + :ivar type_properties_type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :vartype type_properties_type: str or ~azure.mgmt.containerservice.v2022_03_01.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Possible values include: "System", - "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". :vartype mode: str or ~azure.mgmt.containerservice.v2022_03_01.models.AgentPoolMode :ivar orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -158,12 +159,12 @@ class AgentPool(SubResource): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Possible values include: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_03_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Possible values include: "Delete", - "Deallocate". Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_03_01.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which @@ -195,7 +196,7 @@ class AgentPool(SubResource): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_03_01.models.GPUInstanceProfile :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool @@ -263,40 +264,40 @@ def __init__( count: Optional[int] = None, vm_size: Optional[str] = None, os_disk_size_gb: Optional[int] = None, - os_disk_type: Optional[Union[str, "OSDiskType"]] = None, - kubelet_disk_type: Optional[Union[str, "KubeletDiskType"]] = None, - workload_runtime: Optional[Union[str, "WorkloadRuntime"]] = None, + os_disk_type: Optional[Union[str, "_models.OSDiskType"]] = None, + kubelet_disk_type: Optional[Union[str, "_models.KubeletDiskType"]] = None, + workload_runtime: Optional[Union[str, "_models.WorkloadRuntime"]] = None, vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", - os_sku: Optional[Union[str, "OSSKU"]] = None, + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - scale_down_mode: Optional[Union[str, "ScaleDownMode"]] = None, - type_properties_type: Optional[Union[str, "AgentPoolType"]] = None, - mode: Optional[Union[str, "AgentPoolMode"]] = None, + scale_down_mode: Optional[Union[str, "_models.ScaleDownMode"]] = None, + type_properties_type: Optional[Union[str, "_models.AgentPoolType"]] = None, + mode: Optional[Union[str, "_models.AgentPoolMode"]] = None, orchestrator_version: Optional[str] = None, - upgrade_settings: Optional["AgentPoolUpgradeSettings"] = None, - power_state: Optional["PowerState"] = None, + upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, + power_state: Optional["_models.PowerState"] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", spot_max_price: Optional[float] = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, proximity_placement_group_id: Optional[str] = None, - kubelet_config: Optional["KubeletConfig"] = None, - linux_os_config: Optional["LinuxOSConfig"] = None, + kubelet_config: Optional["_models.KubeletConfig"] = None, + linux_os_config: Optional["_models.LinuxOSConfig"] = None, enable_encryption_at_host: Optional[bool] = None, enable_ultra_ssd: Optional[bool] = None, enable_fips: Optional[bool] = None, - gpu_instance_profile: Optional[Union[str, "GPUInstanceProfile"]] = None, - creation_data: Optional["CreationData"] = None, + gpu_instance_profile: Optional[Union[str, "_models.GPUInstanceProfile"]] = None, + creation_data: Optional["_models.CreationData"] = None, **kwargs ): """ @@ -315,15 +316,15 @@ def __init__( :keyword os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS - `_. Possible values - include: "Managed", "Ephemeral". + `_. Known values are: + "Managed", "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2022_03_01.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Possible values include: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_03_01.models.KubeletDiskType - :keyword workload_runtime: Determines the type of workload a node can run. Possible values - include: "OCIContainer", "WasmWasi". + :keyword workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer", "WasmWasi". :paramtype workload_runtime: str or ~azure.mgmt.containerservice.v2022_03_01.models.WorkloadRuntime :keyword vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and @@ -337,11 +338,11 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_03_01.models.OSType :keyword os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Possible values include: "Ubuntu", "CBLMariner". + Known values are: "Ubuntu", "CBLMariner". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2022_03_01.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -350,17 +351,16 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, - it defaults to Delete. Possible values include: "Delete", "Deallocate". + it defaults to Delete. Known values are: "Delete", "Deallocate". :paramtype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_03_01.models.ScaleDownMode - :keyword type_properties_type: The type of Agent Pool. Possible values include: + :keyword type_properties_type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type_properties_type: str or ~azure.mgmt.containerservice.v2022_03_01.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Possible values include: "System", - "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2022_03_01.models.AgentPoolMode :keyword orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -391,12 +391,12 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Possible values include: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_03_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Possible values include: "Delete", - "Deallocate". Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_03_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which @@ -428,7 +428,7 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_03_01.models.GPUInstanceProfile @@ -510,7 +510,7 @@ class AgentPoolAvailableVersions(msrest.serialization.Model): def __init__( self, *, - agent_pool_versions: Optional[List["AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem"]] = None, + agent_pool_versions: Optional[List["_models.AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem"]] = None, **kwargs ): """ @@ -587,7 +587,7 @@ class AgentPoolListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["AgentPool"]] = None, + value: Optional[List["_models.AgentPool"]] = None, **kwargs ): """ @@ -614,8 +614,8 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): :vartype type: str :ivar kubernetes_version: Required. The Kubernetes version (major.minor.patch). :vartype kubernetes_version: str - :ivar os_type: Required. The operating system type. The default is Linux. Possible values - include: "Linux", "Windows". Default value: "Linux". + :ivar os_type: Required. The operating system type. The default is Linux. Known values are: + "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_03_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -646,16 +646,16 @@ def __init__( self, *, kubernetes_version: str, - os_type: Union[str, "OSType"] = "Linux", - upgrades: Optional[List["AgentPoolUpgradeProfilePropertiesUpgradesItem"]] = None, + os_type: Union[str, "_models.OSType"] = "Linux", + upgrades: Optional[List["_models.AgentPoolUpgradeProfilePropertiesUpgradesItem"]] = None, latest_node_image_version: Optional[str] = None, **kwargs ): """ :keyword kubernetes_version: Required. The Kubernetes version (major.minor.patch). :paramtype kubernetes_version: str - :keyword os_type: Required. The operating system type. The default is Linux. Possible values - include: "Linux", "Windows". Default value: "Linux". + :keyword os_type: Required. The operating system type. The default is Linux. Known values are: + "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_03_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: @@ -767,7 +767,7 @@ def __init__( code: Optional[str] = None, message: Optional[str] = None, target: Optional[str] = None, - details: Optional[List["CloudErrorBody"]] = None, + details: Optional[List["_models.CloudErrorBody"]] = None, **kwargs ): """ @@ -811,7 +811,7 @@ class ContainerServiceDiagnosticsProfile(msrest.serialization.Model): def __init__( self, *, - vm_diagnostics: "ContainerServiceVMDiagnostics", + vm_diagnostics: "_models.ContainerServiceVMDiagnostics", **kwargs ): """ @@ -848,7 +848,7 @@ def __init__( self, *, admin_username: str, - ssh: "ContainerServiceSshConfiguration", + ssh: "_models.ContainerServiceSshConfiguration", **kwargs ): """ @@ -871,17 +871,17 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar count: Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, - and 5. The default value is 1. Possible values include: 1, 3, 5. Default value: "1". + and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". :vartype count: int or ~azure.mgmt.containerservice.v2022_03_01.models.Count :ivar dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. :vartype dns_prefix: str - :ivar vm_size: Required. Size of agent VMs. Possible values include: "Standard_A1", - "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", - "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", - "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", - "Standard_A8m_v2", "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", - "Standard_B8ms", "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", - "Standard_D12", "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", + :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", + "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", + "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", + "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", "Standard_B8ms", + "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", "Standard_D12", + "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", "Standard_D13_v2_Promo", "Standard_D14", "Standard_D14_v2", "Standard_D14_v2_Promo", "Standard_D15_v2", "Standard_D16_v3", "Standard_D16s_v3", "Standard_D1_v2", "Standard_D2", "Standard_D2_v2", "Standard_D2_v2_Promo", "Standard_D2_v3", "Standard_D2s_v3", "Standard_D3", @@ -926,7 +926,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): :vartype first_consecutive_static_ip: str :ivar storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Possible values include: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". :vartype storage_profile: str or ~azure.mgmt.containerservice.v2022_03_01.models.ContainerServiceStorageProfileTypes :ivar fqdn: FQDN for the master pool. @@ -955,27 +955,27 @@ def __init__( self, *, dns_prefix: str, - vm_size: Union[str, "ContainerServiceVMSizeTypes"], - count: Optional[Union[int, "Count"]] = 1, + vm_size: Union[str, "_models.ContainerServiceVMSizeTypes"], + count: Optional[Union[int, "_models.Count"]] = 1, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, first_consecutive_static_ip: Optional[str] = "10.240.255.5", - storage_profile: Optional[Union[str, "ContainerServiceStorageProfileTypes"]] = None, + storage_profile: Optional[Union[str, "_models.ContainerServiceStorageProfileTypes"]] = None, **kwargs ): """ :keyword count: Number of masters (VMs) in the container service cluster. Allowed values are 1, - 3, and 5. The default value is 1. Possible values include: 1, 3, 5. Default value: "1". + 3, and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". :paramtype count: int or ~azure.mgmt.containerservice.v2022_03_01.models.Count :keyword dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. :paramtype dns_prefix: str - :keyword vm_size: Required. Size of agent VMs. Possible values include: "Standard_A1", - "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", - "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", - "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", - "Standard_A8m_v2", "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", - "Standard_B8ms", "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", - "Standard_D12", "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", + :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", + "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", + "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", + "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", "Standard_B8ms", + "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", "Standard_D12", + "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", "Standard_D13_v2_Promo", "Standard_D14", "Standard_D14_v2", "Standard_D14_v2_Promo", "Standard_D15_v2", "Standard_D16_v3", "Standard_D16s_v3", "Standard_D1_v2", "Standard_D2", "Standard_D2_v2", "Standard_D2_v2_Promo", "Standard_D2_v3", "Standard_D2s_v3", "Standard_D3", @@ -1020,7 +1020,7 @@ def __init__( :paramtype first_consecutive_static_ip: str :keyword storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Possible values include: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". :paramtype storage_profile: str or ~azure.mgmt.containerservice.v2022_03_01.models.ContainerServiceStorageProfileTypes """ @@ -1038,14 +1038,14 @@ def __init__( class ContainerServiceNetworkProfile(msrest.serialization.Model): """Profile of network configuration. - :ivar network_plugin: Network plugin used for building the Kubernetes network. Possible values - include: "azure", "kubenet". Default value: "kubenet". + :ivar network_plugin: Network plugin used for building the Kubernetes network. Known values + are: "azure", "kubenet". Default value: "kubenet". :vartype network_plugin: str or ~azure.mgmt.containerservice.v2022_03_01.models.NetworkPlugin - :ivar network_policy: Network policy used for building the Kubernetes network. Possible values - include: "calico", "azure". + :ivar network_policy: Network policy used for building the Kubernetes network. Known values + are: "calico", "azure". :vartype network_policy: str or ~azure.mgmt.containerservice.v2022_03_01.models.NetworkPolicy :ivar network_mode: This cannot be specified if networkPlugin is anything other than 'azure'. - Possible values include: "transparent", "bridge". + Known values are: "transparent", "bridge". :vartype network_mode: str or ~azure.mgmt.containerservice.v2022_03_01.models.NetworkMode :ivar pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :vartype pod_cidr: str @@ -1060,13 +1060,13 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): :vartype docker_bridge_cidr: str :ivar outbound_type: This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type - `_. Possible values include: - "loadBalancer", "userDefinedRouting", "managedNATGateway", "userAssignedNATGateway". Default - value: "loadBalancer". + `_. Known values are: "loadBalancer", + "userDefinedRouting", "managedNATGateway", "userAssignedNATGateway". Default value: + "loadBalancer". :vartype outbound_type: str or ~azure.mgmt.containerservice.v2022_03_01.models.OutboundType :ivar load_balancer_sku: The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the - differences between load balancer SKUs. Possible values include: "standard", "basic". + differences between load balancer SKUs. Known values are: "standard", "basic". :vartype load_balancer_sku: str or ~azure.mgmt.containerservice.v2022_03_01.models.LoadBalancerSku :ivar load_balancer_profile: Profile of the cluster load balancer. @@ -1115,31 +1115,31 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): def __init__( self, *, - network_plugin: Optional[Union[str, "NetworkPlugin"]] = "kubenet", - network_policy: Optional[Union[str, "NetworkPolicy"]] = None, - network_mode: Optional[Union[str, "NetworkMode"]] = None, + network_plugin: Optional[Union[str, "_models.NetworkPlugin"]] = "kubenet", + network_policy: Optional[Union[str, "_models.NetworkPolicy"]] = None, + network_mode: Optional[Union[str, "_models.NetworkMode"]] = None, pod_cidr: Optional[str] = "10.244.0.0/16", service_cidr: Optional[str] = "10.0.0.0/16", dns_service_ip: Optional[str] = "10.0.0.10", docker_bridge_cidr: Optional[str] = "172.17.0.1/16", - outbound_type: Optional[Union[str, "OutboundType"]] = "loadBalancer", - load_balancer_sku: Optional[Union[str, "LoadBalancerSku"]] = None, - load_balancer_profile: Optional["ManagedClusterLoadBalancerProfile"] = None, - nat_gateway_profile: Optional["ManagedClusterNATGatewayProfile"] = None, + outbound_type: Optional[Union[str, "_models.OutboundType"]] = "loadBalancer", + load_balancer_sku: Optional[Union[str, "_models.LoadBalancerSku"]] = None, + load_balancer_profile: Optional["_models.ManagedClusterLoadBalancerProfile"] = None, + nat_gateway_profile: Optional["_models.ManagedClusterNATGatewayProfile"] = None, pod_cidrs: Optional[List[str]] = None, service_cidrs: Optional[List[str]] = None, - ip_families: Optional[List[Union[str, "IpFamily"]]] = None, + ip_families: Optional[List[Union[str, "_models.IpFamily"]]] = None, **kwargs ): """ - :keyword network_plugin: Network plugin used for building the Kubernetes network. Possible - values include: "azure", "kubenet". Default value: "kubenet". + :keyword network_plugin: Network plugin used for building the Kubernetes network. Known values + are: "azure", "kubenet". Default value: "kubenet". :paramtype network_plugin: str or ~azure.mgmt.containerservice.v2022_03_01.models.NetworkPlugin - :keyword network_policy: Network policy used for building the Kubernetes network. Possible - values include: "calico", "azure". + :keyword network_policy: Network policy used for building the Kubernetes network. Known values + are: "calico", "azure". :paramtype network_policy: str or ~azure.mgmt.containerservice.v2022_03_01.models.NetworkPolicy :keyword network_mode: This cannot be specified if networkPlugin is anything other than - 'azure'. Possible values include: "transparent", "bridge". + 'azure'. Known values are: "transparent", "bridge". :paramtype network_mode: str or ~azure.mgmt.containerservice.v2022_03_01.models.NetworkMode :keyword pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :paramtype pod_cidr: str @@ -1154,13 +1154,13 @@ def __init__( :paramtype docker_bridge_cidr: str :keyword outbound_type: This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type - `_. Possible values include: - "loadBalancer", "userDefinedRouting", "managedNATGateway", "userAssignedNATGateway". Default - value: "loadBalancer". + `_. Known values are: "loadBalancer", + "userDefinedRouting", "managedNATGateway", "userAssignedNATGateway". Default value: + "loadBalancer". :paramtype outbound_type: str or ~azure.mgmt.containerservice.v2022_03_01.models.OutboundType :keyword load_balancer_sku: The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the - differences between load balancer SKUs. Possible values include: "standard", "basic". + differences between load balancer SKUs. Known values are: "standard", "basic". :paramtype load_balancer_sku: str or ~azure.mgmt.containerservice.v2022_03_01.models.LoadBalancerSku :keyword load_balancer_profile: Profile of the cluster load balancer. @@ -1220,7 +1220,7 @@ class ContainerServiceSshConfiguration(msrest.serialization.Model): def __init__( self, *, - public_keys: List["ContainerServiceSshPublicKey"], + public_keys: List["_models.ContainerServiceSshPublicKey"], **kwargs ): """ @@ -1408,7 +1408,7 @@ def __init__( self, *, domain_name: Optional[str] = None, - endpoint_details: Optional[List["EndpointDetail"]] = None, + endpoint_details: Optional[List["_models.EndpointDetail"]] = None, **kwargs ): """ @@ -1474,7 +1474,7 @@ class ExtendedLocation(msrest.serialization.Model): :ivar name: The name of the extended location. :vartype name: str - :ivar type: The type of the extended location. Possible values include: "EdgeZone". + :ivar type: The type of the extended location. Known values are: "EdgeZone". :vartype type: str or ~azure.mgmt.containerservice.v2022_03_01.models.ExtendedLocationTypes """ @@ -1487,13 +1487,13 @@ def __init__( self, *, name: Optional[str] = None, - type: Optional[Union[str, "ExtendedLocationTypes"]] = None, + type: Optional[Union[str, "_models.ExtendedLocationTypes"]] = None, **kwargs ): """ :keyword name: The name of the extended location. :paramtype name: str - :keyword type: The type of the extended location. Possible values include: "EdgeZone". + :keyword type: The type of the extended location. Known values are: "EdgeZone". :paramtype type: str or ~azure.mgmt.containerservice.v2022_03_01.models.ExtendedLocationTypes """ super(ExtendedLocation, self).__init__(**kwargs) @@ -1652,7 +1652,7 @@ class LinuxOSConfig(msrest.serialization.Model): def __init__( self, *, - sysctls: Optional["SysctlConfig"] = None, + sysctls: Optional["_models.SysctlConfig"] = None, transparent_huge_page_enabled: Optional[str] = None, transparent_huge_page_defrag: Optional[str] = None, swap_file_size_mb: Optional[int] = None, @@ -1720,8 +1720,8 @@ class MaintenanceConfiguration(SubResource): def __init__( self, *, - time_in_week: Optional[List["TimeInWeek"]] = None, - not_allowed_time: Optional[List["TimeSpan"]] = None, + time_in_week: Optional[List["_models.TimeInWeek"]] = None, + not_allowed_time: Optional[List["_models.TimeSpan"]] = None, **kwargs ): """ @@ -1760,7 +1760,7 @@ class MaintenanceConfigurationListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["MaintenanceConfiguration"]] = None, + value: Optional[List["_models.MaintenanceConfiguration"]] = None, **kwargs ): """ @@ -1992,8 +1992,8 @@ class ManagedCluster(TrackedResource): :ivar security_profile: Security profile for the managed cluster. :vartype security_profile: ~azure.mgmt.containerservice.v2022_03_01.models.ManagedClusterSecurityProfile - :ivar public_network_access: Allow or deny public network access for AKS. Possible values - include: "Enabled", "Disabled". + :ivar public_network_access: Allow or deny public network access for AKS. Known values are: + "Enabled", "Disabled". :vartype public_network_access: str or ~azure.mgmt.containerservice.v2022_03_01.models.PublicNetworkAccess """ @@ -2059,33 +2059,33 @@ def __init__( *, location: str, tags: Optional[Dict[str, str]] = None, - sku: Optional["ManagedClusterSKU"] = None, - extended_location: Optional["ExtendedLocation"] = None, - identity: Optional["ManagedClusterIdentity"] = None, + sku: Optional["_models.ManagedClusterSKU"] = None, + extended_location: Optional["_models.ExtendedLocation"] = None, + identity: Optional["_models.ManagedClusterIdentity"] = None, kubernetes_version: Optional[str] = None, dns_prefix: Optional[str] = None, fqdn_subdomain: Optional[str] = None, - agent_pool_profiles: Optional[List["ManagedClusterAgentPoolProfile"]] = None, - linux_profile: Optional["ContainerServiceLinuxProfile"] = None, - windows_profile: Optional["ManagedClusterWindowsProfile"] = None, - service_principal_profile: Optional["ManagedClusterServicePrincipalProfile"] = None, - addon_profiles: Optional[Dict[str, "ManagedClusterAddonProfile"]] = None, - pod_identity_profile: Optional["ManagedClusterPodIdentityProfile"] = None, + agent_pool_profiles: Optional[List["_models.ManagedClusterAgentPoolProfile"]] = None, + linux_profile: Optional["_models.ContainerServiceLinuxProfile"] = None, + windows_profile: Optional["_models.ManagedClusterWindowsProfile"] = None, + service_principal_profile: Optional["_models.ManagedClusterServicePrincipalProfile"] = None, + addon_profiles: Optional[Dict[str, "_models.ManagedClusterAddonProfile"]] = None, + pod_identity_profile: Optional["_models.ManagedClusterPodIdentityProfile"] = None, node_resource_group: Optional[str] = None, enable_rbac: Optional[bool] = None, enable_pod_security_policy: Optional[bool] = None, - network_profile: Optional["ContainerServiceNetworkProfile"] = None, - aad_profile: Optional["ManagedClusterAADProfile"] = None, - auto_upgrade_profile: Optional["ManagedClusterAutoUpgradeProfile"] = None, - auto_scaler_profile: Optional["ManagedClusterPropertiesAutoScalerProfile"] = None, - api_server_access_profile: Optional["ManagedClusterAPIServerAccessProfile"] = None, + network_profile: Optional["_models.ContainerServiceNetworkProfile"] = None, + aad_profile: Optional["_models.ManagedClusterAADProfile"] = None, + auto_upgrade_profile: Optional["_models.ManagedClusterAutoUpgradeProfile"] = None, + auto_scaler_profile: Optional["_models.ManagedClusterPropertiesAutoScalerProfile"] = None, + api_server_access_profile: Optional["_models.ManagedClusterAPIServerAccessProfile"] = None, disk_encryption_set_id: Optional[str] = None, - identity_profile: Optional[Dict[str, "UserAssignedIdentity"]] = None, - private_link_resources: Optional[List["PrivateLinkResource"]] = None, + identity_profile: Optional[Dict[str, "_models.UserAssignedIdentity"]] = None, + private_link_resources: Optional[List["_models.PrivateLinkResource"]] = None, disable_local_accounts: Optional[bool] = None, - http_proxy_config: Optional["ManagedClusterHTTPProxyConfig"] = None, - security_profile: Optional["ManagedClusterSecurityProfile"] = None, - public_network_access: Optional[Union[str, "PublicNetworkAccess"]] = None, + http_proxy_config: Optional["_models.ManagedClusterHTTPProxyConfig"] = None, + security_profile: Optional["_models.ManagedClusterSecurityProfile"] = None, + public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None, **kwargs ): """ @@ -2174,8 +2174,8 @@ def __init__( :keyword security_profile: Security profile for the managed cluster. :paramtype security_profile: ~azure.mgmt.containerservice.v2022_03_01.models.ManagedClusterSecurityProfile - :keyword public_network_access: Allow or deny public network access for AKS. Possible values - include: "Enabled", "Disabled". + :keyword public_network_access: Allow or deny public network access for AKS. Known values are: + "Enabled", "Disabled". :paramtype public_network_access: str or ~azure.mgmt.containerservice.v2022_03_01.models.PublicNetworkAccess """ @@ -2491,15 +2491,15 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS - `_. Possible values - include: "Managed", "Ephemeral". + `_. Known values are: + "Managed", "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2022_03_01.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Possible values include: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_03_01.models.KubeletDiskType - :ivar workload_runtime: Determines the type of workload a node can run. Possible values - include: "OCIContainer", "WasmWasi". + :ivar workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer", "WasmWasi". :vartype workload_runtime: str or ~azure.mgmt.containerservice.v2022_03_01.models.WorkloadRuntime :ivar vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and used. @@ -2513,11 +2513,11 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_03_01.models.OSType - :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Possible values include: "Ubuntu", "CBLMariner". + :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known + values are: "Ubuntu", "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2022_03_01.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. :vartype max_count: int @@ -2526,15 +2526,14 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it - defaults to Delete. Possible values include: "Delete", "Deallocate". + defaults to Delete. Known values are: "Delete", "Deallocate". :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_03_01.models.ScaleDownMode - :ivar type: The type of Agent Pool. Possible values include: "VirtualMachineScaleSets", + :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2022_03_01.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Possible values include: "System", - "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". :vartype mode: str or ~azure.mgmt.containerservice.v2022_03_01.models.AgentPoolMode :ivar orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -2569,12 +2568,12 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Possible values include: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_03_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Possible values include: "Delete", - "Deallocate". Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_03_01.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which @@ -2606,7 +2605,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_03_01.models.GPUInstanceProfile :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool @@ -2668,40 +2667,40 @@ def __init__( count: Optional[int] = None, vm_size: Optional[str] = None, os_disk_size_gb: Optional[int] = None, - os_disk_type: Optional[Union[str, "OSDiskType"]] = None, - kubelet_disk_type: Optional[Union[str, "KubeletDiskType"]] = None, - workload_runtime: Optional[Union[str, "WorkloadRuntime"]] = None, + os_disk_type: Optional[Union[str, "_models.OSDiskType"]] = None, + kubelet_disk_type: Optional[Union[str, "_models.KubeletDiskType"]] = None, + workload_runtime: Optional[Union[str, "_models.WorkloadRuntime"]] = None, vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", - os_sku: Optional[Union[str, "OSSKU"]] = None, + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - scale_down_mode: Optional[Union[str, "ScaleDownMode"]] = None, - type: Optional[Union[str, "AgentPoolType"]] = None, - mode: Optional[Union[str, "AgentPoolMode"]] = None, + scale_down_mode: Optional[Union[str, "_models.ScaleDownMode"]] = None, + type: Optional[Union[str, "_models.AgentPoolType"]] = None, + mode: Optional[Union[str, "_models.AgentPoolMode"]] = None, orchestrator_version: Optional[str] = None, - upgrade_settings: Optional["AgentPoolUpgradeSettings"] = None, - power_state: Optional["PowerState"] = None, + upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, + power_state: Optional["_models.PowerState"] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", spot_max_price: Optional[float] = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, proximity_placement_group_id: Optional[str] = None, - kubelet_config: Optional["KubeletConfig"] = None, - linux_os_config: Optional["LinuxOSConfig"] = None, + kubelet_config: Optional["_models.KubeletConfig"] = None, + linux_os_config: Optional["_models.LinuxOSConfig"] = None, enable_encryption_at_host: Optional[bool] = None, enable_ultra_ssd: Optional[bool] = None, enable_fips: Optional[bool] = None, - gpu_instance_profile: Optional[Union[str, "GPUInstanceProfile"]] = None, - creation_data: Optional["CreationData"] = None, + gpu_instance_profile: Optional[Union[str, "_models.GPUInstanceProfile"]] = None, + creation_data: Optional["_models.CreationData"] = None, **kwargs ): """ @@ -2720,15 +2719,15 @@ def __init__( :keyword os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS - `_. Possible values - include: "Managed", "Ephemeral". + `_. Known values are: + "Managed", "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2022_03_01.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Possible values include: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_03_01.models.KubeletDiskType - :keyword workload_runtime: Determines the type of workload a node can run. Possible values - include: "OCIContainer", "WasmWasi". + :keyword workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer", "WasmWasi". :paramtype workload_runtime: str or ~azure.mgmt.containerservice.v2022_03_01.models.WorkloadRuntime :keyword vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and @@ -2742,11 +2741,11 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_03_01.models.OSType :keyword os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Possible values include: "Ubuntu", "CBLMariner". + Known values are: "Ubuntu", "CBLMariner". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2022_03_01.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -2755,16 +2754,15 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, - it defaults to Delete. Possible values include: "Delete", "Deallocate". + it defaults to Delete. Known values are: "Delete", "Deallocate". :paramtype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_03_01.models.ScaleDownMode - :keyword type: The type of Agent Pool. Possible values include: "VirtualMachineScaleSets", + :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2022_03_01.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Possible values include: "System", - "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2022_03_01.models.AgentPoolMode :keyword orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -2795,12 +2793,12 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Possible values include: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_03_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Possible values include: "Delete", - "Deallocate". Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_03_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which @@ -2832,7 +2830,7 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_03_01.models.GPUInstanceProfile @@ -2904,15 +2902,15 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS - `_. Possible values - include: "Managed", "Ephemeral". + `_. Known values are: + "Managed", "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2022_03_01.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Possible values include: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_03_01.models.KubeletDiskType - :ivar workload_runtime: Determines the type of workload a node can run. Possible values - include: "OCIContainer", "WasmWasi". + :ivar workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer", "WasmWasi". :vartype workload_runtime: str or ~azure.mgmt.containerservice.v2022_03_01.models.WorkloadRuntime :ivar vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and used. @@ -2926,11 +2924,11 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_03_01.models.OSType - :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Possible values include: "Ubuntu", "CBLMariner". + :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known + values are: "Ubuntu", "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2022_03_01.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. :vartype max_count: int @@ -2939,15 +2937,14 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it - defaults to Delete. Possible values include: "Delete", "Deallocate". + defaults to Delete. Known values are: "Delete", "Deallocate". :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_03_01.models.ScaleDownMode - :ivar type: The type of Agent Pool. Possible values include: "VirtualMachineScaleSets", + :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2022_03_01.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Possible values include: "System", - "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". :vartype mode: str or ~azure.mgmt.containerservice.v2022_03_01.models.AgentPoolMode :ivar orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -2982,12 +2979,12 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Possible values include: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_03_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Possible values include: "Delete", - "Deallocate". Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_03_01.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which @@ -3019,7 +3016,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_03_01.models.GPUInstanceProfile :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool @@ -3086,40 +3083,40 @@ def __init__( count: Optional[int] = None, vm_size: Optional[str] = None, os_disk_size_gb: Optional[int] = None, - os_disk_type: Optional[Union[str, "OSDiskType"]] = None, - kubelet_disk_type: Optional[Union[str, "KubeletDiskType"]] = None, - workload_runtime: Optional[Union[str, "WorkloadRuntime"]] = None, + os_disk_type: Optional[Union[str, "_models.OSDiskType"]] = None, + kubelet_disk_type: Optional[Union[str, "_models.KubeletDiskType"]] = None, + workload_runtime: Optional[Union[str, "_models.WorkloadRuntime"]] = None, vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", - os_sku: Optional[Union[str, "OSSKU"]] = None, + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - scale_down_mode: Optional[Union[str, "ScaleDownMode"]] = None, - type: Optional[Union[str, "AgentPoolType"]] = None, - mode: Optional[Union[str, "AgentPoolMode"]] = None, + scale_down_mode: Optional[Union[str, "_models.ScaleDownMode"]] = None, + type: Optional[Union[str, "_models.AgentPoolType"]] = None, + mode: Optional[Union[str, "_models.AgentPoolMode"]] = None, orchestrator_version: Optional[str] = None, - upgrade_settings: Optional["AgentPoolUpgradeSettings"] = None, - power_state: Optional["PowerState"] = None, + upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, + power_state: Optional["_models.PowerState"] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", spot_max_price: Optional[float] = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, proximity_placement_group_id: Optional[str] = None, - kubelet_config: Optional["KubeletConfig"] = None, - linux_os_config: Optional["LinuxOSConfig"] = None, + kubelet_config: Optional["_models.KubeletConfig"] = None, + linux_os_config: Optional["_models.LinuxOSConfig"] = None, enable_encryption_at_host: Optional[bool] = None, enable_ultra_ssd: Optional[bool] = None, enable_fips: Optional[bool] = None, - gpu_instance_profile: Optional[Union[str, "GPUInstanceProfile"]] = None, - creation_data: Optional["CreationData"] = None, + gpu_instance_profile: Optional[Union[str, "_models.GPUInstanceProfile"]] = None, + creation_data: Optional["_models.CreationData"] = None, **kwargs ): """ @@ -3138,15 +3135,15 @@ def __init__( :keyword os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS - `_. Possible values - include: "Managed", "Ephemeral". + `_. Known values are: + "Managed", "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2022_03_01.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Possible values include: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_03_01.models.KubeletDiskType - :keyword workload_runtime: Determines the type of workload a node can run. Possible values - include: "OCIContainer", "WasmWasi". + :keyword workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer", "WasmWasi". :paramtype workload_runtime: str or ~azure.mgmt.containerservice.v2022_03_01.models.WorkloadRuntime :keyword vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and @@ -3160,11 +3157,11 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_03_01.models.OSType :keyword os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Possible values include: "Ubuntu", "CBLMariner". + Known values are: "Ubuntu", "CBLMariner". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2022_03_01.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -3173,16 +3170,15 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, - it defaults to Delete. Possible values include: "Delete", "Deallocate". + it defaults to Delete. Known values are: "Delete", "Deallocate". :paramtype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_03_01.models.ScaleDownMode - :keyword type: The type of Agent Pool. Possible values include: "VirtualMachineScaleSets", + :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2022_03_01.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Possible values include: "System", - "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2022_03_01.models.AgentPoolMode :keyword orchestrator_version: As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version @@ -3213,12 +3209,12 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Possible values include: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_03_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Possible values include: "Delete", - "Deallocate". Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_03_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which @@ -3250,7 +3246,7 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_03_01.models.GPUInstanceProfile @@ -3335,8 +3331,8 @@ class ManagedClusterAutoUpgradeProfile(msrest.serialization.Model): """Auto upgrade profile for a managed cluster. :ivar upgrade_channel: For more information see `setting the AKS cluster auto-upgrade channel - `_. Possible - values include: "rapid", "stable", "patch", "node-image", "none". + `_. Known values + are: "rapid", "stable", "patch", "node-image", "none". :vartype upgrade_channel: str or ~azure.mgmt.containerservice.v2022_03_01.models.UpgradeChannel """ @@ -3347,13 +3343,13 @@ class ManagedClusterAutoUpgradeProfile(msrest.serialization.Model): def __init__( self, *, - upgrade_channel: Optional[Union[str, "UpgradeChannel"]] = None, + upgrade_channel: Optional[Union[str, "_models.UpgradeChannel"]] = None, **kwargs ): """ :keyword upgrade_channel: For more information see `setting the AKS cluster auto-upgrade channel `_. - Possible values include: "rapid", "stable", "patch", "node-image", "none". + Known values are: "rapid", "stable", "patch", "node-image", "none". :paramtype upgrade_channel: str or ~azure.mgmt.containerservice.v2022_03_01.models.UpgradeChannel """ @@ -3419,7 +3415,7 @@ class ManagedClusterIdentity(msrest.serialization.Model): components. :vartype tenant_id: str :ivar type: For more information see `use managed identities in AKS - `_. Possible values include: + `_. Known values are: "SystemAssigned", "UserAssigned", "None". :vartype type: str or ~azure.mgmt.containerservice.v2022_03_01.models.ResourceIdentityType :ivar user_assigned_identities: The keys must be ARM resource IDs in the form: @@ -3443,13 +3439,13 @@ class ManagedClusterIdentity(msrest.serialization.Model): def __init__( self, *, - type: Optional[Union[str, "ResourceIdentityType"]] = None, - user_assigned_identities: Optional[Dict[str, "ManagedServiceIdentityUserAssignedIdentitiesValue"]] = None, + type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, + user_assigned_identities: Optional[Dict[str, "_models.ManagedServiceIdentityUserAssignedIdentitiesValue"]] = None, **kwargs ): """ :keyword type: For more information see `use managed identities in AKS - `_. Possible values include: + `_. Known values are: "SystemAssigned", "UserAssigned", "None". :paramtype type: str or ~azure.mgmt.containerservice.v2022_03_01.models.ResourceIdentityType :keyword user_assigned_identities: The keys must be ARM resource IDs in the form: @@ -3487,7 +3483,7 @@ class ManagedClusterListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["ManagedCluster"]] = None, + value: Optional[List["_models.ManagedCluster"]] = None, **kwargs ): """ @@ -3545,10 +3541,10 @@ class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): def __init__( self, *, - managed_outbound_i_ps: Optional["ManagedClusterLoadBalancerProfileManagedOutboundIPs"] = None, - outbound_ip_prefixes: Optional["ManagedClusterLoadBalancerProfileOutboundIPPrefixes"] = None, - outbound_i_ps: Optional["ManagedClusterLoadBalancerProfileOutboundIPs"] = None, - effective_outbound_i_ps: Optional[List["ResourceReference"]] = None, + managed_outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileManagedOutboundIPs"] = None, + outbound_ip_prefixes: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPPrefixes"] = None, + outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPs"] = None, + effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, allocated_outbound_ports: Optional[int] = 0, idle_timeout_in_minutes: Optional[int] = 30, enable_multiple_standard_load_balancers: Optional[bool] = None, @@ -3650,7 +3646,7 @@ class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.M def __init__( self, *, - public_ip_prefixes: Optional[List["ResourceReference"]] = None, + public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, **kwargs ): """ @@ -3676,7 +3672,7 @@ class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): def __init__( self, *, - public_i_ps: Optional[List["ResourceReference"]] = None, + public_i_ps: Optional[List["_models.ResourceReference"]] = None, **kwargs ): """ @@ -3746,8 +3742,8 @@ class ManagedClusterNATGatewayProfile(msrest.serialization.Model): def __init__( self, *, - managed_outbound_ip_profile: Optional["ManagedClusterManagedOutboundIPProfile"] = None, - effective_outbound_i_ps: Optional[List["ResourceReference"]] = None, + managed_outbound_ip_profile: Optional["_models.ManagedClusterManagedOutboundIPProfile"] = None, + effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, idle_timeout_in_minutes: Optional[int] = 4, **kwargs ): @@ -3785,8 +3781,8 @@ class ManagedClusterPodIdentity(msrest.serialization.Model): :vartype binding_selector: str :ivar identity: Required. The user assigned identity details. :vartype identity: ~azure.mgmt.containerservice.v2022_03_01.models.UserAssignedIdentity - :ivar provisioning_state: The current provisioning state of the pod identity. Possible values - include: "Assigned", "Updating", "Deleting", "Failed". + :ivar provisioning_state: The current provisioning state of the pod identity. Known values are: + "Assigned", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2022_03_01.models.ManagedClusterPodIdentityProvisioningState :ivar provisioning_info: @@ -3816,7 +3812,7 @@ def __init__( *, name: str, namespace: str, - identity: "UserAssignedIdentity", + identity: "_models.UserAssignedIdentity", binding_selector: Optional[str] = None, **kwargs ): @@ -3917,8 +3913,8 @@ def __init__( *, enabled: Optional[bool] = None, allow_network_plugin_kubenet: Optional[bool] = None, - user_assigned_identities: Optional[List["ManagedClusterPodIdentity"]] = None, - user_assigned_identity_exceptions: Optional[List["ManagedClusterPodIdentityException"]] = None, + user_assigned_identities: Optional[List["_models.ManagedClusterPodIdentity"]] = None, + user_assigned_identity_exceptions: Optional[List["_models.ManagedClusterPodIdentityException"]] = None, **kwargs ): """ @@ -3959,7 +3955,7 @@ class ManagedClusterPodIdentityProvisioningError(msrest.serialization.Model): def __init__( self, *, - error: Optional["ManagedClusterPodIdentityProvisioningErrorBody"] = None, + error: Optional["_models.ManagedClusterPodIdentityProvisioningErrorBody"] = None, **kwargs ): """ @@ -4001,7 +3997,7 @@ def __init__( code: Optional[str] = None, message: Optional[str] = None, target: Optional[str] = None, - details: Optional[List["ManagedClusterPodIdentityProvisioningErrorBody"]] = None, + details: Optional[List["_models.ManagedClusterPodIdentityProvisioningErrorBody"]] = None, **kwargs ): """ @@ -4040,7 +4036,7 @@ class ManagedClusterPodIdentityProvisioningInfo(msrest.serialization.Model): def __init__( self, *, - error: Optional["ManagedClusterPodIdentityProvisioningError"] = None, + error: Optional["_models.ManagedClusterPodIdentityProvisioningError"] = None, **kwargs ): """ @@ -4061,8 +4057,8 @@ class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): :vartype kubernetes_version: str :ivar name: The Agent Pool name. :vartype name: str - :ivar os_type: Required. The operating system type. The default is Linux. Possible values - include: "Linux", "Windows". Default value: "Linux". + :ivar os_type: Required. The operating system type. The default is Linux. Known values are: + "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_03_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -4085,9 +4081,9 @@ def __init__( self, *, kubernetes_version: str, - os_type: Union[str, "OSType"] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", name: Optional[str] = None, - upgrades: Optional[List["ManagedClusterPoolUpgradeProfileUpgradesItem"]] = None, + upgrades: Optional[List["_models.ManagedClusterPoolUpgradeProfileUpgradesItem"]] = None, **kwargs ): """ @@ -4095,8 +4091,8 @@ def __init__( :paramtype kubernetes_version: str :keyword name: The Agent Pool name. :paramtype name: str - :keyword os_type: Required. The operating system type. The default is Linux. Possible values - include: "Linux", "Windows". Default value: "Linux". + :keyword os_type: Required. The operating system type. The default is Linux. Known values are: + "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_03_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: @@ -4148,8 +4144,7 @@ class ManagedClusterPropertiesAutoScalerProfile(msrest.serialization.Model): :vartype balance_similar_node_groups: str :ivar expander: If not specified, the default is 'random'. See `expanders `_ - for more information. Possible values include: "least-waste", "most-pods", "priority", - "random". + for more information. Known values are: "least-waste", "most-pods", "priority", "random". :vartype expander: str or ~azure.mgmt.containerservice.v2022_03_01.models.Expander :ivar max_empty_bulk_delete: The default is 10. :vartype max_empty_bulk_delete: str @@ -4216,7 +4211,7 @@ def __init__( self, *, balance_similar_node_groups: Optional[str] = None, - expander: Optional[Union[str, "Expander"]] = None, + expander: Optional[Union[str, "_models.Expander"]] = None, max_empty_bulk_delete: Optional[str] = None, max_graceful_termination_sec: Optional[str] = None, max_node_provision_time: Optional[str] = None, @@ -4239,8 +4234,7 @@ def __init__( :paramtype balance_similar_node_groups: str :keyword expander: If not specified, the default is 'random'. See `expanders `_ - for more information. Possible values include: "least-waste", "most-pods", "priority", - "random". + for more information. Known values are: "least-waste", "most-pods", "priority", "random". :paramtype expander: str or ~azure.mgmt.containerservice.v2022_03_01.models.Expander :keyword max_empty_bulk_delete: The default is 10. :paramtype max_empty_bulk_delete: str @@ -4318,7 +4312,7 @@ class ManagedClusterSecurityProfile(msrest.serialization.Model): def __init__( self, *, - azure_defender: Optional["ManagedClusterSecurityProfileAzureDefender"] = None, + azure_defender: Optional["_models.ManagedClusterSecurityProfileAzureDefender"] = None, **kwargs ): """ @@ -4407,11 +4401,11 @@ def __init__( class ManagedClusterSKU(msrest.serialization.Model): """The SKU of a Managed Cluster. - :ivar name: The name of a managed cluster SKU. Possible values include: "Basic". + :ivar name: The name of a managed cluster SKU. Known values are: "Basic". :vartype name: str or ~azure.mgmt.containerservice.v2022_03_01.models.ManagedClusterSKUName :ivar tier: If not specified, the default is 'Free'. See `uptime SLA - `_ for more details. Possible values include: - "Paid", "Free". + `_ for more details. Known values are: "Paid", + "Free". :vartype tier: str or ~azure.mgmt.containerservice.v2022_03_01.models.ManagedClusterSKUTier """ @@ -4423,16 +4417,16 @@ class ManagedClusterSKU(msrest.serialization.Model): def __init__( self, *, - name: Optional[Union[str, "ManagedClusterSKUName"]] = None, - tier: Optional[Union[str, "ManagedClusterSKUTier"]] = None, + name: Optional[Union[str, "_models.ManagedClusterSKUName"]] = None, + tier: Optional[Union[str, "_models.ManagedClusterSKUTier"]] = None, **kwargs ): """ - :keyword name: The name of a managed cluster SKU. Possible values include: "Basic". + :keyword name: The name of a managed cluster SKU. Known values are: "Basic". :paramtype name: str or ~azure.mgmt.containerservice.v2022_03_01.models.ManagedClusterSKUName :keyword tier: If not specified, the default is 'Free'. See `uptime SLA - `_ for more details. Possible values include: - "Paid", "Free". + `_ for more details. Known values are: "Paid", + "Free". :paramtype tier: str or ~azure.mgmt.containerservice.v2022_03_01.models.ManagedClusterSKUTier """ super(ManagedClusterSKU, self).__init__(**kwargs) @@ -4463,9 +4457,9 @@ class ManagedClusterStorageProfile(msrest.serialization.Model): def __init__( self, *, - disk_csi_driver: Optional["ManagedClusterStorageProfileDiskCSIDriver"] = None, - file_csi_driver: Optional["ManagedClusterStorageProfileFileCSIDriver"] = None, - snapshot_controller: Optional["ManagedClusterStorageProfileSnapshotController"] = None, + disk_csi_driver: Optional["_models.ManagedClusterStorageProfileDiskCSIDriver"] = None, + file_csi_driver: Optional["_models.ManagedClusterStorageProfileFileCSIDriver"] = None, + snapshot_controller: Optional["_models.ManagedClusterStorageProfileSnapshotController"] = None, **kwargs ): """ @@ -4601,8 +4595,8 @@ class ManagedClusterUpgradeProfile(msrest.serialization.Model): def __init__( self, *, - control_plane_profile: "ManagedClusterPoolUpgradeProfile", - agent_pool_profiles: List["ManagedClusterPoolUpgradeProfile"], + control_plane_profile: "_models.ManagedClusterPoolUpgradeProfile", + agent_pool_profiles: List["_models.ManagedClusterPoolUpgradeProfile"], **kwargs ): """ @@ -4644,8 +4638,8 @@ class ManagedClusterWindowsProfile(msrest.serialization.Model): "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!". :vartype admin_password: str :ivar license_type: The license type to use for Windows VMs. See `Azure Hybrid User Benefits - `_ for more details. Possible values - include: "None", "Windows_Server". + `_ for more details. Known values are: + "None", "Windows_Server". :vartype license_type: str or ~azure.mgmt.containerservice.v2022_03_01.models.LicenseType :ivar enable_csi_proxy: For more details on CSI proxy, see the `CSI proxy GitHub repo `_. @@ -4671,9 +4665,9 @@ def __init__( *, admin_username: str, admin_password: Optional[str] = None, - license_type: Optional[Union[str, "LicenseType"]] = None, + license_type: Optional[Union[str, "_models.LicenseType"]] = None, enable_csi_proxy: Optional[bool] = None, - gmsa_profile: Optional["WindowsGmsaProfile"] = None, + gmsa_profile: Optional["_models.WindowsGmsaProfile"] = None, **kwargs ): """ @@ -4694,8 +4688,8 @@ def __init__( "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!". :paramtype admin_password: str :keyword license_type: The license type to use for Windows VMs. See `Azure Hybrid User Benefits - `_ for more details. Possible values - include: "None", "Windows_Server". + `_ for more details. Known values are: + "None", "Windows_Server". :paramtype license_type: str or ~azure.mgmt.containerservice.v2022_03_01.models.LicenseType :keyword enable_csi_proxy: For more details on CSI proxy, see the `CSI proxy GitHub repo `_. @@ -4857,7 +4851,7 @@ class OSOptionProfile(msrest.serialization.Model): def __init__( self, *, - os_option_property_list: List["OSOptionProperty"], + os_option_property_list: List["_models.OSOptionProperty"], **kwargs ): """ @@ -4930,7 +4924,7 @@ def __init__( self, *, category: Optional[str] = None, - endpoints: Optional[List["EndpointDependency"]] = None, + endpoints: Optional[List["_models.EndpointDependency"]] = None, **kwargs ): """ @@ -4972,7 +4966,7 @@ class OutboundEnvironmentEndpointCollection(msrest.serialization.Model): def __init__( self, *, - value: List["OutboundEnvironmentEndpoint"], + value: List["_models.OutboundEnvironmentEndpoint"], **kwargs ): """ @@ -4988,8 +4982,8 @@ def __init__( class PowerState(msrest.serialization.Model): """Describes the Power State of the cluster. - :ivar code: Tells whether the cluster is Running or Stopped. Possible values include: - "Running", "Stopped". + :ivar code: Tells whether the cluster is Running or Stopped. Known values are: "Running", + "Stopped". :vartype code: str or ~azure.mgmt.containerservice.v2022_03_01.models.Code """ @@ -5000,12 +4994,12 @@ class PowerState(msrest.serialization.Model): def __init__( self, *, - code: Optional[Union[str, "Code"]] = None, + code: Optional[Union[str, "_models.Code"]] = None, **kwargs ): """ - :keyword code: Tells whether the cluster is Running or Stopped. Possible values include: - "Running", "Stopped". + :keyword code: Tells whether the cluster is Running or Stopped. Known values are: "Running", + "Stopped". :paramtype code: str or ~azure.mgmt.containerservice.v2022_03_01.models.Code """ super(PowerState, self).__init__(**kwargs) @@ -5048,7 +5042,7 @@ class PrivateEndpointConnection(msrest.serialization.Model): :vartype name: str :ivar type: The resource type. :vartype type: str - :ivar provisioning_state: The current provisioning state. Possible values include: "Succeeded", + :ivar provisioning_state: The current provisioning state. Known values are: "Succeeded", "Creating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2022_03_01.models.PrivateEndpointConnectionProvisioningState @@ -5079,8 +5073,8 @@ class PrivateEndpointConnection(msrest.serialization.Model): def __init__( self, *, - private_endpoint: Optional["PrivateEndpoint"] = None, - private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, + private_endpoint: Optional["_models.PrivateEndpoint"] = None, + private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionState"] = None, **kwargs ): """ @@ -5114,7 +5108,7 @@ class PrivateEndpointConnectionListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["PrivateEndpointConnection"]] = None, + value: Optional[List["_models.PrivateEndpointConnection"]] = None, **kwargs ): """ @@ -5204,7 +5198,7 @@ class PrivateLinkResourcesListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["PrivateLinkResource"]] = None, + value: Optional[List["_models.PrivateLinkResource"]] = None, **kwargs ): """ @@ -5218,7 +5212,7 @@ def __init__( class PrivateLinkServiceConnectionState(msrest.serialization.Model): """The state of a private link service connection. - :ivar status: The private link service connection status. Possible values include: "Pending", + :ivar status: The private link service connection status. Known values are: "Pending", "Approved", "Rejected", "Disconnected". :vartype status: str or ~azure.mgmt.containerservice.v2022_03_01.models.ConnectionStatus :ivar description: The private link service connection description. @@ -5233,13 +5227,13 @@ class PrivateLinkServiceConnectionState(msrest.serialization.Model): def __init__( self, *, - status: Optional[Union[str, "ConnectionStatus"]] = None, + status: Optional[Union[str, "_models.ConnectionStatus"]] = None, description: Optional[str] = None, **kwargs ): """ - :keyword status: The private link service connection status. Possible values include: - "Pending", "Approved", "Rejected", "Disconnected". + :keyword status: The private link service connection status. Known values are: "Pending", + "Approved", "Rejected", "Disconnected". :paramtype status: str or ~azure.mgmt.containerservice.v2022_03_01.models.ConnectionStatus :keyword description: The private link service connection description. :paramtype description: str @@ -5401,18 +5395,18 @@ class Snapshot(TrackedResource): :ivar creation_data: CreationData to be used to specify the source agent pool resource ID to create this snapshot. :vartype creation_data: ~azure.mgmt.containerservice.v2022_03_01.models.CreationData - :ivar snapshot_type: The type of a snapshot. The default is NodePool. Possible values include: + :ivar snapshot_type: The type of a snapshot. The default is NodePool. Known values are: "NodePool". Default value: "NodePool". :vartype snapshot_type: str or ~azure.mgmt.containerservice.v2022_03_01.models.SnapshotType :ivar kubernetes_version: The version of Kubernetes. :vartype kubernetes_version: str :ivar node_image_version: The version of node image. :vartype node_image_version: str - :ivar os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_03_01.models.OSType - :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Possible values include: "Ubuntu", "CBLMariner". + :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known + values are: "Ubuntu", "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2022_03_01.models.OSSKU :ivar vm_size: The size of the VM. :vartype vm_size: str @@ -5456,8 +5450,8 @@ def __init__( *, location: str, tags: Optional[Dict[str, str]] = None, - creation_data: Optional["CreationData"] = None, - snapshot_type: Optional[Union[str, "SnapshotType"]] = "NodePool", + creation_data: Optional["_models.CreationData"] = None, + snapshot_type: Optional[Union[str, "_models.SnapshotType"]] = "NodePool", **kwargs ): """ @@ -5468,8 +5462,8 @@ def __init__( :keyword creation_data: CreationData to be used to specify the source agent pool resource ID to create this snapshot. :paramtype creation_data: ~azure.mgmt.containerservice.v2022_03_01.models.CreationData - :keyword snapshot_type: The type of a snapshot. The default is NodePool. Possible values - include: "NodePool". Default value: "NodePool". + :keyword snapshot_type: The type of a snapshot. The default is NodePool. Known values are: + "NodePool". Default value: "NodePool". :paramtype snapshot_type: str or ~azure.mgmt.containerservice.v2022_03_01.models.SnapshotType """ super(Snapshot, self).__init__(tags=tags, location=location, **kwargs) @@ -5506,7 +5500,7 @@ class SnapshotListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["Snapshot"]] = None, + value: Optional[List["_models.Snapshot"]] = None, **kwargs ): """ @@ -5737,15 +5731,15 @@ class SystemData(msrest.serialization.Model): :ivar created_by: The identity that created the resource. :vartype created_by: str - :ivar created_by_type: The type of identity that created the resource. Possible values include: + :ivar created_by_type: The type of identity that created the resource. Known values are: "User", "Application", "ManagedIdentity", "Key". :vartype created_by_type: str or ~azure.mgmt.containerservice.v2022_03_01.models.CreatedByType :ivar created_at: The timestamp of resource creation (UTC). :vartype created_at: ~datetime.datetime :ivar last_modified_by: The identity that last modified the resource. :vartype last_modified_by: str - :ivar last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". + :ivar last_modified_by_type: The type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", "Key". :vartype last_modified_by_type: str or ~azure.mgmt.containerservice.v2022_03_01.models.CreatedByType :ivar last_modified_at: The timestamp of resource last modification (UTC). @@ -5765,26 +5759,26 @@ def __init__( self, *, created_by: Optional[str] = None, - created_by_type: Optional[Union[str, "CreatedByType"]] = None, + created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, created_at: Optional[datetime.datetime] = None, last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[Union[str, "CreatedByType"]] = None, + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, last_modified_at: Optional[datetime.datetime] = None, **kwargs ): """ :keyword created_by: The identity that created the resource. :paramtype created_by: str - :keyword created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". + :keyword created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", "Key". :paramtype created_by_type: str or ~azure.mgmt.containerservice.v2022_03_01.models.CreatedByType :keyword created_at: The timestamp of resource creation (UTC). :paramtype created_at: ~datetime.datetime :keyword last_modified_by: The identity that last modified the resource. :paramtype last_modified_by: str - :keyword last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". + :keyword last_modified_by_type: The type of identity that last modified the resource. Known + values are: "User", "Application", "ManagedIdentity", "Key". :paramtype last_modified_by_type: str or ~azure.mgmt.containerservice.v2022_03_01.models.CreatedByType :keyword last_modified_at: The timestamp of resource last modification (UTC). @@ -5827,8 +5821,8 @@ def __init__( class TimeInWeek(msrest.serialization.Model): """Time in a week. - :ivar day: The day of the week. Possible values include: "Sunday", "Monday", "Tuesday", - "Wednesday", "Thursday", "Friday", "Saturday". + :ivar day: The day of the week. Known values are: "Sunday", "Monday", "Tuesday", "Wednesday", + "Thursday", "Friday", "Saturday". :vartype day: str or ~azure.mgmt.containerservice.v2022_03_01.models.WeekDay :ivar hour_slots: Each integer hour represents a time range beginning at 0m after the hour ending at the next hour (non-inclusive). 0 corresponds to 00:00 UTC, 23 corresponds to 23:00 @@ -5844,12 +5838,12 @@ class TimeInWeek(msrest.serialization.Model): def __init__( self, *, - day: Optional[Union[str, "WeekDay"]] = None, + day: Optional[Union[str, "_models.WeekDay"]] = None, hour_slots: Optional[List[int]] = None, **kwargs ): """ - :keyword day: The day of the week. Possible values include: "Sunday", "Monday", "Tuesday", + :keyword day: The day of the week. Known values are: "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday". :paramtype day: str or ~azure.mgmt.containerservice.v2022_03_01.models.WeekDay :keyword hour_slots: Each integer hour represents a time range beginning at 0m after the hour diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/models/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/models/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/operations/__init__.py index 5e1e5e72fa59..e0748876288c 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/operations/__init__.py @@ -15,6 +15,9 @@ from ._resolve_private_link_service_id_operations import ResolvePrivateLinkServiceIdOperations from ._snapshots_operations import SnapshotsOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'Operations', 'ManagedClustersOperations', @@ -25,3 +28,5 @@ 'ResolvePrivateLinkServiceIdOperations', 'SnapshotsOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/operations/_agent_pools_operations.py index 77fec60f6261..69d398d70921 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/operations/_agent_pools_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -35,9 +35,12 @@ def build_list_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools") # pylint: disable=line-too-long path_format_arguments = { @@ -49,18 +52,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -72,9 +73,12 @@ def build_get_request( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -87,18 +91,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -109,14 +111,17 @@ def build_create_or_update_request_initial( resource_name: str, agent_pool_name: str, *, - json: JSONType = None, + json: Optional[_models.AgentPool] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -129,20 +134,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -156,9 +159,12 @@ def build_delete_request_initial( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -171,18 +177,16 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -194,9 +198,12 @@ def build_get_upgrade_profile_request( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default") # pylint: disable=line-too-long path_format_arguments = { @@ -209,18 +216,16 @@ def build_get_upgrade_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -231,9 +236,12 @@ def build_get_available_agent_pool_versions_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions") # pylint: disable=line-too-long path_format_arguments = { @@ -245,18 +253,16 @@ def build_get_available_agent_pool_versions_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -268,9 +274,12 @@ def build_upgrade_node_image_version_request_initial( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion") # pylint: disable=line-too-long path_format_arguments = { @@ -283,42 +292,38 @@ def build_upgrade_node_image_version_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class AgentPoolsOperations(object): - """AgentPoolsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class AgentPoolsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_03_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_03_01.ContainerServiceClient`'s + :attr:`agent_pools` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -326,7 +331,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Iterable["_models.AgentPoolListResult"]: + ) -> Iterable[_models.AgentPoolListResult]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. @@ -341,13 +346,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_03_01.models.AgentPoolListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -357,9 +365,11 @@ def prepare_request(next_link=None): resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -369,9 +379,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -411,7 +423,7 @@ def get( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPool": + ) -> _models.AgentPool: """Gets the specified managed cluster agent pool. Gets the specified managed cluster agent pool. @@ -427,13 +439,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.AgentPool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] request = build_get_request( @@ -443,11 +458,13 @@ def get( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -473,17 +490,20 @@ def _create_or_update_initial( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> "_models.AgentPool": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] + ) -> _models.AgentPool: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] _json = self._serialize.body(parameters, 'AgentPool') @@ -496,11 +516,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -531,9 +553,9 @@ def begin_create_or_update( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> LROPoller["_models.AgentPool"]: + ) -> LROPoller[_models.AgentPool]: """Creates or updates an agent pool in the specified managed cluster. Creates or updates an agent pool in the specified managed cluster. @@ -559,17 +581,20 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_03_01.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, @@ -577,20 +602,27 @@ def begin_create_or_update( 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): - response = pipeline_response.http_response deserialized = self._deserialize('AgentPool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -610,13 +642,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements agent_pool_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -626,11 +661,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -677,21 +714,26 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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) @@ -701,8 +743,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -722,7 +770,7 @@ def get_upgrade_profile( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPoolUpgradeProfile": + ) -> _models.AgentPoolUpgradeProfile: """Gets the upgrade profile for an agent pool. Gets the upgrade profile for an agent pool. @@ -738,13 +786,16 @@ def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.AgentPoolUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] request = build_get_upgrade_profile_request( @@ -754,11 +805,13 @@ def get_upgrade_profile( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -785,7 +838,7 @@ def get_available_agent_pool_versions( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.AgentPoolAvailableVersions": + ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported Kubernetes versions for the specified agent pool. See `supported Kubernetes versions @@ -801,13 +854,16 @@ def get_available_agent_pool_versions( :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.AgentPoolAvailableVersions :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolAvailableVersions"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] request = build_get_available_agent_pool_versions_request( @@ -816,11 +872,13 @@ def get_available_agent_pool_versions( resource_name=resource_name, api_version=api_version, template_url=self.get_available_agent_pool_versions.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -847,14 +905,17 @@ def _upgrade_node_image_version_initial( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> Optional["_models.AgentPool"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.AgentPool"]] + ) -> Optional[_models.AgentPool]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] request = build_upgrade_node_image_version_request_initial( @@ -864,11 +925,13 @@ def _upgrade_node_image_version_initial( agent_pool_name=agent_pool_name, api_version=api_version, template_url=self._upgrade_node_image_version_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -901,7 +964,7 @@ def begin_upgrade_node_image_version( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> LROPoller["_models.AgentPool"]: + ) -> LROPoller[_models.AgentPool]: """Upgrades the node image version of an agent pool to the latest. Upgrading the node image version of an agent pool applies the newest OS and runtime updates to @@ -927,21 +990,26 @@ def begin_upgrade_node_image_version( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_03_01.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._upgrade_node_image_version_initial( + raw_result = self._upgrade_node_image_version_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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) @@ -957,8 +1025,14 @@ def get_long_running_output(pipeline_response): return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/operations/_maintenance_configurations_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/operations/_maintenance_configurations_operations.py index 115f2099e1c1..4d604f8db9f6 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/operations/_maintenance_configurations_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/operations/_maintenance_configurations_operations.py @@ -16,12 +16,12 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -33,9 +33,12 @@ def build_list_by_managed_cluster_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations") # pylint: disable=line-too-long path_format_arguments = { @@ -47,18 +50,16 @@ def build_list_by_managed_cluster_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -70,9 +71,12 @@ def build_get_request( config_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long path_format_arguments = { @@ -85,18 +89,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -107,14 +109,17 @@ def build_create_or_update_request( resource_name: str, config_name: str, *, - json: JSONType = None, + json: Optional[_models.MaintenanceConfiguration] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long path_format_arguments = { @@ -127,20 +132,18 @@ def build_create_or_update_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -154,9 +157,12 @@ def build_delete_request( config_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long path_format_arguments = { @@ -169,42 +175,38 @@ def build_delete_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class MaintenanceConfigurationsOperations(object): - """MaintenanceConfigurationsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class MaintenanceConfigurationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_03_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_03_01.ContainerServiceClient`'s + :attr:`maintenance_configurations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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_by_managed_cluster( @@ -212,7 +214,7 @@ def list_by_managed_cluster( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Iterable["_models.MaintenanceConfigurationListResult"]: + ) -> Iterable[_models.MaintenanceConfigurationListResult]: """Gets a list of maintenance configurations in the specified managed cluster. Gets a list of maintenance configurations in the specified managed cluster. @@ -228,13 +230,16 @@ def list_by_managed_cluster( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_03_01.models.MaintenanceConfigurationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfigurationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfigurationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -244,9 +249,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=self.list_by_managed_cluster.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -256,9 +263,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -298,7 +307,7 @@ def get( resource_name: str, config_name: str, **kwargs: Any - ) -> "_models.MaintenanceConfiguration": + ) -> _models.MaintenanceConfiguration: """Gets the specified maintenance configuration of a managed cluster. Gets the specified maintenance configuration of a managed cluster. @@ -314,13 +323,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.MaintenanceConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfiguration"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] request = build_get_request( @@ -330,11 +342,13 @@ def get( config_name=config_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -361,9 +375,9 @@ def create_or_update( resource_group_name: str, resource_name: str, config_name: str, - parameters: "_models.MaintenanceConfiguration", + parameters: _models.MaintenanceConfiguration, **kwargs: Any - ) -> "_models.MaintenanceConfiguration": + ) -> _models.MaintenanceConfiguration: """Creates or updates a maintenance configuration in the specified managed cluster. Creates or updates a maintenance configuration in the specified managed cluster. @@ -381,14 +395,17 @@ def create_or_update( :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.MaintenanceConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfiguration"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] _json = self._serialize.body(parameters, 'MaintenanceConfiguration') @@ -401,11 +418,13 @@ def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -449,13 +468,16 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -465,11 +487,13 @@ def delete( # pylint: disable=inconsistent-return-statements config_name=config_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/operations/_managed_clusters_operations.py index 639db9871f92..0e5e0f665f15 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/operations/_managed_clusters_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -36,9 +36,12 @@ def build_get_os_options_request( resource_type: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default") # pylint: disable=line-too-long path_format_arguments = { @@ -49,20 +52,18 @@ def build_get_os_options_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if resource_type is not None: - _query_parameters['resource-type'] = _SERIALIZER.query("resource_type", resource_type, 'str') + _params['resource-type'] = _SERIALIZER.query("resource_type", resource_type, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -71,9 +72,12 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters") path_format_arguments = { @@ -83,18 +87,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -104,9 +106,12 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters") # pylint: disable=line-too-long path_format_arguments = { @@ -117,18 +122,16 @@ def build_list_by_resource_group_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -139,9 +142,12 @@ def build_get_upgrade_profile_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default") # pylint: disable=line-too-long path_format_arguments = { @@ -153,18 +159,16 @@ def build_get_upgrade_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -176,9 +180,12 @@ def build_get_access_profile_request( role_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -191,18 +198,16 @@ def build_get_access_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -215,9 +220,12 @@ def build_list_cluster_admin_credentials_request( server_fqdn: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -229,20 +237,18 @@ def build_list_cluster_admin_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if server_fqdn is not None: - _query_parameters['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -256,9 +262,12 @@ def build_list_cluster_user_credentials_request( format: Optional[Union[str, "_models.Format"]] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -270,22 +279,20 @@ def build_list_cluster_user_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if server_fqdn is not None: - _query_parameters['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') if format is not None: - _query_parameters['format'] = _SERIALIZER.query("format", format, 'str') + _params['format'] = _SERIALIZER.query("format", format, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -298,9 +305,12 @@ def build_list_cluster_monitoring_user_credentials_request( server_fqdn: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -312,20 +322,18 @@ def build_list_cluster_monitoring_user_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if server_fqdn is not None: - _query_parameters['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -336,9 +344,12 @@ def build_get_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -350,18 +361,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -371,14 +380,17 @@ def build_create_or_update_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedCluster] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -390,20 +402,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -415,14 +425,17 @@ def build_update_tags_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.TagsObject] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -434,20 +447,18 @@ def build_update_tags_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -460,9 +471,12 @@ def build_delete_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -474,18 +488,16 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -495,14 +507,17 @@ def build_reset_service_principal_profile_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedClusterServicePrincipalProfile] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile") # pylint: disable=line-too-long path_format_arguments = { @@ -514,20 +529,18 @@ def build_reset_service_principal_profile_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -539,14 +552,17 @@ def build_reset_aad_profile_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedClusterAADProfile] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile") # pylint: disable=line-too-long path_format_arguments = { @@ -558,20 +574,18 @@ def build_reset_aad_profile_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -584,9 +598,12 @@ def build_rotate_cluster_certificates_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates") # pylint: disable=line-too-long path_format_arguments = { @@ -598,18 +615,16 @@ def build_rotate_cluster_certificates_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -620,9 +635,12 @@ def build_stop_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop") # pylint: disable=line-too-long path_format_arguments = { @@ -634,18 +652,16 @@ def build_stop_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -656,9 +672,12 @@ def build_start_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start") # pylint: disable=line-too-long path_format_arguments = { @@ -670,18 +689,16 @@ def build_start_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -691,14 +708,17 @@ def build_run_command_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.RunCommandRequest] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand") # pylint: disable=line-too-long path_format_arguments = { @@ -710,20 +730,18 @@ def build_run_command_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -737,9 +755,12 @@ def build_get_command_result_request( command_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}") # pylint: disable=line-too-long path_format_arguments = { @@ -752,18 +773,16 @@ def build_get_command_result_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -774,9 +793,12 @@ def build_list_outbound_network_dependencies_endpoints_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints") # pylint: disable=line-too-long path_format_arguments = { @@ -788,42 +810,38 @@ def build_list_outbound_network_dependencies_endpoints_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class ManagedClustersOperations(object): # pylint: disable=too-many-public-methods - """ManagedClustersOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ManagedClustersOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_03_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_03_01.ContainerServiceClient`'s + :attr:`managed_clusters` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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_os_options( @@ -831,7 +849,7 @@ def get_os_options( location: str, resource_type: Optional[str] = None, **kwargs: Any - ) -> "_models.OSOptionProfile": + ) -> _models.OSOptionProfile: """Gets supported OS options in the specified subscription. Gets supported OS options in the specified subscription. @@ -846,13 +864,16 @@ def get_os_options( :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.OSOptionProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OSOptionProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OSOptionProfile] request = build_get_os_options_request( @@ -861,11 +882,13 @@ def get_os_options( api_version=api_version, resource_type=resource_type, template_url=self.get_os_options.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -890,7 +913,7 @@ def get_os_options( def list( self, **kwargs: Any - ) -> Iterable["_models.ManagedClusterListResult"]: + ) -> Iterable[_models.ManagedClusterListResult]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. @@ -902,13 +925,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_03_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -916,9 +942,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -926,9 +954,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -966,7 +996,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.ManagedClusterListResult"]: + ) -> Iterable[_models.ManagedClusterListResult]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. @@ -980,13 +1010,16 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_03_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -995,9 +1028,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -1006,9 +1041,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -1047,7 +1084,7 @@ def get_upgrade_profile( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedClusterUpgradeProfile": + ) -> _models.ManagedClusterUpgradeProfile: """Gets the upgrade profile of a managed cluster. Gets the upgrade profile of a managed cluster. @@ -1061,13 +1098,16 @@ def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.ManagedClusterUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] request = build_get_upgrade_profile_request( @@ -1076,11 +1116,13 @@ def get_upgrade_profile( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1108,7 +1150,7 @@ def get_access_profile( resource_name: str, role_name: str, **kwargs: Any - ) -> "_models.ManagedClusterAccessProfile": + ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. **WARNING**\ : This API will be deprecated. Instead use `ListClusterUserCredentials @@ -1127,13 +1169,16 @@ def get_access_profile( :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.ManagedClusterAccessProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterAccessProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] request = build_get_access_profile_request( @@ -1143,11 +1188,13 @@ def get_access_profile( role_name=role_name, api_version=api_version, template_url=self.get_access_profile.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1175,7 +1222,7 @@ def list_cluster_admin_credentials( resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Lists the admin credentials of a managed cluster. Lists the admin credentials of a managed cluster. @@ -1191,13 +1238,16 @@ def list_cluster_admin_credentials( :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_admin_credentials_request( @@ -1207,11 +1257,13 @@ def list_cluster_admin_credentials( api_version=api_version, server_fqdn=server_fqdn, template_url=self.list_cluster_admin_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1240,7 +1292,7 @@ def list_cluster_user_credentials( server_fqdn: Optional[str] = None, format: Optional[Union[str, "_models.Format"]] = None, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Lists the user credentials of a managed cluster. Lists the user credentials of a managed cluster. @@ -1260,13 +1312,16 @@ def list_cluster_user_credentials( :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_user_credentials_request( @@ -1277,11 +1332,13 @@ def list_cluster_user_credentials( server_fqdn=server_fqdn, format=format, template_url=self.list_cluster_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1309,7 +1366,7 @@ def list_cluster_monitoring_user_credentials( resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Lists the cluster monitoring user credentials of a managed cluster. Lists the cluster monitoring user credentials of a managed cluster. @@ -1325,13 +1382,16 @@ def list_cluster_monitoring_user_credentials( :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_monitoring_user_credentials_request( @@ -1341,11 +1401,13 @@ def list_cluster_monitoring_user_credentials( api_version=api_version, server_fqdn=server_fqdn, template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1372,7 +1434,7 @@ def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedCluster": + ) -> _models.ManagedCluster: """Gets a managed cluster. Gets a managed cluster. @@ -1386,13 +1448,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.ManagedCluster :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] request = build_get_request( @@ -1401,11 +1466,13 @@ def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1430,17 +1497,20 @@ def _create_or_update_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'ManagedCluster') @@ -1452,11 +1522,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1486,9 +1558,9 @@ def begin_create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> LROPoller["_models.ManagedCluster"]: + ) -> LROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. Creates or updates a managed cluster. @@ -1513,37 +1585,47 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_03_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1560,17 +1642,20 @@ def _update_tags_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'TagsObject') @@ -1582,11 +1667,13 @@ def _update_tags_initial( content_type=content_type, json=_json, template_url=self._update_tags_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1612,9 +1699,9 @@ def begin_update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> LROPoller["_models.ManagedCluster"]: + ) -> LROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates tags on a managed cluster. @@ -1639,37 +1726,47 @@ def begin_update_tags( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_03_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._update_tags_initial( + raw_result = self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1688,13 +1785,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -1703,11 +1803,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1751,20 +1853,25 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_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) @@ -1774,8 +1881,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1792,17 +1905,20 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') @@ -1814,11 +1930,13 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re content_type=content_type, json=_json, template_url=self._reset_service_principal_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1840,7 +1958,7 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> LROPoller[None]: """Reset the Service Principal Profile of a managed cluster. @@ -1866,23 +1984,28 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._reset_service_principal_profile_initial( + raw_result = self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1892,8 +2015,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1910,17 +2039,20 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') @@ -1932,11 +2064,13 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement content_type=content_type, json=_json, template_url=self._reset_aad_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1958,7 +2092,7 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> LROPoller[None]: """Reset the AAD Profile of a managed cluster. @@ -1983,23 +2117,28 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._reset_aad_profile_initial( + raw_result = self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -2009,8 +2148,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2029,13 +2174,16 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_rotate_cluster_certificates_request_initial( @@ -2044,11 +2192,13 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return resource_name=resource_name, api_version=api_version, template_url=self._rotate_cluster_certificates_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2093,20 +2243,25 @@ def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-st :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._rotate_cluster_certificates_initial( + raw_result = self._rotate_cluster_certificates_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) @@ -2116,8 +2271,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2136,13 +2297,16 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_stop_request_initial( @@ -2151,11 +2315,13 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_name, api_version=api_version, template_url=self._stop_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2203,20 +2369,25 @@ def begin_stop( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._stop_initial( + raw_result = self._stop_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) @@ -2226,8 +2397,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2246,13 +2423,16 @@ def _start_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_start_request_initial( @@ -2261,11 +2441,13 @@ def _start_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_name, api_version=api_version, template_url=self._start_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2310,20 +2492,25 @@ def begin_start( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._start_initial( + raw_result = self._start_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) @@ -2333,8 +2520,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2351,17 +2544,20 @@ def _run_command_initial( self, resource_group_name: str, resource_name: str, - request_payload: "_models.RunCommandRequest", + request_payload: _models.RunCommandRequest, **kwargs: Any - ) -> Optional["_models.RunCommandResult"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RunCommandResult"]] + ) -> Optional[_models.RunCommandResult]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] _json = self._serialize.body(request_payload, 'RunCommandRequest') @@ -2373,11 +2569,13 @@ def _run_command_initial( content_type=content_type, json=_json, template_url=self._run_command_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2405,9 +2603,9 @@ def begin_run_command( self, resource_group_name: str, resource_name: str, - request_payload: "_models.RunCommandRequest", + request_payload: _models.RunCommandRequest, **kwargs: Any - ) -> LROPoller["_models.RunCommandResult"]: + ) -> LROPoller[_models.RunCommandResult]: """Submits a command to run against the Managed Cluster. AKS will create a pod to run the command. This is primarily useful for private clusters. For @@ -2434,37 +2632,47 @@ def begin_run_command( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_03_01.models.RunCommandResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.RunCommandResult] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._run_command_initial( + raw_result = self._run_command_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, request_payload=request_payload, 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): - response = pipeline_response.http_response deserialized = self._deserialize('RunCommandResult', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2484,7 +2692,7 @@ def get_command_result( resource_name: str, command_id: str, **kwargs: Any - ) -> Optional["_models.RunCommandResult"]: + ) -> Optional[_models.RunCommandResult]: """Gets the results of a command which has been run on the Managed Cluster. Gets the results of a command which has been run on the Managed Cluster. @@ -2500,13 +2708,16 @@ def get_command_result( :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.RunCommandResult or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RunCommandResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] request = build_get_command_result_request( @@ -2516,11 +2727,13 @@ def get_command_result( command_id=command_id, api_version=api_version, template_url=self.get_command_result.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2549,7 +2762,7 @@ def list_outbound_network_dependencies_endpoints( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Iterable["_models.OutboundEnvironmentEndpointCollection"]: + ) -> Iterable[_models.OutboundEnvironmentEndpointCollection]: """Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. @@ -2567,13 +2780,16 @@ def list_outbound_network_dependencies_endpoints( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_03_01.models.OutboundEnvironmentEndpointCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OutboundEnvironmentEndpointCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -2583,9 +2799,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=self.list_outbound_network_dependencies_endpoints.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -2595,9 +2813,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/operations/_operations.py index 92976ca59343..e8ef73ce612f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/operations/_operations.py @@ -16,6 +16,7 @@ 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 @@ -29,55 +30,54 @@ def build_list_request( **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.ContainerService/operations") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class Operations(object): - """Operations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_03_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_03_01.ContainerServiceClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> Iterable["_models.OperationListResult"]: + ) -> Iterable[_models.OperationListResult]: """Gets a list of operations. Gets a list of operations. @@ -88,31 +88,38 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_03_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/operations/_private_endpoint_connections_operations.py index 224393ed5d6f..d3949ddb21f0 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/operations/_private_endpoint_connections_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast from msrest import Serializer @@ -16,13 +16,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -34,9 +34,12 @@ def build_list_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections") # pylint: disable=line-too-long path_format_arguments = { @@ -48,18 +51,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -71,9 +72,12 @@ def build_get_request( private_endpoint_connection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -86,18 +90,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -108,14 +110,17 @@ def build_update_request( resource_name: str, private_endpoint_connection_name: str, *, - json: JSONType = None, + json: Optional[_models.PrivateEndpointConnection] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -128,20 +133,18 @@ def build_update_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -155,9 +158,12 @@ def build_delete_request_initial( private_endpoint_connection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -170,42 +176,38 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class PrivateEndpointConnectionsOperations(object): - """PrivateEndpointConnectionsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class PrivateEndpointConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_03_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_03_01.ContainerServiceClient`'s + :attr:`private_endpoint_connections` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -213,7 +215,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnectionListResult": + ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. To learn more about private clusters, see: @@ -228,13 +230,16 @@ def list( :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.PrivateEndpointConnectionListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] request = build_list_request( @@ -243,11 +248,13 @@ def list( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -275,7 +282,7 @@ def get( resource_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Gets the specified private endpoint connection. To learn more about private clusters, see: @@ -292,13 +299,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] request = build_get_request( @@ -308,11 +318,13 @@ def get( private_endpoint_connection_name=private_endpoint_connection_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -339,9 +351,9 @@ def update( resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - parameters: "_models.PrivateEndpointConnection", + parameters: _models.PrivateEndpointConnection, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. Updates a private endpoint connection. @@ -359,14 +371,17 @@ def update( :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] _json = self._serialize.body(parameters, 'PrivateEndpointConnection') @@ -379,11 +394,13 @@ def update( content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -411,13 +428,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -427,11 +447,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name=private_endpoint_connection_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -478,21 +500,26 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -502,8 +529,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/operations/_private_link_resources_operations.py index e41dae3f88e9..ceac57a34b42 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/operations/_private_link_resources_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/operations/_private_link_resources_operations.py @@ -15,6 +15,7 @@ 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 @@ -31,9 +32,12 @@ def build_list_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources") # pylint: disable=line-too-long path_format_arguments = { @@ -45,42 +49,38 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class PrivateLinkResourcesOperations(object): - """PrivateLinkResourcesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class PrivateLinkResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_03_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_03_01.ContainerServiceClient`'s + :attr:`private_link_resources` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -88,7 +88,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.PrivateLinkResourcesListResult": + ) -> _models.PrivateLinkResourcesListResult: """Gets a list of private link resources in the specified managed cluster. To learn more about private clusters, see: @@ -103,13 +103,16 @@ def list( :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.PrivateLinkResourcesListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourcesListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] request = build_list_request( @@ -118,11 +121,13 @@ def list( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/operations/_resolve_private_link_service_id_operations.py index 8289504c6e49..6b6e6fa5f110 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/operations/_resolve_private_link_service_id_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/operations/_resolve_private_link_service_id_operations.py @@ -15,12 +15,12 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -31,14 +31,17 @@ def build_post_request( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.PrivateLinkResource] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId") # pylint: disable=line-too-long path_format_arguments = { @@ -50,55 +53,51 @@ def build_post_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs ) -class ResolvePrivateLinkServiceIdOperations(object): - """ResolvePrivateLinkServiceIdOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ResolvePrivateLinkServiceIdOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_03_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_03_01.ContainerServiceClient`'s + :attr:`resolve_private_link_service_id` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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 post( self, resource_group_name: str, resource_name: str, - parameters: "_models.PrivateLinkResource", + parameters: _models.PrivateLinkResource, **kwargs: Any - ) -> "_models.PrivateLinkResource": + ) -> _models.PrivateLinkResource: """Gets the private link service ID for the specified managed cluster. Gets the private link service ID for the specified managed cluster. @@ -114,14 +113,17 @@ def post( :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.PrivateLinkResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] _json = self._serialize.body(parameters, 'PrivateLinkResource') @@ -133,11 +135,13 @@ def post( content_type=content_type, json=_json, template_url=self.post.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/operations/_snapshots_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/operations/_snapshots_operations.py index 12949951896e..557a335d3fc4 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/operations/_snapshots_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_01/operations/_snapshots_operations.py @@ -16,12 +16,12 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -31,9 +31,12 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots") path_format_arguments = { @@ -43,18 +46,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -64,9 +65,12 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots") # pylint: disable=line-too-long path_format_arguments = { @@ -77,18 +81,16 @@ def build_list_by_resource_group_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -99,9 +101,12 @@ def build_get_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -113,18 +118,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -134,14 +137,17 @@ def build_create_or_update_request( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.Snapshot] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -153,20 +159,18 @@ def build_create_or_update_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -178,14 +182,17 @@ def build_update_tags_request( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.TagsObject] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -197,20 +204,18 @@ def build_update_tags_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -223,9 +228,12 @@ def build_delete_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -237,48 +245,44 @@ def build_delete_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class SnapshotsOperations(object): - """SnapshotsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class SnapshotsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_03_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_03_01.ContainerServiceClient`'s + :attr:`snapshots` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> Iterable["_models.SnapshotListResult"]: + ) -> Iterable[_models.SnapshotListResult]: """Gets a list of snapshots in the specified subscription. Gets a list of snapshots in the specified subscription. @@ -289,13 +293,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_03_01.models.SnapshotListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -303,9 +310,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -313,9 +322,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -353,7 +364,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.SnapshotListResult"]: + ) -> Iterable[_models.SnapshotListResult]: """Lists snapshots in the specified subscription and resource group. Lists snapshots in the specified subscription and resource group. @@ -366,13 +377,16 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_03_01.models.SnapshotListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -381,9 +395,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -392,9 +408,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -433,7 +451,7 @@ def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.Snapshot": + ) -> _models.Snapshot: """Gets a snapshot. Gets a snapshot. @@ -447,13 +465,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.Snapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] request = build_get_request( @@ -462,11 +483,13 @@ def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -492,9 +515,9 @@ def create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.Snapshot", + parameters: _models.Snapshot, **kwargs: Any - ) -> "_models.Snapshot": + ) -> _models.Snapshot: """Creates or updates a snapshot. Creates or updates a snapshot. @@ -510,14 +533,17 @@ def create_or_update( :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.Snapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] _json = self._serialize.body(parameters, 'Snapshot') @@ -529,11 +555,13 @@ def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -563,9 +591,9 @@ def update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.Snapshot": + ) -> _models.Snapshot: """Updates tags on a snapshot. Updates tags on a snapshot. @@ -581,14 +609,17 @@ def update_tags( :rtype: ~azure.mgmt.containerservice.v2022_03_01.models.Snapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] _json = self._serialize.body(parameters, 'TagsObject') @@ -600,11 +631,13 @@ def update_tags( content_type=content_type, json=_json, template_url=self.update_tags.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -645,13 +678,16 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -660,11 +696,13 @@ def delete( # pylint: disable=inconsistent-return-statements resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/__init__.py index 53c675bd95e2..37a5f9e02e6f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._container_service_client import ContainerServiceClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['ContainerServiceClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/_container_service_client.py index a624368a3757..a1f62cb0b98f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/_container_service_client.py @@ -78,15 +78,33 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.managed_clusters = ManagedClustersOperations(self._client, self._config, self._serialize, self._deserialize) - self.maintenance_configurations = MaintenanceConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) - self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) - self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations(self._client, self._config, self._serialize, self._deserialize) - self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) - self.managed_cluster_snapshots = ManagedClusterSnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_clusters = ManagedClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.maintenance_configurations = MaintenanceConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.agent_pools = AgentPoolsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.snapshots = SnapshotsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_cluster_snapshots = ManagedClusterSnapshotsOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/__init__.py index 53c675bd95e2..37a5f9e02e6f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._container_service_client import ContainerServiceClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['ContainerServiceClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/_container_service_client.py index fc0df1ed8767..5dd5814523b8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/_container_service_client.py @@ -78,15 +78,33 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.managed_clusters = ManagedClustersOperations(self._client, self._config, self._serialize, self._deserialize) - self.maintenance_configurations = MaintenanceConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) - self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) - self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations(self._client, self._config, self._serialize, self._deserialize) - self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) - self.managed_cluster_snapshots = ManagedClusterSnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_clusters = ManagedClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.maintenance_configurations = MaintenanceConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.agent_pools = AgentPoolsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.snapshots = SnapshotsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_cluster_snapshots = ManagedClusterSnapshotsOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/operations/__init__.py index 78e2791463ed..d3b41c8a72b0 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/operations/__init__.py @@ -16,6 +16,9 @@ from ._snapshots_operations import SnapshotsOperations from ._managed_cluster_snapshots_operations import ManagedClusterSnapshotsOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'Operations', 'ManagedClustersOperations', @@ -27,3 +30,5 @@ 'SnapshotsOperations', 'ManagedClusterSnapshotsOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/operations/_agent_pools_operations.py index ba7eb4ea286f..c502cd3cd65c 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/operations/_agent_pools_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. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ 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 @@ -26,26 +27,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class AgentPoolsOperations: - """AgentPoolsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_03_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_03_02_preview.aio.ContainerServiceClient`'s + :attr:`agent_pools` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -53,7 +52,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> AsyncIterable["_models.AgentPoolListResult"]: + ) -> AsyncIterable[_models.AgentPoolListResult]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. @@ -68,13 +67,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_03_02_preview.models.AgentPoolListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -84,9 +86,11 @@ def prepare_request(next_link=None): resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -96,9 +100,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -138,7 +144,7 @@ async def get( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPool": + ) -> _models.AgentPool: """Gets the specified managed cluster agent pool. Gets the specified managed cluster agent pool. @@ -154,13 +160,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.AgentPool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] request = build_get_request( @@ -170,11 +179,13 @@ async def get( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -200,17 +211,20 @@ async def _create_or_update_initial( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> "_models.AgentPool": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] + ) -> _models.AgentPool: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-03-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] _json = self._serialize.body(parameters, 'AgentPool') @@ -223,11 +237,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -258,9 +274,9 @@ async def begin_create_or_update( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> AsyncLROPoller["_models.AgentPool"]: + ) -> AsyncLROPoller[_models.AgentPool]: """Creates or updates an agent pool in the specified managed cluster. Creates or updates an agent pool in the specified managed cluster. @@ -287,17 +303,20 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_03_02_preview.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, @@ -305,20 +324,27 @@ async def begin_create_or_update( 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): - response = pipeline_response.http_response deserialized = self._deserialize('AgentPool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -339,13 +365,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements ignore_pod_disruption_budget: Optional[bool] = None, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -356,11 +385,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements api_version=api_version, ignore_pod_disruption_budget=ignore_pod_disruption_budget, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -411,22 +442,27 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, ignore_pod_disruption_budget=ignore_pod_disruption_budget, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -436,8 +472,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -457,7 +499,7 @@ async def get_upgrade_profile( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPoolUpgradeProfile": + ) -> _models.AgentPoolUpgradeProfile: """Gets the upgrade profile for an agent pool. Gets the upgrade profile for an agent pool. @@ -473,13 +515,16 @@ async def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.AgentPoolUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] request = build_get_upgrade_profile_request( @@ -489,11 +534,13 @@ async def get_upgrade_profile( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -520,7 +567,7 @@ async def get_available_agent_pool_versions( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.AgentPoolAvailableVersions": + ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported Kubernetes versions for the specified agent pool. See `supported Kubernetes versions @@ -536,13 +583,16 @@ async def get_available_agent_pool_versions( :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.AgentPoolAvailableVersions :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolAvailableVersions"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] request = build_get_available_agent_pool_versions_request( @@ -551,11 +601,13 @@ async def get_available_agent_pool_versions( resource_name=resource_name, api_version=api_version, template_url=self.get_available_agent_pool_versions.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -582,14 +634,17 @@ async def _upgrade_node_image_version_initial( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> Optional["_models.AgentPool"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.AgentPool"]] + ) -> Optional[_models.AgentPool]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] request = build_upgrade_node_image_version_request_initial( @@ -599,11 +654,13 @@ async def _upgrade_node_image_version_initial( agent_pool_name=agent_pool_name, api_version=api_version, template_url=self._upgrade_node_image_version_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -636,7 +693,7 @@ async def begin_upgrade_node_image_version( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> AsyncLROPoller["_models.AgentPool"]: + ) -> AsyncLROPoller[_models.AgentPool]: """Upgrades the node image version of an agent pool to the latest. Upgrading the node image version of an agent pool applies the newest OS and runtime updates to @@ -663,21 +720,26 @@ async def begin_upgrade_node_image_version( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_03_02_preview.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._upgrade_node_image_version_initial( + raw_result = await self._upgrade_node_image_version_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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) @@ -693,8 +755,14 @@ def get_long_running_output(pipeline_response): return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/operations/_maintenance_configurations_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/operations/_maintenance_configurations_operations.py index 9100101120b3..a112084f6555 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/operations/_maintenance_configurations_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/operations/_maintenance_configurations_operations.py @@ -15,6 +15,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -24,26 +25,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class MaintenanceConfigurationsOperations: - """MaintenanceConfigurationsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_03_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_03_02_preview.aio.ContainerServiceClient`'s + :attr:`maintenance_configurations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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_by_managed_cluster( @@ -51,7 +50,7 @@ def list_by_managed_cluster( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> AsyncIterable["_models.MaintenanceConfigurationListResult"]: + ) -> AsyncIterable[_models.MaintenanceConfigurationListResult]: """Gets a list of maintenance configurations in the specified managed cluster. Gets a list of maintenance configurations in the specified managed cluster. @@ -67,13 +66,16 @@ def list_by_managed_cluster( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_03_02_preview.models.MaintenanceConfigurationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfigurationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfigurationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -83,9 +85,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=self.list_by_managed_cluster.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -95,9 +99,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -137,7 +143,7 @@ async def get( resource_name: str, config_name: str, **kwargs: Any - ) -> "_models.MaintenanceConfiguration": + ) -> _models.MaintenanceConfiguration: """Gets the specified maintenance configuration of a managed cluster. Gets the specified maintenance configuration of a managed cluster. @@ -153,13 +159,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.MaintenanceConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfiguration"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] request = build_get_request( @@ -169,11 +178,13 @@ async def get( config_name=config_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -200,9 +211,9 @@ async def create_or_update( resource_group_name: str, resource_name: str, config_name: str, - parameters: "_models.MaintenanceConfiguration", + parameters: _models.MaintenanceConfiguration, **kwargs: Any - ) -> "_models.MaintenanceConfiguration": + ) -> _models.MaintenanceConfiguration: """Creates or updates a maintenance configuration in the specified managed cluster. Creates or updates a maintenance configuration in the specified managed cluster. @@ -221,14 +232,17 @@ async def create_or_update( :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.MaintenanceConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfiguration"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] _json = self._serialize.body(parameters, 'MaintenanceConfiguration') @@ -241,11 +255,13 @@ async def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -289,13 +305,16 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -305,11 +324,13 @@ async def delete( # pylint: disable=inconsistent-return-statements config_name=config_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/operations/_managed_cluster_snapshots_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/operations/_managed_cluster_snapshots_operations.py index 076c98aaf19d..442aef9fd5cb 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/operations/_managed_cluster_snapshots_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/operations/_managed_cluster_snapshots_operations.py @@ -15,6 +15,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -24,32 +25,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ManagedClusterSnapshotsOperations: - """ManagedClusterSnapshotsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_03_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_03_02_preview.aio.ContainerServiceClient`'s + :attr:`managed_cluster_snapshots` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.ManagedClusterSnapshotListResult"]: + ) -> AsyncIterable[_models.ManagedClusterSnapshotListResult]: """Gets a list of managed cluster snapshots in the specified subscription. Gets a list of managed cluster snapshots in the specified subscription. @@ -61,13 +60,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedClusterSnapshotListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshotListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterSnapshotListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -75,9 +77,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -85,9 +89,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -125,7 +131,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ManagedClusterSnapshotListResult"]: + ) -> AsyncIterable[_models.ManagedClusterSnapshotListResult]: """Lists managed cluster snapshots in the specified subscription and resource group. Lists managed cluster snapshots in the specified subscription and resource group. @@ -139,13 +145,16 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedClusterSnapshotListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshotListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterSnapshotListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -154,9 +163,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -165,9 +176,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -206,7 +219,7 @@ async def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedClusterSnapshot": + ) -> _models.ManagedClusterSnapshot: """Gets a managed cluster snapshot. Gets a managed cluster snapshot. @@ -220,13 +233,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedClusterSnapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterSnapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshot] request = build_get_request( @@ -235,11 +251,13 @@ async def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -265,9 +283,9 @@ async def create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterSnapshot", + parameters: _models.ManagedClusterSnapshot, **kwargs: Any - ) -> "_models.ManagedClusterSnapshot": + ) -> _models.ManagedClusterSnapshot: """Creates or updates a managed cluster snapshot. Creates or updates a managed cluster snapshot. @@ -284,14 +302,17 @@ async def create_or_update( :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedClusterSnapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterSnapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshot] _json = self._serialize.body(parameters, 'ManagedClusterSnapshot') @@ -303,11 +324,13 @@ async def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -337,9 +360,9 @@ async def update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.ManagedClusterSnapshot": + ) -> _models.ManagedClusterSnapshot: """Updates tags on a managed cluster snapshot. Updates tags on a managed cluster snapshot. @@ -355,14 +378,17 @@ async def update_tags( :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedClusterSnapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterSnapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-03-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshot] _json = self._serialize.body(parameters, 'TagsObject') @@ -374,11 +400,13 @@ async def update_tags( content_type=content_type, json=_json, template_url=self.update_tags.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -419,13 +447,16 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -434,11 +465,13 @@ async def delete( # pylint: disable=inconsistent-return-statements resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/operations/_managed_clusters_operations.py index 116b07fa3d21..e4fcdbd1ad8d 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/operations/_managed_clusters_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. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ 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 @@ -26,26 +27,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ManagedClustersOperations: # pylint: disable=too-many-public-methods - """ManagedClustersOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_03_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_03_02_preview.aio.ContainerServiceClient`'s + :attr:`managed_clusters` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace_async async def get_os_options( @@ -53,7 +52,7 @@ async def get_os_options( location: str, resource_type: Optional[str] = None, **kwargs: Any - ) -> "_models.OSOptionProfile": + ) -> _models.OSOptionProfile: """Gets supported OS options in the specified subscription. Gets supported OS options in the specified subscription. @@ -68,13 +67,16 @@ async def get_os_options( :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.OSOptionProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OSOptionProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OSOptionProfile] request = build_get_os_options_request( @@ -83,11 +85,13 @@ async def get_os_options( api_version=api_version, resource_type=resource_type, template_url=self.get_os_options.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -112,7 +116,7 @@ async def get_os_options( def list( self, **kwargs: Any - ) -> AsyncIterable["_models.ManagedClusterListResult"]: + ) -> AsyncIterable[_models.ManagedClusterListResult]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. @@ -124,13 +128,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -138,9 +145,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -148,9 +157,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -188,7 +199,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ManagedClusterListResult"]: + ) -> AsyncIterable[_models.ManagedClusterListResult]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. @@ -202,13 +213,16 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -217,9 +231,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -228,9 +244,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -269,7 +287,7 @@ async def get_upgrade_profile( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedClusterUpgradeProfile": + ) -> _models.ManagedClusterUpgradeProfile: """Gets the upgrade profile of a managed cluster. Gets the upgrade profile of a managed cluster. @@ -283,13 +301,16 @@ async def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedClusterUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] request = build_get_upgrade_profile_request( @@ -298,11 +319,13 @@ async def get_upgrade_profile( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -330,7 +353,7 @@ async def get_access_profile( resource_name: str, role_name: str, **kwargs: Any - ) -> "_models.ManagedClusterAccessProfile": + ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. **WARNING**\ : This API will be deprecated. Instead use `ListClusterUserCredentials @@ -349,13 +372,16 @@ async def get_access_profile( :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedClusterAccessProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterAccessProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] request = build_get_access_profile_request( @@ -365,11 +391,13 @@ async def get_access_profile( role_name=role_name, api_version=api_version, template_url=self.get_access_profile.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -397,7 +425,7 @@ async def list_cluster_admin_credentials( resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Lists the admin credentials of a managed cluster. Lists the admin credentials of a managed cluster. @@ -413,13 +441,16 @@ async def list_cluster_admin_credentials( :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_admin_credentials_request( @@ -429,11 +460,13 @@ async def list_cluster_admin_credentials( api_version=api_version, server_fqdn=server_fqdn, template_url=self.list_cluster_admin_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -462,7 +495,7 @@ async def list_cluster_user_credentials( server_fqdn: Optional[str] = None, format: Optional[Union[str, "_models.Format"]] = None, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Lists the user credentials of a managed cluster. Lists the user credentials of a managed cluster. @@ -482,13 +515,16 @@ async def list_cluster_user_credentials( :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_user_credentials_request( @@ -499,11 +535,13 @@ async def list_cluster_user_credentials( server_fqdn=server_fqdn, format=format, template_url=self.list_cluster_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -531,7 +569,7 @@ async def list_cluster_monitoring_user_credentials( resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Lists the cluster monitoring user credentials of a managed cluster. Lists the cluster monitoring user credentials of a managed cluster. @@ -547,13 +585,16 @@ async def list_cluster_monitoring_user_credentials( :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_monitoring_user_credentials_request( @@ -563,11 +604,13 @@ async def list_cluster_monitoring_user_credentials( api_version=api_version, server_fqdn=server_fqdn, template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -594,7 +637,7 @@ async def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedCluster": + ) -> _models.ManagedCluster: """Gets a managed cluster. Gets a managed cluster. @@ -608,13 +651,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedCluster :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] request = build_get_request( @@ -623,11 +669,13 @@ async def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -652,17 +700,20 @@ async def _create_or_update_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'ManagedCluster') @@ -674,11 +725,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -708,9 +761,9 @@ async def begin_create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> AsyncLROPoller["_models.ManagedCluster"]: + ) -> AsyncLROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. Creates or updates a managed cluster. @@ -735,37 +788,47 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -782,17 +845,20 @@ async def _update_tags_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'TagsObject') @@ -804,11 +870,13 @@ async def _update_tags_initial( content_type=content_type, json=_json, template_url=self._update_tags_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -834,9 +902,9 @@ async def begin_update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> AsyncLROPoller["_models.ManagedCluster"]: + ) -> AsyncLROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates tags on a managed cluster. @@ -861,37 +929,47 @@ async def begin_update_tags( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._update_tags_initial( + raw_result = await self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -911,13 +989,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements ignore_pod_disruption_budget: Optional[bool] = None, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -927,11 +1008,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements api_version=api_version, ignore_pod_disruption_budget=ignore_pod_disruption_budget, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -979,21 +1062,26 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, ignore_pod_disruption_budget=ignore_pod_disruption_budget, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1003,8 +1091,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1021,17 +1115,20 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-03-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') @@ -1043,11 +1140,13 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist content_type=content_type, json=_json, template_url=self._reset_service_principal_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1069,7 +1168,7 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> AsyncLROPoller[None]: """Reset the Service Principal Profile of a managed cluster. @@ -1095,23 +1194,28 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._reset_service_principal_profile_initial( + raw_result = await self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1121,8 +1225,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1139,17 +1249,20 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-03-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') @@ -1161,11 +1274,13 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta content_type=content_type, json=_json, template_url=self._reset_aad_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1187,7 +1302,7 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> AsyncLROPoller[None]: """Reset the AAD Profile of a managed cluster. @@ -1213,23 +1328,28 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._reset_aad_profile_initial( + raw_result = await self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1239,8 +1359,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1259,13 +1385,16 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_rotate_cluster_certificates_request_initial( @@ -1274,11 +1403,13 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- resource_name=resource_name, api_version=api_version, template_url=self._rotate_cluster_certificates_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1323,20 +1454,25 @@ async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-ret :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._rotate_cluster_certificates_initial( + raw_result = await self._rotate_cluster_certificates_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) @@ -1346,8 +1482,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1366,13 +1508,16 @@ async def _rotate_service_account_signing_keys_initial( # pylint: disable=incon resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_rotate_service_account_signing_keys_request_initial( @@ -1381,11 +1526,13 @@ async def _rotate_service_account_signing_keys_initial( # pylint: disable=incon resource_name=resource_name, api_version=api_version, template_url=self._rotate_service_account_signing_keys_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1429,20 +1576,25 @@ async def begin_rotate_service_account_signing_keys( # pylint: disable=inconsis :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._rotate_service_account_signing_keys_initial( + raw_result = await self._rotate_service_account_signing_keys_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) @@ -1452,8 +1604,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1472,13 +1630,16 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_stop_request_initial( @@ -1487,11 +1648,13 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_name, api_version=api_version, template_url=self._stop_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1539,20 +1702,25 @@ async def begin_stop( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._stop_initial( + raw_result = await self._stop_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) @@ -1562,8 +1730,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1582,13 +1756,16 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_start_request_initial( @@ -1597,11 +1774,13 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_name, api_version=api_version, template_url=self._start_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1646,20 +1825,25 @@ async def begin_start( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._start_initial( + raw_result = await self._start_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) @@ -1669,8 +1853,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1687,17 +1877,20 @@ async def _run_command_initial( self, resource_group_name: str, resource_name: str, - request_payload: "_models.RunCommandRequest", + request_payload: _models.RunCommandRequest, **kwargs: Any - ) -> Optional["_models.RunCommandResult"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RunCommandResult"]] + ) -> Optional[_models.RunCommandResult]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] _json = self._serialize.body(request_payload, 'RunCommandRequest') @@ -1709,11 +1902,13 @@ async def _run_command_initial( content_type=content_type, json=_json, template_url=self._run_command_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1741,9 +1936,9 @@ async def begin_run_command( self, resource_group_name: str, resource_name: str, - request_payload: "_models.RunCommandRequest", + request_payload: _models.RunCommandRequest, **kwargs: Any - ) -> AsyncLROPoller["_models.RunCommandResult"]: + ) -> AsyncLROPoller[_models.RunCommandResult]: """Submits a command to run against the Managed Cluster. AKS will create a pod to run the command. This is primarily useful for private clusters. For @@ -1771,37 +1966,47 @@ async def begin_run_command( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_03_02_preview.models.RunCommandResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.RunCommandResult] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._run_command_initial( + raw_result = await self._run_command_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, request_payload=request_payload, 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): - response = pipeline_response.http_response deserialized = self._deserialize('RunCommandResult', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1821,7 +2026,7 @@ async def get_command_result( resource_name: str, command_id: str, **kwargs: Any - ) -> Optional["_models.RunCommandResult"]: + ) -> Optional[_models.RunCommandResult]: """Gets the results of a command which has been run on the Managed Cluster. Gets the results of a command which has been run on the Managed Cluster. @@ -1837,13 +2042,16 @@ async def get_command_result( :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.RunCommandResult or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RunCommandResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] request = build_get_command_result_request( @@ -1853,11 +2061,13 @@ async def get_command_result( command_id=command_id, api_version=api_version, template_url=self.get_command_result.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1886,7 +2096,7 @@ def list_outbound_network_dependencies_endpoints( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> AsyncIterable["_models.OutboundEnvironmentEndpointCollection"]: + ) -> AsyncIterable[_models.OutboundEnvironmentEndpointCollection]: """Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. @@ -1904,13 +2114,16 @@ def list_outbound_network_dependencies_endpoints( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_03_02_preview.models.OutboundEnvironmentEndpointCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OutboundEnvironmentEndpointCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -1920,9 +2133,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=self.list_outbound_network_dependencies_endpoints.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -1932,9 +2147,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/operations/_operations.py index b988c0eb6893..2b72bd646600 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/operations/_operations.py @@ -14,6 +14,7 @@ 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 @@ -23,32 +24,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class Operations: - """Operations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_03_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_03_02_preview.aio.ContainerServiceClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.OperationListResult"]: + ) -> AsyncIterable[_models.OperationListResult]: """Gets a list of operations. Gets a list of operations. @@ -59,31 +58,38 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_03_02_preview.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/operations/_private_endpoint_connections_operations.py index 740037fbd98f..dbac1677030b 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/operations/_private_endpoint_connections_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -14,6 +14,7 @@ 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 @@ -24,26 +25,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class PrivateEndpointConnectionsOperations: - """PrivateEndpointConnectionsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_03_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_03_02_preview.aio.ContainerServiceClient`'s + :attr:`private_endpoint_connections` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -51,7 +50,7 @@ async def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnectionListResult": + ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. To learn more about private clusters, see: @@ -67,13 +66,16 @@ async def list( ~azure.mgmt.containerservice.v2022_03_02_preview.models.PrivateEndpointConnectionListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] request = build_list_request( @@ -82,11 +84,13 @@ async def list( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -114,7 +118,7 @@ async def get( resource_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Gets the specified private endpoint connection. To learn more about private clusters, see: @@ -131,13 +135,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] request = build_get_request( @@ -147,11 +154,13 @@ async def get( private_endpoint_connection_name=private_endpoint_connection_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -178,9 +187,9 @@ async def update( resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - parameters: "_models.PrivateEndpointConnection", + parameters: _models.PrivateEndpointConnection, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. Updates a private endpoint connection. @@ -199,14 +208,17 @@ async def update( :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-03-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] _json = self._serialize.body(parameters, 'PrivateEndpointConnection') @@ -219,11 +231,13 @@ async def update( content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -251,13 +265,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -267,11 +284,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name=private_endpoint_connection_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -318,21 +337,26 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -342,8 +366,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/operations/_private_link_resources_operations.py index 92225ab4e459..631fd01d89b2 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/operations/_private_link_resources_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/operations/_private_link_resources_operations.py @@ -13,6 +13,7 @@ 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 @@ -22,26 +23,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class PrivateLinkResourcesOperations: - """PrivateLinkResourcesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_03_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_03_02_preview.aio.ContainerServiceClient`'s + :attr:`private_link_resources` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -49,7 +48,7 @@ async def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.PrivateLinkResourcesListResult": + ) -> _models.PrivateLinkResourcesListResult: """Gets a list of private link resources in the specified managed cluster. To learn more about private clusters, see: @@ -64,13 +63,16 @@ async def list( :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.PrivateLinkResourcesListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourcesListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] request = build_list_request( @@ -79,11 +81,13 @@ async def list( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/operations/_resolve_private_link_service_id_operations.py index e91a676f71db..75dab2aee111 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/operations/_resolve_private_link_service_id_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/operations/_resolve_private_link_service_id_operations.py @@ -13,6 +13,7 @@ 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 @@ -22,35 +23,33 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ResolvePrivateLinkServiceIdOperations: - """ResolvePrivateLinkServiceIdOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_03_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_03_02_preview.aio.ContainerServiceClient`'s + :attr:`resolve_private_link_service_id` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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 post( self, resource_group_name: str, resource_name: str, - parameters: "_models.PrivateLinkResource", + parameters: _models.PrivateLinkResource, **kwargs: Any - ) -> "_models.PrivateLinkResource": + ) -> _models.PrivateLinkResource: """Gets the private link service ID for the specified managed cluster. Gets the private link service ID for the specified managed cluster. @@ -66,14 +65,17 @@ async def post( :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.PrivateLinkResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-03-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] _json = self._serialize.body(parameters, 'PrivateLinkResource') @@ -85,11 +87,13 @@ async def post( content_type=content_type, json=_json, template_url=self.post.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/operations/_snapshots_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/operations/_snapshots_operations.py index b89475a2fcd7..07ad30adbeff 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/operations/_snapshots_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/aio/operations/_snapshots_operations.py @@ -15,6 +15,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -24,32 +25,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class SnapshotsOperations: - """SnapshotsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_03_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_03_02_preview.aio.ContainerServiceClient`'s + :attr:`snapshots` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.SnapshotListResult"]: + ) -> AsyncIterable[_models.SnapshotListResult]: """Gets a list of snapshots in the specified subscription. Gets a list of snapshots in the specified subscription. @@ -60,13 +59,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_03_02_preview.models.SnapshotListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -74,9 +76,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -84,9 +88,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -124,7 +130,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.SnapshotListResult"]: + ) -> AsyncIterable[_models.SnapshotListResult]: """Lists snapshots in the specified subscription and resource group. Lists snapshots in the specified subscription and resource group. @@ -137,13 +143,16 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_03_02_preview.models.SnapshotListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -152,9 +161,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -163,9 +174,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -204,7 +217,7 @@ async def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.Snapshot": + ) -> _models.Snapshot: """Gets a snapshot. Gets a snapshot. @@ -218,13 +231,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.Snapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] request = build_get_request( @@ -233,11 +249,13 @@ async def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -263,9 +281,9 @@ async def create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.Snapshot", + parameters: _models.Snapshot, **kwargs: Any - ) -> "_models.Snapshot": + ) -> _models.Snapshot: """Creates or updates a snapshot. Creates or updates a snapshot. @@ -281,14 +299,17 @@ async def create_or_update( :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.Snapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] _json = self._serialize.body(parameters, 'Snapshot') @@ -300,11 +321,13 @@ async def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -334,9 +357,9 @@ async def update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.Snapshot": + ) -> _models.Snapshot: """Updates tags on a snapshot. Updates tags on a snapshot. @@ -352,14 +375,17 @@ async def update_tags( :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.Snapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-03-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] _json = self._serialize.body(parameters, 'TagsObject') @@ -371,11 +397,13 @@ async def update_tags( content_type=content_type, json=_json, template_url=self.update_tags.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -416,13 +444,16 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -431,11 +462,13 @@ async def delete( # pylint: disable=inconsistent-return-statements resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/models/__init__.py index fc2d5e3f64f5..ebe438d015d2 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/models/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/models/__init__.py @@ -146,7 +146,9 @@ WeekDay, WorkloadRuntime, ) - +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'AgentPool', 'AgentPoolAvailableVersions', @@ -285,3 +287,5 @@ 'WeekDay', 'WorkloadRuntime', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/models/_container_service_client_enums.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/models/_container_service_client_enums.py index 375009a44e5b..c66d7c8a922b 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/models/_container_service_client_enums.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/models/_container_service_client_enums.py @@ -7,11 +7,10 @@ # -------------------------------------------------------------------------- from enum import Enum -from six import with_metaclass from azure.core import CaseInsensitiveEnumMeta -class AgentPoolMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class AgentPoolMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: https://docs.microsoft.com/azure/aks/use-system-pools @@ -24,7 +23,7 @@ class AgentPoolMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: User agent pools are primarily for hosting your application pods. USER = "User" -class AgentPoolType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class AgentPoolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of Agent Pool. """ @@ -33,7 +32,7 @@ class AgentPoolType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Use of this is strongly discouraged. AVAILABILITY_SET = "AvailabilitySet" -class Code(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class Code(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Tells whether the cluster is Running or Stopped """ @@ -42,7 +41,7 @@ class Code(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: The cluster is stopped. STOPPED = "Stopped" -class ConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The private link service connection status. """ @@ -51,7 +50,7 @@ class ConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): REJECTED = "Rejected" DISCONNECTED = "Disconnected" -class ContainerServiceStorageProfileTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Specifies what kind of storage to use. If omitted, the default will be chosen on your behalf based on the choice of orchestrator. """ @@ -59,7 +58,7 @@ class ContainerServiceStorageProfileTypes(with_metaclass(CaseInsensitiveEnumMeta STORAGE_ACCOUNT = "StorageAccount" MANAGED_DISKS = "ManagedDisks" -class ContainerServiceVMSizeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Size of agent VMs. Note: This is no longer maintained. """ @@ -238,7 +237,7 @@ class ContainerServiceVMSizeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, E STANDARD_NV24 = "Standard_NV24" STANDARD_NV6 = "Standard_NV6" -class Count(with_metaclass(CaseInsensitiveEnumMeta, int, Enum)): +class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): """Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, and 5. The default value is 1. """ @@ -247,7 +246,7 @@ class Count(with_metaclass(CaseInsensitiveEnumMeta, int, Enum)): THREE = 3 FIVE = 5 -class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of identity that created the resource. """ @@ -256,7 +255,7 @@ class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class Expander(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class Expander(str, Enum, metaclass=CaseInsensitiveEnumMeta): """If not specified, the default is 'random'. See `expanders `_ for more information. @@ -279,13 +278,13 @@ class Expander(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Used when you don't have a particular need for the node groups to scale differently. RANDOM = "random" -class ExtendedLocationTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ExtendedLocationTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of extendedLocation. """ EDGE_ZONE = "EdgeZone" -class Format(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class Format(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Return azure auth-provider kubeconfig. This format is deprecated in 1.22 and will be fully #: removed in 1.25. @@ -293,7 +292,7 @@ class Format(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Return exec format kubeconfig. This format requires kubelogin binary in the path. EXEC_ENUM = "exec" -class GPUInstanceProfile(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class GPUInstanceProfile(str, Enum, metaclass=CaseInsensitiveEnumMeta): """GPUInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU. """ @@ -303,14 +302,14 @@ class GPUInstanceProfile(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MIG4_G = "MIG4g" MIG7_G = "MIG7g" -class IpFamily(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class IpFamily(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The IP version to use for cluster networking and IP assignment. """ I_PV4 = "IPv4" I_PV6 = "IPv6" -class KubeletDiskType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class KubeletDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. """ @@ -320,7 +319,7 @@ class KubeletDiskType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Kubelet will use the temporary disk for its data. TEMPORARY = "Temporary" -class LicenseType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class LicenseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The license type to use for Windows VMs. See `Azure Hybrid User Benefits `_ for more details. """ @@ -330,7 +329,7 @@ class LicenseType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Enables Azure Hybrid User Benefits for Windows VMs. WINDOWS_SERVER = "Windows_Server" -class LoadBalancerSku(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class LoadBalancerSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the differences between load balancer SKUs. @@ -343,7 +342,7 @@ class LoadBalancerSku(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Use a basic Load Balancer with limited functionality. BASIC = "basic" -class ManagedClusterPodIdentityProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ManagedClusterPodIdentityProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The current provisioning state of the pod identity. """ @@ -352,13 +351,13 @@ class ManagedClusterPodIdentityProvisioningState(with_metaclass(CaseInsensitiveE DELETING = "Deleting" FAILED = "Failed" -class ManagedClusterSKUName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ManagedClusterSKUName(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The name of a managed cluster SKU. """ BASIC = "Basic" -class ManagedClusterSKUTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ManagedClusterSKUTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): """If not specified, the default is 'Free'. See `uptime SLA `_ for more details. """ @@ -369,7 +368,7 @@ class ManagedClusterSKUTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: No guaranteed SLA, no additional charges. Free tier clusters have an SLO of 99.5%. FREE = "Free" -class NetworkMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """This cannot be specified if networkPlugin is anything other than 'azure'. """ @@ -380,7 +379,7 @@ class NetworkMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: This is no longer supported. BRIDGE = "bridge" -class NetworkPlugin(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkPlugin(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Network plugin used for building the Kubernetes network. """ @@ -396,7 +395,7 @@ class NetworkPlugin(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: networking functionality. NONE = "none" -class NetworkPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Network policy used for building the Kubernetes network. """ @@ -409,7 +408,7 @@ class NetworkPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: for more information. AZURE = "azure" -class OSDiskType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OSDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS @@ -425,14 +424,14 @@ class OSDiskType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: provides lower read/write latency, along with faster node scaling and cluster upgrades. EPHEMERAL = "Ephemeral" -class OSSKU(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OSSKU(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Specifies an OS SKU. This value must not be specified if OSType is Windows. """ UBUNTU = "Ubuntu" CBL_MARINER = "CBLMariner" -class OSType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The operating system type. The default is Linux. """ @@ -441,7 +440,7 @@ class OSType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Use Windows. WINDOWS = "Windows" -class OutboundType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OutboundType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type `_. """ @@ -461,7 +460,7 @@ class OutboundType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: advanced scenario and requires proper network configuration. USER_ASSIGNED_NAT_GATEWAY = "userAssignedNATGateway" -class PrivateEndpointConnectionProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class PrivateEndpointConnectionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The current provisioning state. """ @@ -470,14 +469,14 @@ class PrivateEndpointConnectionProvisioningState(with_metaclass(CaseInsensitiveE DELETING = "Deleting" FAILED = "Failed" -class PublicNetworkAccess(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class PublicNetworkAccess(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Allow or deny public network access for AKS """ ENABLED = "Enabled" DISABLED = "Disabled" -class ResourceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """For more information see `use managed identities in AKS `_. """ @@ -493,7 +492,7 @@ class ResourceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Do not use a managed identity for the Managed Cluster, service principal will be used instead. NONE = "None" -class ScaleDownMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ScaleDownMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Describes how VMs are added to or removed from Agent Pools. See `billing states `_. """ @@ -504,7 +503,7 @@ class ScaleDownMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: during scale down. DEALLOCATE = "Deallocate" -class ScaleSetEvictionPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The eviction policy specifies what to do with the VM when it is evicted. The default is Delete. For more information about eviction see `spot VMs `_ @@ -517,7 +516,7 @@ class ScaleSetEvictionPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)) #: cause issues with cluster scaling or upgrading. DEALLOCATE = "Deallocate" -class ScaleSetPriority(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ScaleSetPriority(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The Virtual Machine Scale Set priority. """ @@ -527,7 +526,7 @@ class ScaleSetPriority(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Regular VMs will be used. REGULAR = "Regular" -class SnapshotType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SnapshotType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of a snapshot. The default is NodePool. """ @@ -536,7 +535,7 @@ class SnapshotType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: The snapshot is a snapshot of a managed cluster. MANAGED_CLUSTER = "ManagedCluster" -class UpgradeChannel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class UpgradeChannel(str, Enum, metaclass=CaseInsensitiveEnumMeta): """For more information see `setting the AKS cluster auto-upgrade channel `_. """ @@ -566,7 +565,7 @@ class UpgradeChannel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Disables auto-upgrades and keeps the cluster at its current version of Kubernetes. NONE = "none" -class WeekDay(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class WeekDay(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The weekday enum. """ @@ -578,7 +577,7 @@ class WeekDay(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): FRIDAY = "Friday" SATURDAY = "Saturday" -class WorkloadRuntime(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class WorkloadRuntime(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Determines the type of workload a node can run. """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/models/_models_py3.py index dc6df96c3eb3..7a64b04d5286 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/models/_models_py3.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/models/_models_py3.py @@ -7,11 +7,13 @@ # -------------------------------------------------------------------------- import datetime -from typing import Dict, List, Optional, Union +from typing import Dict, List, Optional, TYPE_CHECKING, Union import msrest.serialization -from ._container_service_client_enums import * +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + import __init__ as _models class SubResource(msrest.serialization.Model): @@ -79,16 +81,16 @@ class AgentPool(SubResource): :ivar os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS - `_. Possible values - include: "Managed", "Ephemeral". + `_. Known values are: + "Managed", "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Possible values include: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.KubeletDiskType - :ivar workload_runtime: Determines the type of workload a node can run. Possible values - include: "OCIContainer", "WasmWasi". + :ivar workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer", "WasmWasi". :vartype workload_runtime: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.WorkloadRuntime :ivar message_of_the_day: A base64-encoded string which will be written to /etc/motd after @@ -107,11 +109,11 @@ class AgentPool(SubResource): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.OSType - :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Possible values include: "Ubuntu", "CBLMariner". + :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known + values are: "Ubuntu", "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. :vartype max_count: int @@ -120,17 +122,16 @@ class AgentPool(SubResource): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it - defaults to Delete. Possible values include: "Delete", "Deallocate". + defaults to Delete. Known values are: "Delete", "Deallocate". :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.ScaleDownMode - :ivar type_properties_type: The type of Agent Pool. Possible values include: + :ivar type_properties_type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :vartype type_properties_type: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Possible values include: "System", - "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". :vartype mode: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.AgentPoolMode :ivar orchestrator_version: Both patch version and are supported. When is specified, the latest supported patch version is chosen @@ -172,12 +173,12 @@ class AgentPool(SubResource): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Possible values include: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Possible values include: "Delete", - "Deallocate". Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which @@ -209,7 +210,7 @@ class AgentPool(SubResource): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.GPUInstanceProfile :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool @@ -289,42 +290,42 @@ def __init__( count: Optional[int] = None, vm_size: Optional[str] = None, os_disk_size_gb: Optional[int] = None, - os_disk_type: Optional[Union[str, "OSDiskType"]] = None, - kubelet_disk_type: Optional[Union[str, "KubeletDiskType"]] = None, - workload_runtime: Optional[Union[str, "WorkloadRuntime"]] = None, + os_disk_type: Optional[Union[str, "_models.OSDiskType"]] = None, + kubelet_disk_type: Optional[Union[str, "_models.KubeletDiskType"]] = None, + workload_runtime: Optional[Union[str, "_models.WorkloadRuntime"]] = None, message_of_the_day: Optional[str] = None, vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", - os_sku: Optional[Union[str, "OSSKU"]] = None, + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - scale_down_mode: Optional[Union[str, "ScaleDownMode"]] = None, - type_properties_type: Optional[Union[str, "AgentPoolType"]] = None, - mode: Optional[Union[str, "AgentPoolMode"]] = None, + scale_down_mode: Optional[Union[str, "_models.ScaleDownMode"]] = None, + type_properties_type: Optional[Union[str, "_models.AgentPoolType"]] = None, + mode: Optional[Union[str, "_models.AgentPoolMode"]] = None, orchestrator_version: Optional[str] = None, current_orchestrator_version: Optional[str] = None, - upgrade_settings: Optional["AgentPoolUpgradeSettings"] = None, - power_state: Optional["PowerState"] = None, + upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, + power_state: Optional["_models.PowerState"] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", spot_max_price: Optional[float] = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, proximity_placement_group_id: Optional[str] = None, - kubelet_config: Optional["KubeletConfig"] = None, - linux_os_config: Optional["LinuxOSConfig"] = None, + kubelet_config: Optional["_models.KubeletConfig"] = None, + linux_os_config: Optional["_models.LinuxOSConfig"] = None, enable_encryption_at_host: Optional[bool] = None, enable_ultra_ssd: Optional[bool] = None, enable_fips: Optional[bool] = None, - gpu_instance_profile: Optional[Union[str, "GPUInstanceProfile"]] = None, - creation_data: Optional["CreationData"] = None, + gpu_instance_profile: Optional[Union[str, "_models.GPUInstanceProfile"]] = None, + creation_data: Optional["_models.CreationData"] = None, capacity_reservation_group_id: Optional[str] = None, host_group_id: Optional[str] = None, **kwargs @@ -345,16 +346,16 @@ def __init__( :keyword os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS - `_. Possible values - include: "Managed", "Ephemeral". + `_. Known values are: + "Managed", "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Possible values include: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.KubeletDiskType - :keyword workload_runtime: Determines the type of workload a node can run. Possible values - include: "OCIContainer", "WasmWasi". + :keyword workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer", "WasmWasi". :paramtype workload_runtime: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.WorkloadRuntime :keyword message_of_the_day: A base64-encoded string which will be written to /etc/motd after @@ -373,11 +374,11 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.OSType :keyword os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Possible values include: "Ubuntu", "CBLMariner". + Known values are: "Ubuntu", "CBLMariner". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -386,17 +387,16 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, - it defaults to Delete. Possible values include: "Delete", "Deallocate". + it defaults to Delete. Known values are: "Delete", "Deallocate". :paramtype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.ScaleDownMode - :keyword type_properties_type: The type of Agent Pool. Possible values include: + :keyword type_properties_type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type_properties_type: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Possible values include: "System", - "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.AgentPoolMode :keyword orchestrator_version: Both patch version and are supported. When is specified, the latest supported patch version is chosen @@ -434,12 +434,12 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Possible values include: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Possible values include: "Delete", - "Deallocate". Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which @@ -473,7 +473,7 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.GPUInstanceProfile @@ -567,7 +567,7 @@ class AgentPoolAvailableVersions(msrest.serialization.Model): def __init__( self, *, - agent_pool_versions: Optional[List["AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem"]] = None, + agent_pool_versions: Optional[List["_models.AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem"]] = None, **kwargs ): """ @@ -644,7 +644,7 @@ class AgentPoolListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["AgentPool"]] = None, + value: Optional[List["_models.AgentPool"]] = None, **kwargs ): """ @@ -671,8 +671,8 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): :vartype type: str :ivar kubernetes_version: Required. The Kubernetes version (major.minor.patch). :vartype kubernetes_version: str - :ivar os_type: Required. The operating system type. The default is Linux. Possible values - include: "Linux", "Windows". Default value: "Linux". + :ivar os_type: Required. The operating system type. The default is Linux. Known values are: + "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -703,16 +703,16 @@ def __init__( self, *, kubernetes_version: str, - os_type: Union[str, "OSType"] = "Linux", - upgrades: Optional[List["AgentPoolUpgradeProfilePropertiesUpgradesItem"]] = None, + os_type: Union[str, "_models.OSType"] = "Linux", + upgrades: Optional[List["_models.AgentPoolUpgradeProfilePropertiesUpgradesItem"]] = None, latest_node_image_version: Optional[str] = None, **kwargs ): """ :keyword kubernetes_version: Required. The Kubernetes version (major.minor.patch). :paramtype kubernetes_version: str - :keyword os_type: Required. The operating system type. The default is Linux. Possible values - include: "Linux", "Windows". Default value: "Linux". + :keyword os_type: Required. The operating system type. The default is Linux. Known values are: + "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: @@ -865,7 +865,7 @@ def __init__( code: Optional[str] = None, message: Optional[str] = None, target: Optional[str] = None, - details: Optional[List["CloudErrorBody"]] = None, + details: Optional[List["_models.CloudErrorBody"]] = None, **kwargs ): """ @@ -910,7 +910,7 @@ class ContainerServiceDiagnosticsProfile(msrest.serialization.Model): def __init__( self, *, - vm_diagnostics: "ContainerServiceVMDiagnostics", + vm_diagnostics: "_models.ContainerServiceVMDiagnostics", **kwargs ): """ @@ -948,7 +948,7 @@ def __init__( self, *, admin_username: str, - ssh: "ContainerServiceSshConfiguration", + ssh: "_models.ContainerServiceSshConfiguration", **kwargs ): """ @@ -971,17 +971,17 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar count: Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, - and 5. The default value is 1. Possible values include: 1, 3, 5. Default value: "1". + and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". :vartype count: int or ~azure.mgmt.containerservice.v2022_03_02_preview.models.Count :ivar dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. :vartype dns_prefix: str - :ivar vm_size: Required. Size of agent VMs. Possible values include: "Standard_A1", - "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", - "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", - "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", - "Standard_A8m_v2", "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", - "Standard_B8ms", "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", - "Standard_D12", "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", + :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", + "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", + "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", + "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", "Standard_B8ms", + "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", "Standard_D12", + "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", "Standard_D13_v2_Promo", "Standard_D14", "Standard_D14_v2", "Standard_D14_v2_Promo", "Standard_D15_v2", "Standard_D16_v3", "Standard_D16s_v3", "Standard_D1_v2", "Standard_D2", "Standard_D2_v2", "Standard_D2_v2_Promo", "Standard_D2_v3", "Standard_D2s_v3", "Standard_D3", @@ -1026,7 +1026,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): :vartype first_consecutive_static_ip: str :ivar storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Possible values include: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". :vartype storage_profile: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.ContainerServiceStorageProfileTypes :ivar fqdn: FQDN for the master pool. @@ -1055,27 +1055,27 @@ def __init__( self, *, dns_prefix: str, - vm_size: Union[str, "ContainerServiceVMSizeTypes"], - count: Optional[Union[int, "Count"]] = 1, + vm_size: Union[str, "_models.ContainerServiceVMSizeTypes"], + count: Optional[Union[int, "_models.Count"]] = 1, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, first_consecutive_static_ip: Optional[str] = "10.240.255.5", - storage_profile: Optional[Union[str, "ContainerServiceStorageProfileTypes"]] = None, + storage_profile: Optional[Union[str, "_models.ContainerServiceStorageProfileTypes"]] = None, **kwargs ): """ :keyword count: Number of masters (VMs) in the container service cluster. Allowed values are 1, - 3, and 5. The default value is 1. Possible values include: 1, 3, 5. Default value: "1". + 3, and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". :paramtype count: int or ~azure.mgmt.containerservice.v2022_03_02_preview.models.Count :keyword dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. :paramtype dns_prefix: str - :keyword vm_size: Required. Size of agent VMs. Possible values include: "Standard_A1", - "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", - "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", - "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", - "Standard_A8m_v2", "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", - "Standard_B8ms", "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", - "Standard_D12", "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", + :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", + "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", + "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", + "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", "Standard_B8ms", + "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", "Standard_D12", + "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", "Standard_D13_v2_Promo", "Standard_D14", "Standard_D14_v2", "Standard_D14_v2_Promo", "Standard_D15_v2", "Standard_D16_v3", "Standard_D16s_v3", "Standard_D1_v2", "Standard_D2", "Standard_D2_v2", "Standard_D2_v2_Promo", "Standard_D2_v3", "Standard_D2s_v3", "Standard_D3", @@ -1120,7 +1120,7 @@ def __init__( :paramtype first_consecutive_static_ip: str :keyword storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Possible values include: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". :paramtype storage_profile: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.ContainerServiceStorageProfileTypes """ @@ -1138,16 +1138,16 @@ def __init__( class ContainerServiceNetworkProfile(msrest.serialization.Model): """Profile of network configuration. - :ivar network_plugin: Network plugin used for building the Kubernetes network. Possible values - include: "azure", "kubenet", "none". Default value: "kubenet". + :ivar network_plugin: Network plugin used for building the Kubernetes network. Known values + are: "azure", "kubenet", "none". Default value: "kubenet". :vartype network_plugin: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.NetworkPlugin - :ivar network_policy: Network policy used for building the Kubernetes network. Possible values - include: "calico", "azure". + :ivar network_policy: Network policy used for building the Kubernetes network. Known values + are: "calico", "azure". :vartype network_policy: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.NetworkPolicy :ivar network_mode: This cannot be specified if networkPlugin is anything other than 'azure'. - Possible values include: "transparent", "bridge". + Known values are: "transparent", "bridge". :vartype network_mode: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.NetworkMode :ivar pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. @@ -1163,14 +1163,14 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): :vartype docker_bridge_cidr: str :ivar outbound_type: This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type - `_. Possible values include: - "loadBalancer", "userDefinedRouting", "managedNATGateway", "userAssignedNATGateway". Default - value: "loadBalancer". + `_. Known values are: "loadBalancer", + "userDefinedRouting", "managedNATGateway", "userAssignedNATGateway". Default value: + "loadBalancer". :vartype outbound_type: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.OutboundType :ivar load_balancer_sku: The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the - differences between load balancer SKUs. Possible values include: "standard", "basic". + differences between load balancer SKUs. Known values are: "standard", "basic". :vartype load_balancer_sku: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.LoadBalancerSku :ivar load_balancer_profile: Profile of the cluster load balancer. @@ -1220,33 +1220,33 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): def __init__( self, *, - network_plugin: Optional[Union[str, "NetworkPlugin"]] = "kubenet", - network_policy: Optional[Union[str, "NetworkPolicy"]] = None, - network_mode: Optional[Union[str, "NetworkMode"]] = None, + network_plugin: Optional[Union[str, "_models.NetworkPlugin"]] = "kubenet", + network_policy: Optional[Union[str, "_models.NetworkPolicy"]] = None, + network_mode: Optional[Union[str, "_models.NetworkMode"]] = None, pod_cidr: Optional[str] = "10.244.0.0/16", service_cidr: Optional[str] = "10.0.0.0/16", dns_service_ip: Optional[str] = "10.0.0.10", docker_bridge_cidr: Optional[str] = "172.17.0.1/16", - outbound_type: Optional[Union[str, "OutboundType"]] = "loadBalancer", - load_balancer_sku: Optional[Union[str, "LoadBalancerSku"]] = None, - load_balancer_profile: Optional["ManagedClusterLoadBalancerProfile"] = None, - nat_gateway_profile: Optional["ManagedClusterNATGatewayProfile"] = None, + outbound_type: Optional[Union[str, "_models.OutboundType"]] = "loadBalancer", + load_balancer_sku: Optional[Union[str, "_models.LoadBalancerSku"]] = None, + load_balancer_profile: Optional["_models.ManagedClusterLoadBalancerProfile"] = None, + nat_gateway_profile: Optional["_models.ManagedClusterNATGatewayProfile"] = None, pod_cidrs: Optional[List[str]] = None, service_cidrs: Optional[List[str]] = None, - ip_families: Optional[List[Union[str, "IpFamily"]]] = None, + ip_families: Optional[List[Union[str, "_models.IpFamily"]]] = None, **kwargs ): """ - :keyword network_plugin: Network plugin used for building the Kubernetes network. Possible - values include: "azure", "kubenet", "none". Default value: "kubenet". + :keyword network_plugin: Network plugin used for building the Kubernetes network. Known values + are: "azure", "kubenet", "none". Default value: "kubenet". :paramtype network_plugin: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.NetworkPlugin - :keyword network_policy: Network policy used for building the Kubernetes network. Possible - values include: "calico", "azure". + :keyword network_policy: Network policy used for building the Kubernetes network. Known values + are: "calico", "azure". :paramtype network_policy: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.NetworkPolicy :keyword network_mode: This cannot be specified if networkPlugin is anything other than - 'azure'. Possible values include: "transparent", "bridge". + 'azure'. Known values are: "transparent", "bridge". :paramtype network_mode: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.NetworkMode :keyword pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. @@ -1262,14 +1262,14 @@ def __init__( :paramtype docker_bridge_cidr: str :keyword outbound_type: This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type - `_. Possible values include: - "loadBalancer", "userDefinedRouting", "managedNATGateway", "userAssignedNATGateway". Default - value: "loadBalancer". + `_. Known values are: "loadBalancer", + "userDefinedRouting", "managedNATGateway", "userAssignedNATGateway". Default value: + "loadBalancer". :paramtype outbound_type: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.OutboundType :keyword load_balancer_sku: The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the - differences between load balancer SKUs. Possible values include: "standard", "basic". + differences between load balancer SKUs. Known values are: "standard", "basic". :paramtype load_balancer_sku: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.LoadBalancerSku :keyword load_balancer_profile: Profile of the cluster load balancer. @@ -1330,7 +1330,7 @@ class ContainerServiceSshConfiguration(msrest.serialization.Model): def __init__( self, *, - public_keys: List["ContainerServiceSshPublicKey"], + public_keys: List["_models.ContainerServiceSshPublicKey"], **kwargs ): """ @@ -1520,7 +1520,7 @@ def __init__( self, *, domain_name: Optional[str] = None, - endpoint_details: Optional[List["EndpointDetail"]] = None, + endpoint_details: Optional[List["_models.EndpointDetail"]] = None, **kwargs ): """ @@ -1586,7 +1586,7 @@ class ExtendedLocation(msrest.serialization.Model): :ivar name: The name of the extended location. :vartype name: str - :ivar type: The type of the extended location. Possible values include: "EdgeZone". + :ivar type: The type of the extended location. Known values are: "EdgeZone". :vartype type: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.ExtendedLocationTypes """ @@ -1600,13 +1600,13 @@ def __init__( self, *, name: Optional[str] = None, - type: Optional[Union[str, "ExtendedLocationTypes"]] = None, + type: Optional[Union[str, "_models.ExtendedLocationTypes"]] = None, **kwargs ): """ :keyword name: The name of the extended location. :paramtype name: str - :keyword type: The type of the extended location. Possible values include: "EdgeZone". + :keyword type: The type of the extended location. Known values are: "EdgeZone". :paramtype type: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.ExtendedLocationTypes """ @@ -1766,7 +1766,7 @@ class LinuxOSConfig(msrest.serialization.Model): def __init__( self, *, - sysctls: Optional["SysctlConfig"] = None, + sysctls: Optional["_models.SysctlConfig"] = None, transparent_huge_page_enabled: Optional[str] = None, transparent_huge_page_defrag: Optional[str] = None, swap_file_size_mb: Optional[int] = None, @@ -1835,8 +1835,8 @@ class MaintenanceConfiguration(SubResource): def __init__( self, *, - time_in_week: Optional[List["TimeInWeek"]] = None, - not_allowed_time: Optional[List["TimeSpan"]] = None, + time_in_week: Optional[List["_models.TimeInWeek"]] = None, + not_allowed_time: Optional[List["_models.TimeSpan"]] = None, **kwargs ): """ @@ -1878,7 +1878,7 @@ class MaintenanceConfigurationListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["MaintenanceConfiguration"]] = None, + value: Optional[List["_models.MaintenanceConfiguration"]] = None, **kwargs ): """ @@ -2128,8 +2128,8 @@ class ManagedCluster(TrackedResource): :ivar ingress_profile: Ingress profile for the managed cluster. :vartype ingress_profile: ~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedClusterIngressProfile - :ivar public_network_access: Allow or deny public network access for AKS. Possible values - include: "Enabled", "Disabled". + :ivar public_network_access: Allow or deny public network access for AKS. Known values are: + "Enabled", "Disabled". :vartype public_network_access: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.PublicNetworkAccess """ @@ -2201,37 +2201,37 @@ def __init__( *, location: str, tags: Optional[Dict[str, str]] = None, - sku: Optional["ManagedClusterSKU"] = None, - extended_location: Optional["ExtendedLocation"] = None, - identity: Optional["ManagedClusterIdentity"] = None, - creation_data: Optional["CreationData"] = None, + sku: Optional["_models.ManagedClusterSKU"] = None, + extended_location: Optional["_models.ExtendedLocation"] = None, + identity: Optional["_models.ManagedClusterIdentity"] = None, + creation_data: Optional["_models.CreationData"] = None, kubernetes_version: Optional[str] = None, dns_prefix: Optional[str] = None, fqdn_subdomain: Optional[str] = None, - agent_pool_profiles: Optional[List["ManagedClusterAgentPoolProfile"]] = None, - linux_profile: Optional["ContainerServiceLinuxProfile"] = None, - windows_profile: Optional["ManagedClusterWindowsProfile"] = None, - service_principal_profile: Optional["ManagedClusterServicePrincipalProfile"] = None, - addon_profiles: Optional[Dict[str, "ManagedClusterAddonProfile"]] = None, - pod_identity_profile: Optional["ManagedClusterPodIdentityProfile"] = None, - oidc_issuer_profile: Optional["ManagedClusterOIDCIssuerProfile"] = None, + agent_pool_profiles: Optional[List["_models.ManagedClusterAgentPoolProfile"]] = None, + linux_profile: Optional["_models.ContainerServiceLinuxProfile"] = None, + windows_profile: Optional["_models.ManagedClusterWindowsProfile"] = None, + service_principal_profile: Optional["_models.ManagedClusterServicePrincipalProfile"] = None, + addon_profiles: Optional[Dict[str, "_models.ManagedClusterAddonProfile"]] = None, + pod_identity_profile: Optional["_models.ManagedClusterPodIdentityProfile"] = None, + oidc_issuer_profile: Optional["_models.ManagedClusterOIDCIssuerProfile"] = None, node_resource_group: Optional[str] = None, enable_rbac: Optional[bool] = None, enable_pod_security_policy: Optional[bool] = None, enable_namespace_resources: Optional[bool] = None, - network_profile: Optional["ContainerServiceNetworkProfile"] = None, - aad_profile: Optional["ManagedClusterAADProfile"] = None, - auto_upgrade_profile: Optional["ManagedClusterAutoUpgradeProfile"] = None, - auto_scaler_profile: Optional["ManagedClusterPropertiesAutoScalerProfile"] = None, - api_server_access_profile: Optional["ManagedClusterAPIServerAccessProfile"] = None, + network_profile: Optional["_models.ContainerServiceNetworkProfile"] = None, + aad_profile: Optional["_models.ManagedClusterAADProfile"] = None, + auto_upgrade_profile: Optional["_models.ManagedClusterAutoUpgradeProfile"] = None, + auto_scaler_profile: Optional["_models.ManagedClusterPropertiesAutoScalerProfile"] = None, + api_server_access_profile: Optional["_models.ManagedClusterAPIServerAccessProfile"] = None, disk_encryption_set_id: Optional[str] = None, - identity_profile: Optional[Dict[str, "UserAssignedIdentity"]] = None, - private_link_resources: Optional[List["PrivateLinkResource"]] = None, + identity_profile: Optional[Dict[str, "_models.UserAssignedIdentity"]] = None, + private_link_resources: Optional[List["_models.PrivateLinkResource"]] = None, disable_local_accounts: Optional[bool] = None, - http_proxy_config: Optional["ManagedClusterHTTPProxyConfig"] = None, - security_profile: Optional["ManagedClusterSecurityProfile"] = None, - ingress_profile: Optional["ManagedClusterIngressProfile"] = None, - public_network_access: Optional[Union[str, "PublicNetworkAccess"]] = None, + http_proxy_config: Optional["_models.ManagedClusterHTTPProxyConfig"] = None, + security_profile: Optional["_models.ManagedClusterSecurityProfile"] = None, + ingress_profile: Optional["_models.ManagedClusterIngressProfile"] = None, + public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None, **kwargs ): """ @@ -2335,8 +2335,8 @@ def __init__( :keyword ingress_profile: Ingress profile for the managed cluster. :paramtype ingress_profile: ~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedClusterIngressProfile - :keyword public_network_access: Allow or deny public network access for AKS. Possible values - include: "Enabled", "Disabled". + :keyword public_network_access: Allow or deny public network access for AKS. Known values are: + "Enabled", "Disabled". :paramtype public_network_access: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.PublicNetworkAccess """ @@ -2657,16 +2657,16 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS - `_. Possible values - include: "Managed", "Ephemeral". + `_. Known values are: + "Managed", "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Possible values include: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.KubeletDiskType - :ivar workload_runtime: Determines the type of workload a node can run. Possible values - include: "OCIContainer", "WasmWasi". + :ivar workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer", "WasmWasi". :vartype workload_runtime: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.WorkloadRuntime :ivar message_of_the_day: A base64-encoded string which will be written to /etc/motd after @@ -2685,11 +2685,11 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.OSType - :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Possible values include: "Ubuntu", "CBLMariner". + :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known + values are: "Ubuntu", "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. :vartype max_count: int @@ -2698,16 +2698,15 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it - defaults to Delete. Possible values include: "Delete", "Deallocate". + defaults to Delete. Known values are: "Delete", "Deallocate". :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.ScaleDownMode - :ivar type: The type of Agent Pool. Possible values include: "VirtualMachineScaleSets", + :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Possible values include: "System", - "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". :vartype mode: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.AgentPoolMode :ivar orchestrator_version: Both patch version and are supported. When is specified, the latest supported patch version is chosen @@ -2749,12 +2748,12 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Possible values include: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Possible values include: "Delete", - "Deallocate". Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which @@ -2786,7 +2785,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.GPUInstanceProfile :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool @@ -2860,42 +2859,42 @@ def __init__( count: Optional[int] = None, vm_size: Optional[str] = None, os_disk_size_gb: Optional[int] = None, - os_disk_type: Optional[Union[str, "OSDiskType"]] = None, - kubelet_disk_type: Optional[Union[str, "KubeletDiskType"]] = None, - workload_runtime: Optional[Union[str, "WorkloadRuntime"]] = None, + os_disk_type: Optional[Union[str, "_models.OSDiskType"]] = None, + kubelet_disk_type: Optional[Union[str, "_models.KubeletDiskType"]] = None, + workload_runtime: Optional[Union[str, "_models.WorkloadRuntime"]] = None, message_of_the_day: Optional[str] = None, vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", - os_sku: Optional[Union[str, "OSSKU"]] = None, + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - scale_down_mode: Optional[Union[str, "ScaleDownMode"]] = None, - type: Optional[Union[str, "AgentPoolType"]] = None, - mode: Optional[Union[str, "AgentPoolMode"]] = None, + scale_down_mode: Optional[Union[str, "_models.ScaleDownMode"]] = None, + type: Optional[Union[str, "_models.AgentPoolType"]] = None, + mode: Optional[Union[str, "_models.AgentPoolMode"]] = None, orchestrator_version: Optional[str] = None, current_orchestrator_version: Optional[str] = None, - upgrade_settings: Optional["AgentPoolUpgradeSettings"] = None, - power_state: Optional["PowerState"] = None, + upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, + power_state: Optional["_models.PowerState"] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", spot_max_price: Optional[float] = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, proximity_placement_group_id: Optional[str] = None, - kubelet_config: Optional["KubeletConfig"] = None, - linux_os_config: Optional["LinuxOSConfig"] = None, + kubelet_config: Optional["_models.KubeletConfig"] = None, + linux_os_config: Optional["_models.LinuxOSConfig"] = None, enable_encryption_at_host: Optional[bool] = None, enable_ultra_ssd: Optional[bool] = None, enable_fips: Optional[bool] = None, - gpu_instance_profile: Optional[Union[str, "GPUInstanceProfile"]] = None, - creation_data: Optional["CreationData"] = None, + gpu_instance_profile: Optional[Union[str, "_models.GPUInstanceProfile"]] = None, + creation_data: Optional["_models.CreationData"] = None, capacity_reservation_group_id: Optional[str] = None, host_group_id: Optional[str] = None, **kwargs @@ -2916,16 +2915,16 @@ def __init__( :keyword os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS - `_. Possible values - include: "Managed", "Ephemeral". + `_. Known values are: + "Managed", "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Possible values include: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.KubeletDiskType - :keyword workload_runtime: Determines the type of workload a node can run. Possible values - include: "OCIContainer", "WasmWasi". + :keyword workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer", "WasmWasi". :paramtype workload_runtime: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.WorkloadRuntime :keyword message_of_the_day: A base64-encoded string which will be written to /etc/motd after @@ -2944,11 +2943,11 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.OSType :keyword os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Possible values include: "Ubuntu", "CBLMariner". + Known values are: "Ubuntu", "CBLMariner". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -2957,16 +2956,15 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, - it defaults to Delete. Possible values include: "Delete", "Deallocate". + it defaults to Delete. Known values are: "Delete", "Deallocate". :paramtype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.ScaleDownMode - :keyword type: The type of Agent Pool. Possible values include: "VirtualMachineScaleSets", + :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Possible values include: "System", - "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.AgentPoolMode :keyword orchestrator_version: Both patch version and are supported. When is specified, the latest supported patch version is chosen @@ -3004,12 +3002,12 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Possible values include: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Possible values include: "Delete", - "Deallocate". Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which @@ -3043,7 +3041,7 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.GPUInstanceProfile @@ -3127,16 +3125,16 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS - `_. Possible values - include: "Managed", "Ephemeral". + `_. Known values are: + "Managed", "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Possible values include: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.KubeletDiskType - :ivar workload_runtime: Determines the type of workload a node can run. Possible values - include: "OCIContainer", "WasmWasi". + :ivar workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer", "WasmWasi". :vartype workload_runtime: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.WorkloadRuntime :ivar message_of_the_day: A base64-encoded string which will be written to /etc/motd after @@ -3155,11 +3153,11 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.OSType - :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Possible values include: "Ubuntu", "CBLMariner". + :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known + values are: "Ubuntu", "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. :vartype max_count: int @@ -3168,16 +3166,15 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it - defaults to Delete. Possible values include: "Delete", "Deallocate". + defaults to Delete. Known values are: "Delete", "Deallocate". :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.ScaleDownMode - :ivar type: The type of Agent Pool. Possible values include: "VirtualMachineScaleSets", + :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Possible values include: "System", - "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". :vartype mode: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.AgentPoolMode :ivar orchestrator_version: Both patch version and are supported. When is specified, the latest supported patch version is chosen @@ -3219,12 +3216,12 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Possible values include: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Possible values include: "Delete", - "Deallocate". Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which @@ -3256,7 +3253,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.GPUInstanceProfile :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool @@ -3335,42 +3332,42 @@ def __init__( count: Optional[int] = None, vm_size: Optional[str] = None, os_disk_size_gb: Optional[int] = None, - os_disk_type: Optional[Union[str, "OSDiskType"]] = None, - kubelet_disk_type: Optional[Union[str, "KubeletDiskType"]] = None, - workload_runtime: Optional[Union[str, "WorkloadRuntime"]] = None, + os_disk_type: Optional[Union[str, "_models.OSDiskType"]] = None, + kubelet_disk_type: Optional[Union[str, "_models.KubeletDiskType"]] = None, + workload_runtime: Optional[Union[str, "_models.WorkloadRuntime"]] = None, message_of_the_day: Optional[str] = None, vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", - os_sku: Optional[Union[str, "OSSKU"]] = None, + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - scale_down_mode: Optional[Union[str, "ScaleDownMode"]] = None, - type: Optional[Union[str, "AgentPoolType"]] = None, - mode: Optional[Union[str, "AgentPoolMode"]] = None, + scale_down_mode: Optional[Union[str, "_models.ScaleDownMode"]] = None, + type: Optional[Union[str, "_models.AgentPoolType"]] = None, + mode: Optional[Union[str, "_models.AgentPoolMode"]] = None, orchestrator_version: Optional[str] = None, current_orchestrator_version: Optional[str] = None, - upgrade_settings: Optional["AgentPoolUpgradeSettings"] = None, - power_state: Optional["PowerState"] = None, + upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, + power_state: Optional["_models.PowerState"] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", spot_max_price: Optional[float] = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, proximity_placement_group_id: Optional[str] = None, - kubelet_config: Optional["KubeletConfig"] = None, - linux_os_config: Optional["LinuxOSConfig"] = None, + kubelet_config: Optional["_models.KubeletConfig"] = None, + linux_os_config: Optional["_models.LinuxOSConfig"] = None, enable_encryption_at_host: Optional[bool] = None, enable_ultra_ssd: Optional[bool] = None, enable_fips: Optional[bool] = None, - gpu_instance_profile: Optional[Union[str, "GPUInstanceProfile"]] = None, - creation_data: Optional["CreationData"] = None, + gpu_instance_profile: Optional[Union[str, "_models.GPUInstanceProfile"]] = None, + creation_data: Optional["_models.CreationData"] = None, capacity_reservation_group_id: Optional[str] = None, host_group_id: Optional[str] = None, **kwargs @@ -3391,16 +3388,16 @@ def __init__( :keyword os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS - `_. Possible values - include: "Managed", "Ephemeral". + `_. Known values are: + "Managed", "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Possible values include: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.KubeletDiskType - :keyword workload_runtime: Determines the type of workload a node can run. Possible values - include: "OCIContainer", "WasmWasi". + :keyword workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer", "WasmWasi". :paramtype workload_runtime: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.WorkloadRuntime :keyword message_of_the_day: A base64-encoded string which will be written to /etc/motd after @@ -3419,11 +3416,11 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.OSType :keyword os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Possible values include: "Ubuntu", "CBLMariner". + Known values are: "Ubuntu", "CBLMariner". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -3432,16 +3429,15 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, - it defaults to Delete. Possible values include: "Delete", "Deallocate". + it defaults to Delete. Known values are: "Delete", "Deallocate". :paramtype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.ScaleDownMode - :keyword type: The type of Agent Pool. Possible values include: "VirtualMachineScaleSets", + :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Possible values include: "System", - "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.AgentPoolMode :keyword orchestrator_version: Both patch version and are supported. When is specified, the latest supported patch version is chosen @@ -3479,12 +3475,12 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Possible values include: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Possible values include: "Delete", - "Deallocate". Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which @@ -3518,7 +3514,7 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.GPUInstanceProfile @@ -3611,8 +3607,8 @@ class ManagedClusterAutoUpgradeProfile(msrest.serialization.Model): """Auto upgrade profile for a managed cluster. :ivar upgrade_channel: For more information see `setting the AKS cluster auto-upgrade channel - `_. Possible - values include: "rapid", "stable", "patch", "node-image", "none". + `_. Known values + are: "rapid", "stable", "patch", "node-image", "none". :vartype upgrade_channel: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.UpgradeChannel """ @@ -3624,13 +3620,13 @@ class ManagedClusterAutoUpgradeProfile(msrest.serialization.Model): def __init__( self, *, - upgrade_channel: Optional[Union[str, "UpgradeChannel"]] = None, + upgrade_channel: Optional[Union[str, "_models.UpgradeChannel"]] = None, **kwargs ): """ :keyword upgrade_channel: For more information see `setting the AKS cluster auto-upgrade channel `_. - Possible values include: "rapid", "stable", "patch", "node-image", "none". + Known values are: "rapid", "stable", "patch", "node-image", "none". :paramtype upgrade_channel: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.UpgradeChannel """ @@ -3707,7 +3703,7 @@ class ManagedClusterIdentity(msrest.serialization.Model): components. :vartype tenant_id: str :ivar type: For more information see `use managed identities in AKS - `_. Possible values include: + `_. Known values are: "SystemAssigned", "UserAssigned", "None". :vartype type: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.ResourceIdentityType @@ -3732,13 +3728,13 @@ class ManagedClusterIdentity(msrest.serialization.Model): def __init__( self, *, - type: Optional[Union[str, "ResourceIdentityType"]] = None, - user_assigned_identities: Optional[Dict[str, "ManagedServiceIdentityUserAssignedIdentitiesValue"]] = None, + type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, + user_assigned_identities: Optional[Dict[str, "_models.ManagedServiceIdentityUserAssignedIdentitiesValue"]] = None, **kwargs ): """ :keyword type: For more information see `use managed identities in AKS - `_. Possible values include: + `_. Known values are: "SystemAssigned", "UserAssigned", "None". :paramtype type: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.ResourceIdentityType @@ -3769,7 +3765,7 @@ class ManagedClusterIngressProfile(msrest.serialization.Model): def __init__( self, *, - web_app_routing: Optional["ManagedClusterIngressProfileWebAppRouting"] = None, + web_app_routing: Optional["_models.ManagedClusterIngressProfileWebAppRouting"] = None, **kwargs ): """ @@ -3838,7 +3834,7 @@ class ManagedClusterListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["ManagedCluster"]] = None, + value: Optional[List["_models.ManagedCluster"]] = None, **kwargs ): """ @@ -3896,10 +3892,10 @@ class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): def __init__( self, *, - managed_outbound_i_ps: Optional["ManagedClusterLoadBalancerProfileManagedOutboundIPs"] = None, - outbound_ip_prefixes: Optional["ManagedClusterLoadBalancerProfileOutboundIPPrefixes"] = None, - outbound_i_ps: Optional["ManagedClusterLoadBalancerProfileOutboundIPs"] = None, - effective_outbound_i_ps: Optional[List["ResourceReference"]] = None, + managed_outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileManagedOutboundIPs"] = None, + outbound_ip_prefixes: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPPrefixes"] = None, + outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPs"] = None, + effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, allocated_outbound_ports: Optional[int] = 0, idle_timeout_in_minutes: Optional[int] = 30, enable_multiple_standard_load_balancers: Optional[bool] = None, @@ -4001,7 +3997,7 @@ class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.M def __init__( self, *, - public_ip_prefixes: Optional[List["ResourceReference"]] = None, + public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, **kwargs ): """ @@ -4028,7 +4024,7 @@ class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): def __init__( self, *, - public_i_ps: Optional[List["ResourceReference"]] = None, + public_i_ps: Optional[List["_models.ResourceReference"]] = None, **kwargs ): """ @@ -4099,8 +4095,8 @@ class ManagedClusterNATGatewayProfile(msrest.serialization.Model): def __init__( self, *, - managed_outbound_ip_profile: Optional["ManagedClusterManagedOutboundIPProfile"] = None, - effective_outbound_i_ps: Optional[List["ResourceReference"]] = None, + managed_outbound_ip_profile: Optional["_models.ManagedClusterManagedOutboundIPProfile"] = None, + effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, idle_timeout_in_minutes: Optional[int] = 4, **kwargs ): @@ -4173,8 +4169,8 @@ class ManagedClusterPodIdentity(msrest.serialization.Model): :vartype binding_selector: str :ivar identity: Required. The user assigned identity details. :vartype identity: ~azure.mgmt.containerservice.v2022_03_02_preview.models.UserAssignedIdentity - :ivar provisioning_state: The current provisioning state of the pod identity. Possible values - include: "Assigned", "Updating", "Deleting", "Failed". + :ivar provisioning_state: The current provisioning state of the pod identity. Known values are: + "Assigned", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedClusterPodIdentityProvisioningState :ivar provisioning_info: @@ -4204,7 +4200,7 @@ def __init__( *, name: str, namespace: str, - identity: "UserAssignedIdentity", + identity: "_models.UserAssignedIdentity", binding_selector: Optional[str] = None, **kwargs ): @@ -4306,8 +4302,8 @@ def __init__( *, enabled: Optional[bool] = None, allow_network_plugin_kubenet: Optional[bool] = None, - user_assigned_identities: Optional[List["ManagedClusterPodIdentity"]] = None, - user_assigned_identity_exceptions: Optional[List["ManagedClusterPodIdentityException"]] = None, + user_assigned_identities: Optional[List["_models.ManagedClusterPodIdentity"]] = None, + user_assigned_identity_exceptions: Optional[List["_models.ManagedClusterPodIdentityException"]] = None, **kwargs ): """ @@ -4348,7 +4344,7 @@ class ManagedClusterPodIdentityProvisioningError(msrest.serialization.Model): def __init__( self, *, - error: Optional["ManagedClusterPodIdentityProvisioningErrorBody"] = None, + error: Optional["_models.ManagedClusterPodIdentityProvisioningErrorBody"] = None, **kwargs ): """ @@ -4390,7 +4386,7 @@ def __init__( code: Optional[str] = None, message: Optional[str] = None, target: Optional[str] = None, - details: Optional[List["ManagedClusterPodIdentityProvisioningErrorBody"]] = None, + details: Optional[List["_models.ManagedClusterPodIdentityProvisioningErrorBody"]] = None, **kwargs ): """ @@ -4429,7 +4425,7 @@ class ManagedClusterPodIdentityProvisioningInfo(msrest.serialization.Model): def __init__( self, *, - error: Optional["ManagedClusterPodIdentityProvisioningError"] = None, + error: Optional["_models.ManagedClusterPodIdentityProvisioningError"] = None, **kwargs ): """ @@ -4450,8 +4446,8 @@ class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): :vartype kubernetes_version: str :ivar name: The Agent Pool name. :vartype name: str - :ivar os_type: Required. The operating system type. The default is Linux. Possible values - include: "Linux", "Windows". Default value: "Linux". + :ivar os_type: Required. The operating system type. The default is Linux. Known values are: + "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -4474,9 +4470,9 @@ def __init__( self, *, kubernetes_version: str, - os_type: Union[str, "OSType"] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", name: Optional[str] = None, - upgrades: Optional[List["ManagedClusterPoolUpgradeProfileUpgradesItem"]] = None, + upgrades: Optional[List["_models.ManagedClusterPoolUpgradeProfileUpgradesItem"]] = None, **kwargs ): """ @@ -4484,8 +4480,8 @@ def __init__( :paramtype kubernetes_version: str :keyword name: The Agent Pool name. :paramtype name: str - :keyword os_type: Required. The operating system type. The default is Linux. Possible values - include: "Linux", "Windows". Default value: "Linux". + :keyword os_type: Required. The operating system type. The default is Linux. Known values are: + "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: @@ -4537,8 +4533,7 @@ class ManagedClusterPropertiesAutoScalerProfile(msrest.serialization.Model): :vartype balance_similar_node_groups: str :ivar expander: If not specified, the default is 'random'. See `expanders `_ - for more information. Possible values include: "least-waste", "most-pods", "priority", - "random". + for more information. Known values are: "least-waste", "most-pods", "priority", "random". :vartype expander: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.Expander :ivar max_empty_bulk_delete: The default is 10. :vartype max_empty_bulk_delete: str @@ -4605,7 +4600,7 @@ def __init__( self, *, balance_similar_node_groups: Optional[str] = None, - expander: Optional[Union[str, "Expander"]] = None, + expander: Optional[Union[str, "_models.Expander"]] = None, max_empty_bulk_delete: Optional[str] = None, max_graceful_termination_sec: Optional[str] = None, max_node_provision_time: Optional[str] = None, @@ -4628,8 +4623,7 @@ def __init__( :paramtype balance_similar_node_groups: str :keyword expander: If not specified, the default is 'random'. See `expanders `_ - for more information. Possible values include: "least-waste", "most-pods", "priority", - "random". + for more information. Known values are: "least-waste", "most-pods", "priority", "random". :paramtype expander: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.Expander :keyword max_empty_bulk_delete: The default is 10. :paramtype max_empty_bulk_delete: str @@ -4723,7 +4717,7 @@ def __init__( self, *, kubernetes_version: Optional[str] = None, - sku: Optional["ManagedClusterSKU"] = None, + sku: Optional["_models.ManagedClusterSKU"] = None, enable_rbac: Optional[bool] = None, **kwargs ): @@ -4769,9 +4763,9 @@ class ManagedClusterSecurityProfile(msrest.serialization.Model): def __init__( self, *, - azure_defender: Optional["ManagedClusterSecurityProfileAzureDefender"] = None, - azure_key_vault_kms: Optional["AzureKeyVaultKms"] = None, - workload_identity: Optional["ManagedClusterSecurityProfileWorkloadIdentity"] = None, + azure_defender: Optional["_models.ManagedClusterSecurityProfileAzureDefender"] = None, + azure_key_vault_kms: Optional["_models.AzureKeyVaultKms"] = None, + workload_identity: Optional["_models.ManagedClusterSecurityProfileWorkloadIdentity"] = None, **kwargs ): """ @@ -4896,12 +4890,12 @@ def __init__( class ManagedClusterSKU(msrest.serialization.Model): """The SKU of a Managed Cluster. - :ivar name: The name of a managed cluster SKU. Possible values include: "Basic". + :ivar name: The name of a managed cluster SKU. Known values are: "Basic". :vartype name: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedClusterSKUName :ivar tier: If not specified, the default is 'Free'. See `uptime SLA - `_ for more details. Possible values include: - "Paid", "Free". + `_ for more details. Known values are: "Paid", + "Free". :vartype tier: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedClusterSKUTier """ @@ -4914,17 +4908,17 @@ class ManagedClusterSKU(msrest.serialization.Model): def __init__( self, *, - name: Optional[Union[str, "ManagedClusterSKUName"]] = None, - tier: Optional[Union[str, "ManagedClusterSKUTier"]] = None, + name: Optional[Union[str, "_models.ManagedClusterSKUName"]] = None, + tier: Optional[Union[str, "_models.ManagedClusterSKUTier"]] = None, **kwargs ): """ - :keyword name: The name of a managed cluster SKU. Possible values include: "Basic". + :keyword name: The name of a managed cluster SKU. Known values are: "Basic". :paramtype name: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedClusterSKUName :keyword tier: If not specified, the default is 'Free'. See `uptime SLA - `_ for more details. Possible values include: - "Paid", "Free". + `_ for more details. Known values are: "Paid", + "Free". :paramtype tier: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedClusterSKUTier """ @@ -4958,7 +4952,7 @@ class ManagedClusterSnapshot(TrackedResource): :ivar creation_data: CreationData to be used to specify the source resource ID to create this snapshot. :vartype creation_data: ~azure.mgmt.containerservice.v2022_03_02_preview.models.CreationData - :ivar snapshot_type: The type of a snapshot. The default is NodePool. Possible values include: + :ivar snapshot_type: The type of a snapshot. The default is NodePool. Known values are: "NodePool", "ManagedCluster". Default value: "NodePool". :vartype snapshot_type: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.SnapshotType @@ -4994,8 +4988,8 @@ def __init__( *, location: str, tags: Optional[Dict[str, str]] = None, - creation_data: Optional["CreationData"] = None, - snapshot_type: Optional[Union[str, "SnapshotType"]] = "NodePool", + creation_data: Optional["_models.CreationData"] = None, + snapshot_type: Optional[Union[str, "_models.SnapshotType"]] = "NodePool", **kwargs ): """ @@ -5006,8 +5000,8 @@ def __init__( :keyword creation_data: CreationData to be used to specify the source resource ID to create this snapshot. :paramtype creation_data: ~azure.mgmt.containerservice.v2022_03_02_preview.models.CreationData - :keyword snapshot_type: The type of a snapshot. The default is NodePool. Possible values - include: "NodePool", "ManagedCluster". Default value: "NodePool". + :keyword snapshot_type: The type of a snapshot. The default is NodePool. Known values are: + "NodePool", "ManagedCluster". Default value: "NodePool". :paramtype snapshot_type: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.SnapshotType """ @@ -5041,7 +5035,7 @@ class ManagedClusterSnapshotListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["ManagedClusterSnapshot"]] = None, + value: Optional[List["_models.ManagedClusterSnapshot"]] = None, **kwargs ): """ @@ -5077,9 +5071,9 @@ class ManagedClusterStorageProfile(msrest.serialization.Model): def __init__( self, *, - disk_csi_driver: Optional["ManagedClusterStorageProfileDiskCSIDriver"] = None, - file_csi_driver: Optional["ManagedClusterStorageProfileFileCSIDriver"] = None, - snapshot_controller: Optional["ManagedClusterStorageProfileSnapshotController"] = None, + disk_csi_driver: Optional["_models.ManagedClusterStorageProfileDiskCSIDriver"] = None, + file_csi_driver: Optional["_models.ManagedClusterStorageProfileFileCSIDriver"] = None, + snapshot_controller: Optional["_models.ManagedClusterStorageProfileSnapshotController"] = None, **kwargs ): """ @@ -5222,8 +5216,8 @@ class ManagedClusterUpgradeProfile(msrest.serialization.Model): def __init__( self, *, - control_plane_profile: "ManagedClusterPoolUpgradeProfile", - agent_pool_profiles: List["ManagedClusterPoolUpgradeProfile"], + control_plane_profile: "_models.ManagedClusterPoolUpgradeProfile", + agent_pool_profiles: List["_models.ManagedClusterPoolUpgradeProfile"], **kwargs ): """ @@ -5265,8 +5259,8 @@ class ManagedClusterWindowsProfile(msrest.serialization.Model): "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!". :vartype admin_password: str :ivar license_type: The license type to use for Windows VMs. See `Azure Hybrid User Benefits - `_ for more details. Possible values - include: "None", "Windows_Server". + `_ for more details. Known values are: + "None", "Windows_Server". :vartype license_type: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.LicenseType :ivar enable_csi_proxy: For more details on CSI proxy, see the `CSI proxy GitHub repo @@ -5294,9 +5288,9 @@ def __init__( *, admin_username: str, admin_password: Optional[str] = None, - license_type: Optional[Union[str, "LicenseType"]] = None, + license_type: Optional[Union[str, "_models.LicenseType"]] = None, enable_csi_proxy: Optional[bool] = None, - gmsa_profile: Optional["WindowsGmsaProfile"] = None, + gmsa_profile: Optional["_models.WindowsGmsaProfile"] = None, **kwargs ): """ @@ -5317,8 +5311,8 @@ def __init__( "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!". :paramtype admin_password: str :keyword license_type: The license type to use for Windows VMs. See `Azure Hybrid User Benefits - `_ for more details. Possible values - include: "None", "Windows_Server". + `_ for more details. Known values are: + "None", "Windows_Server". :paramtype license_type: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.LicenseType :keyword enable_csi_proxy: For more details on CSI proxy, see the `CSI proxy GitHub repo @@ -5371,19 +5365,19 @@ def __init__( class NetworkProfileForSnapshot(msrest.serialization.Model): """network profile for managed cluster snapshot, these properties are read only. - :ivar network_plugin: networkPlugin for managed cluster snapshot. Possible values include: - "azure", "kubenet", "none". Default value: "kubenet". + :ivar network_plugin: networkPlugin for managed cluster snapshot. Known values are: "azure", + "kubenet", "none". Default value: "kubenet". :vartype network_plugin: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.NetworkPlugin - :ivar network_policy: networkPolicy for managed cluster snapshot. Possible values include: - "calico", "azure". + :ivar network_policy: networkPolicy for managed cluster snapshot. Known values are: "calico", + "azure". :vartype network_policy: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.NetworkPolicy - :ivar network_mode: networkMode for managed cluster snapshot. Possible values include: - "transparent", "bridge". + :ivar network_mode: networkMode for managed cluster snapshot. Known values are: "transparent", + "bridge". :vartype network_mode: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.NetworkMode - :ivar load_balancer_sku: loadBalancerSku for managed cluster snapshot. Possible values include: + :ivar load_balancer_sku: loadBalancerSku for managed cluster snapshot. Known values are: "standard", "basic". :vartype load_balancer_sku: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.LoadBalancerSku @@ -5399,27 +5393,27 @@ class NetworkProfileForSnapshot(msrest.serialization.Model): def __init__( self, *, - network_plugin: Optional[Union[str, "NetworkPlugin"]] = "kubenet", - network_policy: Optional[Union[str, "NetworkPolicy"]] = None, - network_mode: Optional[Union[str, "NetworkMode"]] = None, - load_balancer_sku: Optional[Union[str, "LoadBalancerSku"]] = None, + network_plugin: Optional[Union[str, "_models.NetworkPlugin"]] = "kubenet", + network_policy: Optional[Union[str, "_models.NetworkPolicy"]] = None, + network_mode: Optional[Union[str, "_models.NetworkMode"]] = None, + load_balancer_sku: Optional[Union[str, "_models.LoadBalancerSku"]] = None, **kwargs ): """ - :keyword network_plugin: networkPlugin for managed cluster snapshot. Possible values include: - "azure", "kubenet", "none". Default value: "kubenet". + :keyword network_plugin: networkPlugin for managed cluster snapshot. Known values are: "azure", + "kubenet", "none". Default value: "kubenet". :paramtype network_plugin: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.NetworkPlugin - :keyword network_policy: networkPolicy for managed cluster snapshot. Possible values include: + :keyword network_policy: networkPolicy for managed cluster snapshot. Known values are: "calico", "azure". :paramtype network_policy: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.NetworkPolicy - :keyword network_mode: networkMode for managed cluster snapshot. Possible values include: + :keyword network_mode: networkMode for managed cluster snapshot. Known values are: "transparent", "bridge". :paramtype network_mode: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.NetworkMode - :keyword load_balancer_sku: loadBalancerSku for managed cluster snapshot. Possible values - include: "standard", "basic". + :keyword load_balancer_sku: loadBalancerSku for managed cluster snapshot. Known values are: + "standard", "basic". :paramtype load_balancer_sku: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.LoadBalancerSku """ @@ -5544,7 +5538,7 @@ class OSOptionProfile(msrest.serialization.Model): def __init__( self, *, - os_option_property_list: List["OSOptionProperty"], + os_option_property_list: List["_models.OSOptionProperty"], **kwargs ): """ @@ -5618,7 +5612,7 @@ def __init__( self, *, category: Optional[str] = None, - endpoints: Optional[List["EndpointDependency"]] = None, + endpoints: Optional[List["_models.EndpointDependency"]] = None, **kwargs ): """ @@ -5661,7 +5655,7 @@ class OutboundEnvironmentEndpointCollection(msrest.serialization.Model): def __init__( self, *, - value: List["OutboundEnvironmentEndpoint"], + value: List["_models.OutboundEnvironmentEndpoint"], **kwargs ): """ @@ -5677,8 +5671,8 @@ def __init__( class PowerState(msrest.serialization.Model): """Describes the Power State of the cluster. - :ivar code: Tells whether the cluster is Running or Stopped. Possible values include: - "Running", "Stopped". + :ivar code: Tells whether the cluster is Running or Stopped. Known values are: "Running", + "Stopped". :vartype code: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.Code """ @@ -5689,12 +5683,12 @@ class PowerState(msrest.serialization.Model): def __init__( self, *, - code: Optional[Union[str, "Code"]] = None, + code: Optional[Union[str, "_models.Code"]] = None, **kwargs ): """ - :keyword code: Tells whether the cluster is Running or Stopped. Possible values include: - "Running", "Stopped". + :keyword code: Tells whether the cluster is Running or Stopped. Known values are: "Running", + "Stopped". :paramtype code: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.Code """ super(PowerState, self).__init__(**kwargs) @@ -5737,7 +5731,7 @@ class PrivateEndpointConnection(msrest.serialization.Model): :vartype name: str :ivar type: The resource type. :vartype type: str - :ivar provisioning_state: The current provisioning state. Possible values include: "Succeeded", + :ivar provisioning_state: The current provisioning state. Known values are: "Succeeded", "Creating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.PrivateEndpointConnectionProvisioningState @@ -5769,8 +5763,8 @@ class PrivateEndpointConnection(msrest.serialization.Model): def __init__( self, *, - private_endpoint: Optional["PrivateEndpoint"] = None, - private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, + private_endpoint: Optional["_models.PrivateEndpoint"] = None, + private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionState"] = None, **kwargs ): """ @@ -5806,7 +5800,7 @@ class PrivateEndpointConnectionListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["PrivateEndpointConnection"]] = None, + value: Optional[List["_models.PrivateEndpointConnection"]] = None, **kwargs ): """ @@ -5897,7 +5891,7 @@ class PrivateLinkResourcesListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["PrivateLinkResource"]] = None, + value: Optional[List["_models.PrivateLinkResource"]] = None, **kwargs ): """ @@ -5912,7 +5906,7 @@ def __init__( class PrivateLinkServiceConnectionState(msrest.serialization.Model): """The state of a private link service connection. - :ivar status: The private link service connection status. Possible values include: "Pending", + :ivar status: The private link service connection status. Known values are: "Pending", "Approved", "Rejected", "Disconnected". :vartype status: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.ConnectionStatus @@ -5928,13 +5922,13 @@ class PrivateLinkServiceConnectionState(msrest.serialization.Model): def __init__( self, *, - status: Optional[Union[str, "ConnectionStatus"]] = None, + status: Optional[Union[str, "_models.ConnectionStatus"]] = None, description: Optional[str] = None, **kwargs ): """ - :keyword status: The private link service connection status. Possible values include: - "Pending", "Approved", "Rejected", "Disconnected". + :keyword status: The private link service connection status. Known values are: "Pending", + "Approved", "Rejected", "Disconnected". :paramtype status: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.ConnectionStatus :keyword description: The private link service connection description. @@ -6097,7 +6091,7 @@ class Snapshot(TrackedResource): :ivar creation_data: CreationData to be used to specify the source agent pool resource ID to create this snapshot. :vartype creation_data: ~azure.mgmt.containerservice.v2022_03_02_preview.models.CreationData - :ivar snapshot_type: The type of a snapshot. The default is NodePool. Possible values include: + :ivar snapshot_type: The type of a snapshot. The default is NodePool. Known values are: "NodePool", "ManagedCluster". Default value: "NodePool". :vartype snapshot_type: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.SnapshotType @@ -6105,11 +6099,11 @@ class Snapshot(TrackedResource): :vartype kubernetes_version: str :ivar node_image_version: The version of node image. :vartype node_image_version: str - :ivar os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.OSType - :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Possible values include: "Ubuntu", "CBLMariner". + :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known + values are: "Ubuntu", "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.OSSKU :ivar vm_size: The size of the VM. :vartype vm_size: str @@ -6153,8 +6147,8 @@ def __init__( *, location: str, tags: Optional[Dict[str, str]] = None, - creation_data: Optional["CreationData"] = None, - snapshot_type: Optional[Union[str, "SnapshotType"]] = "NodePool", + creation_data: Optional["_models.CreationData"] = None, + snapshot_type: Optional[Union[str, "_models.SnapshotType"]] = "NodePool", **kwargs ): """ @@ -6165,8 +6159,8 @@ def __init__( :keyword creation_data: CreationData to be used to specify the source agent pool resource ID to create this snapshot. :paramtype creation_data: ~azure.mgmt.containerservice.v2022_03_02_preview.models.CreationData - :keyword snapshot_type: The type of a snapshot. The default is NodePool. Possible values - include: "NodePool", "ManagedCluster". Default value: "NodePool". + :keyword snapshot_type: The type of a snapshot. The default is NodePool. Known values are: + "NodePool", "ManagedCluster". Default value: "NodePool". :paramtype snapshot_type: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.SnapshotType """ @@ -6204,7 +6198,7 @@ class SnapshotListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["Snapshot"]] = None, + value: Optional[List["_models.Snapshot"]] = None, **kwargs ): """ @@ -6435,7 +6429,7 @@ class SystemData(msrest.serialization.Model): :ivar created_by: The identity that created the resource. :vartype created_by: str - :ivar created_by_type: The type of identity that created the resource. Possible values include: + :ivar created_by_type: The type of identity that created the resource. Known values are: "User", "Application", "ManagedIdentity", "Key". :vartype created_by_type: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.CreatedByType @@ -6443,8 +6437,8 @@ class SystemData(msrest.serialization.Model): :vartype created_at: ~datetime.datetime :ivar last_modified_by: The identity that last modified the resource. :vartype last_modified_by: str - :ivar last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". + :ivar last_modified_by_type: The type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", "Key". :vartype last_modified_by_type: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.CreatedByType :ivar last_modified_at: The timestamp of resource last modification (UTC). @@ -6464,26 +6458,26 @@ def __init__( self, *, created_by: Optional[str] = None, - created_by_type: Optional[Union[str, "CreatedByType"]] = None, + created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, created_at: Optional[datetime.datetime] = None, last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[Union[str, "CreatedByType"]] = None, + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, last_modified_at: Optional[datetime.datetime] = None, **kwargs ): """ :keyword created_by: The identity that created the resource. :paramtype created_by: str - :keyword created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". + :keyword created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", "Key". :paramtype created_by_type: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.CreatedByType :keyword created_at: The timestamp of resource creation (UTC). :paramtype created_at: ~datetime.datetime :keyword last_modified_by: The identity that last modified the resource. :paramtype last_modified_by: str - :keyword last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". + :keyword last_modified_by_type: The type of identity that last modified the resource. Known + values are: "User", "Application", "ManagedIdentity", "Key". :paramtype last_modified_by_type: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.CreatedByType :keyword last_modified_at: The timestamp of resource last modification (UTC). @@ -6526,8 +6520,8 @@ def __init__( class TimeInWeek(msrest.serialization.Model): """Time in a week. - :ivar day: The day of the week. Possible values include: "Sunday", "Monday", "Tuesday", - "Wednesday", "Thursday", "Friday", "Saturday". + :ivar day: The day of the week. Known values are: "Sunday", "Monday", "Tuesday", "Wednesday", + "Thursday", "Friday", "Saturday". :vartype day: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.WeekDay :ivar hour_slots: Each integer hour represents a time range beginning at 0m after the hour ending at the next hour (non-inclusive). 0 corresponds to 00:00 UTC, 23 corresponds to 23:00 @@ -6543,12 +6537,12 @@ class TimeInWeek(msrest.serialization.Model): def __init__( self, *, - day: Optional[Union[str, "WeekDay"]] = None, + day: Optional[Union[str, "_models.WeekDay"]] = None, hour_slots: Optional[List[int]] = None, **kwargs ): """ - :keyword day: The day of the week. Possible values include: "Sunday", "Monday", "Tuesday", + :keyword day: The day of the week. Known values are: "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday". :paramtype day: str or ~azure.mgmt.containerservice.v2022_03_02_preview.models.WeekDay :keyword hour_slots: Each integer hour represents a time range beginning at 0m after the hour diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/models/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/models/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/operations/__init__.py index 78e2791463ed..d3b41c8a72b0 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/operations/__init__.py @@ -16,6 +16,9 @@ from ._snapshots_operations import SnapshotsOperations from ._managed_cluster_snapshots_operations import ManagedClusterSnapshotsOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'Operations', 'ManagedClustersOperations', @@ -27,3 +30,5 @@ 'SnapshotsOperations', 'ManagedClusterSnapshotsOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/operations/_agent_pools_operations.py index 973c1ae00bf8..649b1e6c1236 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/operations/_agent_pools_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -35,9 +35,12 @@ def build_list_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools") # pylint: disable=line-too-long path_format_arguments = { @@ -49,18 +52,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -72,9 +73,12 @@ def build_get_request( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -87,18 +91,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -109,14 +111,17 @@ def build_create_or_update_request_initial( resource_name: str, agent_pool_name: str, *, - json: JSONType = None, + json: Optional[_models.AgentPool] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -129,20 +134,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -158,9 +161,12 @@ def build_delete_request_initial( ignore_pod_disruption_budget: Optional[bool] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -173,20 +179,18 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if ignore_pod_disruption_budget is not None: - _query_parameters['ignore-pod-disruption-budget'] = _SERIALIZER.query("ignore_pod_disruption_budget", ignore_pod_disruption_budget, 'bool') + _params['ignore-pod-disruption-budget'] = _SERIALIZER.query("ignore_pod_disruption_budget", ignore_pod_disruption_budget, 'bool') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -198,9 +202,12 @@ def build_get_upgrade_profile_request( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default") # pylint: disable=line-too-long path_format_arguments = { @@ -213,18 +220,16 @@ def build_get_upgrade_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -235,9 +240,12 @@ def build_get_available_agent_pool_versions_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions") # pylint: disable=line-too-long path_format_arguments = { @@ -249,18 +257,16 @@ def build_get_available_agent_pool_versions_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -272,9 +278,12 @@ def build_upgrade_node_image_version_request_initial( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion") # pylint: disable=line-too-long path_format_arguments = { @@ -287,42 +296,38 @@ def build_upgrade_node_image_version_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class AgentPoolsOperations(object): - """AgentPoolsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class AgentPoolsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_03_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_03_02_preview.ContainerServiceClient`'s + :attr:`agent_pools` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -330,7 +335,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Iterable["_models.AgentPoolListResult"]: + ) -> Iterable[_models.AgentPoolListResult]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. @@ -345,13 +350,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_03_02_preview.models.AgentPoolListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -361,9 +369,11 @@ def prepare_request(next_link=None): resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -373,9 +383,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -415,7 +427,7 @@ def get( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPool": + ) -> _models.AgentPool: """Gets the specified managed cluster agent pool. Gets the specified managed cluster agent pool. @@ -431,13 +443,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.AgentPool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] request = build_get_request( @@ -447,11 +462,13 @@ def get( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -477,17 +494,20 @@ def _create_or_update_initial( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> "_models.AgentPool": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] + ) -> _models.AgentPool: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-03-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] _json = self._serialize.body(parameters, 'AgentPool') @@ -500,11 +520,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -535,9 +557,9 @@ def begin_create_or_update( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> LROPoller["_models.AgentPool"]: + ) -> LROPoller[_models.AgentPool]: """Creates or updates an agent pool in the specified managed cluster. Creates or updates an agent pool in the specified managed cluster. @@ -563,17 +585,20 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_03_02_preview.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, @@ -581,20 +606,27 @@ def begin_create_or_update( 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): - response = pipeline_response.http_response deserialized = self._deserialize('AgentPool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -615,13 +647,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements ignore_pod_disruption_budget: Optional[bool] = None, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -632,11 +667,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements api_version=api_version, ignore_pod_disruption_budget=ignore_pod_disruption_budget, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -687,22 +724,27 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, ignore_pod_disruption_budget=ignore_pod_disruption_budget, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -712,8 +754,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -733,7 +781,7 @@ def get_upgrade_profile( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPoolUpgradeProfile": + ) -> _models.AgentPoolUpgradeProfile: """Gets the upgrade profile for an agent pool. Gets the upgrade profile for an agent pool. @@ -749,13 +797,16 @@ def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.AgentPoolUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] request = build_get_upgrade_profile_request( @@ -765,11 +816,13 @@ def get_upgrade_profile( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -796,7 +849,7 @@ def get_available_agent_pool_versions( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.AgentPoolAvailableVersions": + ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported Kubernetes versions for the specified agent pool. See `supported Kubernetes versions @@ -812,13 +865,16 @@ def get_available_agent_pool_versions( :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.AgentPoolAvailableVersions :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolAvailableVersions"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] request = build_get_available_agent_pool_versions_request( @@ -827,11 +883,13 @@ def get_available_agent_pool_versions( resource_name=resource_name, api_version=api_version, template_url=self.get_available_agent_pool_versions.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -858,14 +916,17 @@ def _upgrade_node_image_version_initial( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> Optional["_models.AgentPool"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.AgentPool"]] + ) -> Optional[_models.AgentPool]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] request = build_upgrade_node_image_version_request_initial( @@ -875,11 +936,13 @@ def _upgrade_node_image_version_initial( agent_pool_name=agent_pool_name, api_version=api_version, template_url=self._upgrade_node_image_version_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -912,7 +975,7 @@ def begin_upgrade_node_image_version( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> LROPoller["_models.AgentPool"]: + ) -> LROPoller[_models.AgentPool]: """Upgrades the node image version of an agent pool to the latest. Upgrading the node image version of an agent pool applies the newest OS and runtime updates to @@ -938,21 +1001,26 @@ def begin_upgrade_node_image_version( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_03_02_preview.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._upgrade_node_image_version_initial( + raw_result = self._upgrade_node_image_version_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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) @@ -968,8 +1036,14 @@ def get_long_running_output(pipeline_response): return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/operations/_maintenance_configurations_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/operations/_maintenance_configurations_operations.py index 0fd526608494..d3ecfd996e2c 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/operations/_maintenance_configurations_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/operations/_maintenance_configurations_operations.py @@ -16,12 +16,12 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -33,9 +33,12 @@ def build_list_by_managed_cluster_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations") # pylint: disable=line-too-long path_format_arguments = { @@ -47,18 +50,16 @@ def build_list_by_managed_cluster_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -70,9 +71,12 @@ def build_get_request( config_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long path_format_arguments = { @@ -85,18 +89,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -107,14 +109,17 @@ def build_create_or_update_request( resource_name: str, config_name: str, *, - json: JSONType = None, + json: Optional[_models.MaintenanceConfiguration] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long path_format_arguments = { @@ -127,20 +132,18 @@ def build_create_or_update_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -154,9 +157,12 @@ def build_delete_request( config_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long path_format_arguments = { @@ -169,42 +175,38 @@ def build_delete_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class MaintenanceConfigurationsOperations(object): - """MaintenanceConfigurationsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class MaintenanceConfigurationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_03_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_03_02_preview.ContainerServiceClient`'s + :attr:`maintenance_configurations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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_by_managed_cluster( @@ -212,7 +214,7 @@ def list_by_managed_cluster( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Iterable["_models.MaintenanceConfigurationListResult"]: + ) -> Iterable[_models.MaintenanceConfigurationListResult]: """Gets a list of maintenance configurations in the specified managed cluster. Gets a list of maintenance configurations in the specified managed cluster. @@ -228,13 +230,16 @@ def list_by_managed_cluster( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_03_02_preview.models.MaintenanceConfigurationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfigurationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfigurationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -244,9 +249,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=self.list_by_managed_cluster.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -256,9 +263,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -298,7 +307,7 @@ def get( resource_name: str, config_name: str, **kwargs: Any - ) -> "_models.MaintenanceConfiguration": + ) -> _models.MaintenanceConfiguration: """Gets the specified maintenance configuration of a managed cluster. Gets the specified maintenance configuration of a managed cluster. @@ -314,13 +323,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.MaintenanceConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfiguration"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] request = build_get_request( @@ -330,11 +342,13 @@ def get( config_name=config_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -361,9 +375,9 @@ def create_or_update( resource_group_name: str, resource_name: str, config_name: str, - parameters: "_models.MaintenanceConfiguration", + parameters: _models.MaintenanceConfiguration, **kwargs: Any - ) -> "_models.MaintenanceConfiguration": + ) -> _models.MaintenanceConfiguration: """Creates or updates a maintenance configuration in the specified managed cluster. Creates or updates a maintenance configuration in the specified managed cluster. @@ -382,14 +396,17 @@ def create_or_update( :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.MaintenanceConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfiguration"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-03-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] _json = self._serialize.body(parameters, 'MaintenanceConfiguration') @@ -402,11 +419,13 @@ def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -450,13 +469,16 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -466,11 +488,13 @@ def delete( # pylint: disable=inconsistent-return-statements config_name=config_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/operations/_managed_cluster_snapshots_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/operations/_managed_cluster_snapshots_operations.py index 1abc45b5f22b..aa072a65db36 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/operations/_managed_cluster_snapshots_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/operations/_managed_cluster_snapshots_operations.py @@ -16,12 +16,12 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -31,9 +31,12 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedclustersnapshots") # pylint: disable=line-too-long path_format_arguments = { @@ -43,18 +46,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -64,9 +65,12 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots") # pylint: disable=line-too-long path_format_arguments = { @@ -77,18 +81,16 @@ def build_list_by_resource_group_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -99,9 +101,12 @@ def build_get_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -113,18 +118,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -134,14 +137,17 @@ def build_create_or_update_request( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedClusterSnapshot] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -153,20 +159,18 @@ def build_create_or_update_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -178,14 +182,17 @@ def build_update_tags_request( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.TagsObject] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -197,20 +204,18 @@ def build_update_tags_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -223,9 +228,12 @@ def build_delete_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -237,48 +245,44 @@ def build_delete_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class ManagedClusterSnapshotsOperations(object): - """ManagedClusterSnapshotsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ManagedClusterSnapshotsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_03_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_03_02_preview.ContainerServiceClient`'s + :attr:`managed_cluster_snapshots` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> Iterable["_models.ManagedClusterSnapshotListResult"]: + ) -> Iterable[_models.ManagedClusterSnapshotListResult]: """Gets a list of managed cluster snapshots in the specified subscription. Gets a list of managed cluster snapshots in the specified subscription. @@ -290,13 +294,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedClusterSnapshotListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshotListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterSnapshotListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -304,9 +311,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -314,9 +323,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -354,7 +365,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.ManagedClusterSnapshotListResult"]: + ) -> Iterable[_models.ManagedClusterSnapshotListResult]: """Lists managed cluster snapshots in the specified subscription and resource group. Lists managed cluster snapshots in the specified subscription and resource group. @@ -368,13 +379,16 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedClusterSnapshotListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshotListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterSnapshotListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -383,9 +397,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -394,9 +410,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -435,7 +453,7 @@ def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedClusterSnapshot": + ) -> _models.ManagedClusterSnapshot: """Gets a managed cluster snapshot. Gets a managed cluster snapshot. @@ -449,13 +467,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedClusterSnapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterSnapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshot] request = build_get_request( @@ -464,11 +485,13 @@ def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -494,9 +517,9 @@ def create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterSnapshot", + parameters: _models.ManagedClusterSnapshot, **kwargs: Any - ) -> "_models.ManagedClusterSnapshot": + ) -> _models.ManagedClusterSnapshot: """Creates or updates a managed cluster snapshot. Creates or updates a managed cluster snapshot. @@ -513,14 +536,17 @@ def create_or_update( :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedClusterSnapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterSnapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-03-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshot] _json = self._serialize.body(parameters, 'ManagedClusterSnapshot') @@ -532,11 +558,13 @@ def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -566,9 +594,9 @@ def update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.ManagedClusterSnapshot": + ) -> _models.ManagedClusterSnapshot: """Updates tags on a managed cluster snapshot. Updates tags on a managed cluster snapshot. @@ -584,14 +612,17 @@ def update_tags( :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedClusterSnapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterSnapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshot] _json = self._serialize.body(parameters, 'TagsObject') @@ -603,11 +634,13 @@ def update_tags( content_type=content_type, json=_json, template_url=self.update_tags.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -648,13 +681,16 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -663,11 +699,13 @@ def delete( # pylint: disable=inconsistent-return-statements resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/operations/_managed_clusters_operations.py index b56464d42e45..f721f78a7e50 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/operations/_managed_clusters_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -36,9 +36,12 @@ def build_get_os_options_request( resource_type: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default") # pylint: disable=line-too-long path_format_arguments = { @@ -49,20 +52,18 @@ def build_get_os_options_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if resource_type is not None: - _query_parameters['resource-type'] = _SERIALIZER.query("resource_type", resource_type, 'str') + _params['resource-type'] = _SERIALIZER.query("resource_type", resource_type, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -71,9 +72,12 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters") path_format_arguments = { @@ -83,18 +87,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -104,9 +106,12 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters") # pylint: disable=line-too-long path_format_arguments = { @@ -117,18 +122,16 @@ def build_list_by_resource_group_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -139,9 +142,12 @@ def build_get_upgrade_profile_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default") # pylint: disable=line-too-long path_format_arguments = { @@ -153,18 +159,16 @@ def build_get_upgrade_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -176,9 +180,12 @@ def build_get_access_profile_request( role_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -191,18 +198,16 @@ def build_get_access_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -215,9 +220,12 @@ def build_list_cluster_admin_credentials_request( server_fqdn: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -229,20 +237,18 @@ def build_list_cluster_admin_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if server_fqdn is not None: - _query_parameters['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -256,9 +262,12 @@ def build_list_cluster_user_credentials_request( format: Optional[Union[str, "_models.Format"]] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -270,22 +279,20 @@ def build_list_cluster_user_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if server_fqdn is not None: - _query_parameters['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') if format is not None: - _query_parameters['format'] = _SERIALIZER.query("format", format, 'str') + _params['format'] = _SERIALIZER.query("format", format, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -298,9 +305,12 @@ def build_list_cluster_monitoring_user_credentials_request( server_fqdn: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -312,20 +322,18 @@ def build_list_cluster_monitoring_user_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if server_fqdn is not None: - _query_parameters['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -336,9 +344,12 @@ def build_get_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -350,18 +361,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -371,14 +380,17 @@ def build_create_or_update_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedCluster] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -390,20 +402,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -415,14 +425,17 @@ def build_update_tags_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.TagsObject] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -434,20 +447,18 @@ def build_update_tags_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -462,9 +473,12 @@ def build_delete_request_initial( ignore_pod_disruption_budget: Optional[bool] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -476,20 +490,18 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if ignore_pod_disruption_budget is not None: - _query_parameters['ignore-pod-disruption-budget'] = _SERIALIZER.query("ignore_pod_disruption_budget", ignore_pod_disruption_budget, 'bool') + _params['ignore-pod-disruption-budget'] = _SERIALIZER.query("ignore_pod_disruption_budget", ignore_pod_disruption_budget, 'bool') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -499,14 +511,17 @@ def build_reset_service_principal_profile_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedClusterServicePrincipalProfile] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile") # pylint: disable=line-too-long path_format_arguments = { @@ -518,20 +533,18 @@ def build_reset_service_principal_profile_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -543,14 +556,17 @@ def build_reset_aad_profile_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedClusterAADProfile] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile") # pylint: disable=line-too-long path_format_arguments = { @@ -562,20 +578,18 @@ def build_reset_aad_profile_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -588,9 +602,12 @@ def build_rotate_cluster_certificates_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates") # pylint: disable=line-too-long path_format_arguments = { @@ -602,18 +619,16 @@ def build_rotate_cluster_certificates_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -624,9 +639,12 @@ def build_rotate_service_account_signing_keys_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateServiceAccountSigningKeys") # pylint: disable=line-too-long path_format_arguments = { @@ -638,18 +656,16 @@ def build_rotate_service_account_signing_keys_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -660,9 +676,12 @@ def build_stop_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop") # pylint: disable=line-too-long path_format_arguments = { @@ -674,18 +693,16 @@ def build_stop_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -696,9 +713,12 @@ def build_start_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start") # pylint: disable=line-too-long path_format_arguments = { @@ -710,18 +730,16 @@ def build_start_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -731,14 +749,17 @@ def build_run_command_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.RunCommandRequest] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand") # pylint: disable=line-too-long path_format_arguments = { @@ -750,20 +771,18 @@ def build_run_command_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -777,9 +796,12 @@ def build_get_command_result_request( command_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}") # pylint: disable=line-too-long path_format_arguments = { @@ -792,18 +814,16 @@ def build_get_command_result_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -814,9 +834,12 @@ def build_list_outbound_network_dependencies_endpoints_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints") # pylint: disable=line-too-long path_format_arguments = { @@ -828,42 +851,38 @@ def build_list_outbound_network_dependencies_endpoints_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class ManagedClustersOperations(object): # pylint: disable=too-many-public-methods - """ManagedClustersOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ManagedClustersOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_03_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_03_02_preview.ContainerServiceClient`'s + :attr:`managed_clusters` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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_os_options( @@ -871,7 +890,7 @@ def get_os_options( location: str, resource_type: Optional[str] = None, **kwargs: Any - ) -> "_models.OSOptionProfile": + ) -> _models.OSOptionProfile: """Gets supported OS options in the specified subscription. Gets supported OS options in the specified subscription. @@ -886,13 +905,16 @@ def get_os_options( :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.OSOptionProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OSOptionProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OSOptionProfile] request = build_get_os_options_request( @@ -901,11 +923,13 @@ def get_os_options( api_version=api_version, resource_type=resource_type, template_url=self.get_os_options.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -930,7 +954,7 @@ def get_os_options( def list( self, **kwargs: Any - ) -> Iterable["_models.ManagedClusterListResult"]: + ) -> Iterable[_models.ManagedClusterListResult]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. @@ -942,13 +966,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -956,9 +983,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -966,9 +995,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -1006,7 +1037,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.ManagedClusterListResult"]: + ) -> Iterable[_models.ManagedClusterListResult]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. @@ -1020,13 +1051,16 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -1035,9 +1069,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -1046,9 +1082,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -1087,7 +1125,7 @@ def get_upgrade_profile( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedClusterUpgradeProfile": + ) -> _models.ManagedClusterUpgradeProfile: """Gets the upgrade profile of a managed cluster. Gets the upgrade profile of a managed cluster. @@ -1101,13 +1139,16 @@ def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedClusterUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] request = build_get_upgrade_profile_request( @@ -1116,11 +1157,13 @@ def get_upgrade_profile( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1148,7 +1191,7 @@ def get_access_profile( resource_name: str, role_name: str, **kwargs: Any - ) -> "_models.ManagedClusterAccessProfile": + ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. **WARNING**\ : This API will be deprecated. Instead use `ListClusterUserCredentials @@ -1167,13 +1210,16 @@ def get_access_profile( :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedClusterAccessProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterAccessProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] request = build_get_access_profile_request( @@ -1183,11 +1229,13 @@ def get_access_profile( role_name=role_name, api_version=api_version, template_url=self.get_access_profile.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1215,7 +1263,7 @@ def list_cluster_admin_credentials( resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Lists the admin credentials of a managed cluster. Lists the admin credentials of a managed cluster. @@ -1231,13 +1279,16 @@ def list_cluster_admin_credentials( :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_admin_credentials_request( @@ -1247,11 +1298,13 @@ def list_cluster_admin_credentials( api_version=api_version, server_fqdn=server_fqdn, template_url=self.list_cluster_admin_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1280,7 +1333,7 @@ def list_cluster_user_credentials( server_fqdn: Optional[str] = None, format: Optional[Union[str, "_models.Format"]] = None, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Lists the user credentials of a managed cluster. Lists the user credentials of a managed cluster. @@ -1300,13 +1353,16 @@ def list_cluster_user_credentials( :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_user_credentials_request( @@ -1317,11 +1373,13 @@ def list_cluster_user_credentials( server_fqdn=server_fqdn, format=format, template_url=self.list_cluster_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1349,7 +1407,7 @@ def list_cluster_monitoring_user_credentials( resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Lists the cluster monitoring user credentials of a managed cluster. Lists the cluster monitoring user credentials of a managed cluster. @@ -1365,13 +1423,16 @@ def list_cluster_monitoring_user_credentials( :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_monitoring_user_credentials_request( @@ -1381,11 +1442,13 @@ def list_cluster_monitoring_user_credentials( api_version=api_version, server_fqdn=server_fqdn, template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1412,7 +1475,7 @@ def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedCluster": + ) -> _models.ManagedCluster: """Gets a managed cluster. Gets a managed cluster. @@ -1426,13 +1489,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedCluster :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] request = build_get_request( @@ -1441,11 +1507,13 @@ def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1470,17 +1538,20 @@ def _create_or_update_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'ManagedCluster') @@ -1492,11 +1563,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1526,9 +1599,9 @@ def begin_create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> LROPoller["_models.ManagedCluster"]: + ) -> LROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. Creates or updates a managed cluster. @@ -1553,37 +1626,47 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1600,17 +1683,20 @@ def _update_tags_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'TagsObject') @@ -1622,11 +1708,13 @@ def _update_tags_initial( content_type=content_type, json=_json, template_url=self._update_tags_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1652,9 +1740,9 @@ def begin_update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> LROPoller["_models.ManagedCluster"]: + ) -> LROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates tags on a managed cluster. @@ -1679,37 +1767,47 @@ def begin_update_tags( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_03_02_preview.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._update_tags_initial( + raw_result = self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1729,13 +1827,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements ignore_pod_disruption_budget: Optional[bool] = None, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -1745,11 +1846,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements api_version=api_version, ignore_pod_disruption_budget=ignore_pod_disruption_budget, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1797,21 +1900,26 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, ignore_pod_disruption_budget=ignore_pod_disruption_budget, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1821,8 +1929,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1839,17 +1953,20 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') @@ -1861,11 +1978,13 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re content_type=content_type, json=_json, template_url=self._reset_service_principal_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1887,7 +2006,7 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> LROPoller[None]: """Reset the Service Principal Profile of a managed cluster. @@ -1913,23 +2032,28 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._reset_service_principal_profile_initial( + raw_result = self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1939,8 +2063,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1957,17 +2087,20 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') @@ -1979,11 +2112,13 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement content_type=content_type, json=_json, template_url=self._reset_aad_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2005,7 +2140,7 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> LROPoller[None]: """Reset the AAD Profile of a managed cluster. @@ -2031,23 +2166,28 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._reset_aad_profile_initial( + raw_result = self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -2057,8 +2197,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2077,13 +2223,16 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_rotate_cluster_certificates_request_initial( @@ -2092,11 +2241,13 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return resource_name=resource_name, api_version=api_version, template_url=self._rotate_cluster_certificates_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2141,20 +2292,25 @@ def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-st :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._rotate_cluster_certificates_initial( + raw_result = self._rotate_cluster_certificates_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) @@ -2164,8 +2320,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2184,13 +2346,16 @@ def _rotate_service_account_signing_keys_initial( # pylint: disable=inconsisten resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_rotate_service_account_signing_keys_request_initial( @@ -2199,11 +2364,13 @@ def _rotate_service_account_signing_keys_initial( # pylint: disable=inconsisten resource_name=resource_name, api_version=api_version, template_url=self._rotate_service_account_signing_keys_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2247,20 +2414,25 @@ def begin_rotate_service_account_signing_keys( # pylint: disable=inconsistent-r :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._rotate_service_account_signing_keys_initial( + raw_result = self._rotate_service_account_signing_keys_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) @@ -2270,8 +2442,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2290,13 +2468,16 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_stop_request_initial( @@ -2305,11 +2486,13 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_name, api_version=api_version, template_url=self._stop_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2357,20 +2540,25 @@ def begin_stop( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._stop_initial( + raw_result = self._stop_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) @@ -2380,8 +2568,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2400,13 +2594,16 @@ def _start_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_start_request_initial( @@ -2415,11 +2612,13 @@ def _start_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_name, api_version=api_version, template_url=self._start_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2464,20 +2663,25 @@ def begin_start( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._start_initial( + raw_result = self._start_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) @@ -2487,8 +2691,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2505,17 +2715,20 @@ def _run_command_initial( self, resource_group_name: str, resource_name: str, - request_payload: "_models.RunCommandRequest", + request_payload: _models.RunCommandRequest, **kwargs: Any - ) -> Optional["_models.RunCommandResult"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RunCommandResult"]] + ) -> Optional[_models.RunCommandResult]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-03-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] _json = self._serialize.body(request_payload, 'RunCommandRequest') @@ -2527,11 +2740,13 @@ def _run_command_initial( content_type=content_type, json=_json, template_url=self._run_command_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2559,9 +2774,9 @@ def begin_run_command( self, resource_group_name: str, resource_name: str, - request_payload: "_models.RunCommandRequest", + request_payload: _models.RunCommandRequest, **kwargs: Any - ) -> LROPoller["_models.RunCommandResult"]: + ) -> LROPoller[_models.RunCommandResult]: """Submits a command to run against the Managed Cluster. AKS will create a pod to run the command. This is primarily useful for private clusters. For @@ -2589,37 +2804,47 @@ def begin_run_command( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_03_02_preview.models.RunCommandResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.RunCommandResult] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._run_command_initial( + raw_result = self._run_command_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, request_payload=request_payload, 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): - response = pipeline_response.http_response deserialized = self._deserialize('RunCommandResult', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2639,7 +2864,7 @@ def get_command_result( resource_name: str, command_id: str, **kwargs: Any - ) -> Optional["_models.RunCommandResult"]: + ) -> Optional[_models.RunCommandResult]: """Gets the results of a command which has been run on the Managed Cluster. Gets the results of a command which has been run on the Managed Cluster. @@ -2655,13 +2880,16 @@ def get_command_result( :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.RunCommandResult or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RunCommandResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] request = build_get_command_result_request( @@ -2671,11 +2899,13 @@ def get_command_result( command_id=command_id, api_version=api_version, template_url=self.get_command_result.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2704,7 +2934,7 @@ def list_outbound_network_dependencies_endpoints( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Iterable["_models.OutboundEnvironmentEndpointCollection"]: + ) -> Iterable[_models.OutboundEnvironmentEndpointCollection]: """Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. @@ -2722,13 +2952,16 @@ def list_outbound_network_dependencies_endpoints( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_03_02_preview.models.OutboundEnvironmentEndpointCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OutboundEnvironmentEndpointCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -2738,9 +2971,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=self.list_outbound_network_dependencies_endpoints.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -2750,9 +2985,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/operations/_operations.py index 1507ed4d4261..56b23d784276 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/operations/_operations.py @@ -16,6 +16,7 @@ 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 @@ -29,55 +30,54 @@ def build_list_request( **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.ContainerService/operations") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class Operations(object): - """Operations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_03_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_03_02_preview.ContainerServiceClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> Iterable["_models.OperationListResult"]: + ) -> Iterable[_models.OperationListResult]: """Gets a list of operations. Gets a list of operations. @@ -88,31 +88,38 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_03_02_preview.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/operations/_private_endpoint_connections_operations.py index ad0e0a9dd3fc..de8d0937ecab 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/operations/_private_endpoint_connections_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast from msrest import Serializer @@ -16,13 +16,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -34,9 +34,12 @@ def build_list_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections") # pylint: disable=line-too-long path_format_arguments = { @@ -48,18 +51,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -71,9 +72,12 @@ def build_get_request( private_endpoint_connection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -86,18 +90,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -108,14 +110,17 @@ def build_update_request( resource_name: str, private_endpoint_connection_name: str, *, - json: JSONType = None, + json: Optional[_models.PrivateEndpointConnection] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -128,20 +133,18 @@ def build_update_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -155,9 +158,12 @@ def build_delete_request_initial( private_endpoint_connection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -170,42 +176,38 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class PrivateEndpointConnectionsOperations(object): - """PrivateEndpointConnectionsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class PrivateEndpointConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_03_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_03_02_preview.ContainerServiceClient`'s + :attr:`private_endpoint_connections` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -213,7 +215,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnectionListResult": + ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. To learn more about private clusters, see: @@ -229,13 +231,16 @@ def list( ~azure.mgmt.containerservice.v2022_03_02_preview.models.PrivateEndpointConnectionListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] request = build_list_request( @@ -244,11 +249,13 @@ def list( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -276,7 +283,7 @@ def get( resource_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Gets the specified private endpoint connection. To learn more about private clusters, see: @@ -293,13 +300,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] request = build_get_request( @@ -309,11 +319,13 @@ def get( private_endpoint_connection_name=private_endpoint_connection_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -340,9 +352,9 @@ def update( resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - parameters: "_models.PrivateEndpointConnection", + parameters: _models.PrivateEndpointConnection, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. Updates a private endpoint connection. @@ -361,14 +373,17 @@ def update( :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] _json = self._serialize.body(parameters, 'PrivateEndpointConnection') @@ -381,11 +396,13 @@ def update( content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -413,13 +430,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -429,11 +449,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name=private_endpoint_connection_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -480,21 +502,26 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -504,8 +531,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/operations/_private_link_resources_operations.py index efcd8fd17c52..9543c00a361a 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/operations/_private_link_resources_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/operations/_private_link_resources_operations.py @@ -15,6 +15,7 @@ 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 @@ -31,9 +32,12 @@ def build_list_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources") # pylint: disable=line-too-long path_format_arguments = { @@ -45,42 +49,38 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class PrivateLinkResourcesOperations(object): - """PrivateLinkResourcesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class PrivateLinkResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_03_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_03_02_preview.ContainerServiceClient`'s + :attr:`private_link_resources` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -88,7 +88,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.PrivateLinkResourcesListResult": + ) -> _models.PrivateLinkResourcesListResult: """Gets a list of private link resources in the specified managed cluster. To learn more about private clusters, see: @@ -103,13 +103,16 @@ def list( :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.PrivateLinkResourcesListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourcesListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] request = build_list_request( @@ -118,11 +121,13 @@ def list( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/operations/_resolve_private_link_service_id_operations.py index 839133650a18..17f4a0fbf4f4 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/operations/_resolve_private_link_service_id_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/operations/_resolve_private_link_service_id_operations.py @@ -15,12 +15,12 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -31,14 +31,17 @@ def build_post_request( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.PrivateLinkResource] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId") # pylint: disable=line-too-long path_format_arguments = { @@ -50,55 +53,51 @@ def build_post_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs ) -class ResolvePrivateLinkServiceIdOperations(object): - """ResolvePrivateLinkServiceIdOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ResolvePrivateLinkServiceIdOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_03_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_03_02_preview.ContainerServiceClient`'s + :attr:`resolve_private_link_service_id` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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 post( self, resource_group_name: str, resource_name: str, - parameters: "_models.PrivateLinkResource", + parameters: _models.PrivateLinkResource, **kwargs: Any - ) -> "_models.PrivateLinkResource": + ) -> _models.PrivateLinkResource: """Gets the private link service ID for the specified managed cluster. Gets the private link service ID for the specified managed cluster. @@ -114,14 +113,17 @@ def post( :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.PrivateLinkResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-03-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] _json = self._serialize.body(parameters, 'PrivateLinkResource') @@ -133,11 +135,13 @@ def post( content_type=content_type, json=_json, template_url=self.post.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/operations/_snapshots_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/operations/_snapshots_operations.py index 2dd1336d0541..80a4e0b21de8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/operations/_snapshots_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_03_02_preview/operations/_snapshots_operations.py @@ -16,12 +16,12 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -31,9 +31,12 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots") path_format_arguments = { @@ -43,18 +46,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -64,9 +65,12 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots") # pylint: disable=line-too-long path_format_arguments = { @@ -77,18 +81,16 @@ def build_list_by_resource_group_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -99,9 +101,12 @@ def build_get_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -113,18 +118,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -134,14 +137,17 @@ def build_create_or_update_request( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.Snapshot] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -153,20 +159,18 @@ def build_create_or_update_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -178,14 +182,17 @@ def build_update_tags_request( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.TagsObject] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -197,20 +204,18 @@ def build_update_tags_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -223,9 +228,12 @@ def build_delete_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -237,48 +245,44 @@ def build_delete_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class SnapshotsOperations(object): - """SnapshotsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class SnapshotsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_03_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_03_02_preview.ContainerServiceClient`'s + :attr:`snapshots` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> Iterable["_models.SnapshotListResult"]: + ) -> Iterable[_models.SnapshotListResult]: """Gets a list of snapshots in the specified subscription. Gets a list of snapshots in the specified subscription. @@ -289,13 +293,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_03_02_preview.models.SnapshotListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -303,9 +310,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -313,9 +322,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -353,7 +364,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.SnapshotListResult"]: + ) -> Iterable[_models.SnapshotListResult]: """Lists snapshots in the specified subscription and resource group. Lists snapshots in the specified subscription and resource group. @@ -366,13 +377,16 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_03_02_preview.models.SnapshotListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -381,9 +395,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -392,9 +408,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -433,7 +451,7 @@ def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.Snapshot": + ) -> _models.Snapshot: """Gets a snapshot. Gets a snapshot. @@ -447,13 +465,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.Snapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] request = build_get_request( @@ -462,11 +483,13 @@ def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -492,9 +515,9 @@ def create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.Snapshot", + parameters: _models.Snapshot, **kwargs: Any - ) -> "_models.Snapshot": + ) -> _models.Snapshot: """Creates or updates a snapshot. Creates or updates a snapshot. @@ -510,14 +533,17 @@ def create_or_update( :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.Snapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-03-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] _json = self._serialize.body(parameters, 'Snapshot') @@ -529,11 +555,13 @@ def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -563,9 +591,9 @@ def update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.Snapshot": + ) -> _models.Snapshot: """Updates tags on a snapshot. Updates tags on a snapshot. @@ -581,14 +609,17 @@ def update_tags( :rtype: ~azure.mgmt.containerservice.v2022_03_02_preview.models.Snapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] _json = self._serialize.body(parameters, 'TagsObject') @@ -600,11 +631,13 @@ def update_tags( content_type=content_type, json=_json, template_url=self.update_tags.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -645,13 +678,16 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-03-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-03-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -660,11 +696,13 @@ def delete( # pylint: disable=inconsistent-return-statements resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/__init__.py index 53c675bd95e2..37a5f9e02e6f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._container_service_client import ContainerServiceClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['ContainerServiceClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/_container_service_client.py index 5e885c5f66f3..708db451f51c 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/_container_service_client.py @@ -73,14 +73,30 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.managed_clusters = ManagedClustersOperations(self._client, self._config, self._serialize, self._deserialize) - self.maintenance_configurations = MaintenanceConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) - self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) - self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations(self._client, self._config, self._serialize, self._deserialize) - self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_clusters = ManagedClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.maintenance_configurations = MaintenanceConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.agent_pools = AgentPoolsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.snapshots = SnapshotsOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/__init__.py index 53c675bd95e2..37a5f9e02e6f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._container_service_client import ContainerServiceClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['ContainerServiceClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/_container_service_client.py index e82ff380faeb..fe89be0e1a77 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/_container_service_client.py @@ -74,14 +74,30 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.managed_clusters = ManagedClustersOperations(self._client, self._config, self._serialize, self._deserialize) - self.maintenance_configurations = MaintenanceConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) - self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) - self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations(self._client, self._config, self._serialize, self._deserialize) - self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_clusters = ManagedClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.maintenance_configurations = MaintenanceConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.agent_pools = AgentPoolsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.snapshots = SnapshotsOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/operations/__init__.py index 5e1e5e72fa59..e0748876288c 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/operations/__init__.py @@ -15,6 +15,9 @@ from ._resolve_private_link_service_id_operations import ResolvePrivateLinkServiceIdOperations from ._snapshots_operations import SnapshotsOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'Operations', 'ManagedClustersOperations', @@ -25,3 +28,5 @@ 'ResolvePrivateLinkServiceIdOperations', 'SnapshotsOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/operations/_agent_pools_operations.py index 7675daa730da..5c3c12421952 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/operations/_agent_pools_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. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ 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 @@ -26,26 +27,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class AgentPoolsOperations: - """AgentPoolsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_04_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_04_01.aio.ContainerServiceClient`'s + :attr:`agent_pools` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -53,7 +52,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> AsyncIterable["_models.AgentPoolListResult"]: + ) -> AsyncIterable[_models.AgentPoolListResult]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. @@ -68,13 +67,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_04_01.models.AgentPoolListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -84,9 +86,11 @@ def prepare_request(next_link=None): resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -96,9 +100,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -138,7 +144,7 @@ async def get( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPool": + ) -> _models.AgentPool: """Gets the specified managed cluster agent pool. Gets the specified managed cluster agent pool. @@ -154,13 +160,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.AgentPool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] request = build_get_request( @@ -170,11 +179,13 @@ async def get( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -200,17 +211,20 @@ async def _create_or_update_initial( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> "_models.AgentPool": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] + ) -> _models.AgentPool: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] _json = self._serialize.body(parameters, 'AgentPool') @@ -223,11 +237,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -258,9 +274,9 @@ async def begin_create_or_update( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> AsyncLROPoller["_models.AgentPool"]: + ) -> AsyncLROPoller[_models.AgentPool]: """Creates or updates an agent pool in the specified managed cluster. Creates or updates an agent pool in the specified managed cluster. @@ -287,17 +303,20 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_04_01.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, @@ -305,20 +324,27 @@ async def begin_create_or_update( 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): - response = pipeline_response.http_response deserialized = self._deserialize('AgentPool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -338,13 +364,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements agent_pool_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -354,11 +383,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -405,21 +436,26 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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) @@ -429,8 +465,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -450,7 +492,7 @@ async def get_upgrade_profile( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPoolUpgradeProfile": + ) -> _models.AgentPoolUpgradeProfile: """Gets the upgrade profile for an agent pool. Gets the upgrade profile for an agent pool. @@ -466,13 +508,16 @@ async def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.AgentPoolUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] request = build_get_upgrade_profile_request( @@ -482,11 +527,13 @@ async def get_upgrade_profile( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -513,7 +560,7 @@ async def get_available_agent_pool_versions( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.AgentPoolAvailableVersions": + ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported Kubernetes versions for the specified agent pool. See `supported Kubernetes versions @@ -529,13 +576,16 @@ async def get_available_agent_pool_versions( :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.AgentPoolAvailableVersions :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolAvailableVersions"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] request = build_get_available_agent_pool_versions_request( @@ -544,11 +594,13 @@ async def get_available_agent_pool_versions( resource_name=resource_name, api_version=api_version, template_url=self.get_available_agent_pool_versions.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -575,14 +627,17 @@ async def _upgrade_node_image_version_initial( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> Optional["_models.AgentPool"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.AgentPool"]] + ) -> Optional[_models.AgentPool]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] request = build_upgrade_node_image_version_request_initial( @@ -592,11 +647,13 @@ async def _upgrade_node_image_version_initial( agent_pool_name=agent_pool_name, api_version=api_version, template_url=self._upgrade_node_image_version_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -629,7 +686,7 @@ async def begin_upgrade_node_image_version( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> AsyncLROPoller["_models.AgentPool"]: + ) -> AsyncLROPoller[_models.AgentPool]: """Upgrades the node image version of an agent pool to the latest. Upgrading the node image version of an agent pool applies the newest OS and runtime updates to @@ -656,21 +713,26 @@ async def begin_upgrade_node_image_version( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_04_01.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._upgrade_node_image_version_initial( + raw_result = await self._upgrade_node_image_version_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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) @@ -686,8 +748,14 @@ def get_long_running_output(pipeline_response): return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/operations/_maintenance_configurations_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/operations/_maintenance_configurations_operations.py index 0dbec32898fe..7e403ad8efc1 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/operations/_maintenance_configurations_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/operations/_maintenance_configurations_operations.py @@ -15,6 +15,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -24,26 +25,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class MaintenanceConfigurationsOperations: - """MaintenanceConfigurationsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_04_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_04_01.aio.ContainerServiceClient`'s + :attr:`maintenance_configurations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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_by_managed_cluster( @@ -51,7 +50,7 @@ def list_by_managed_cluster( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> AsyncIterable["_models.MaintenanceConfigurationListResult"]: + ) -> AsyncIterable[_models.MaintenanceConfigurationListResult]: """Gets a list of maintenance configurations in the specified managed cluster. Gets a list of maintenance configurations in the specified managed cluster. @@ -67,13 +66,16 @@ def list_by_managed_cluster( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_04_01.models.MaintenanceConfigurationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfigurationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfigurationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -83,9 +85,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=self.list_by_managed_cluster.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -95,9 +99,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -137,7 +143,7 @@ async def get( resource_name: str, config_name: str, **kwargs: Any - ) -> "_models.MaintenanceConfiguration": + ) -> _models.MaintenanceConfiguration: """Gets the specified maintenance configuration of a managed cluster. Gets the specified maintenance configuration of a managed cluster. @@ -153,13 +159,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.MaintenanceConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfiguration"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] request = build_get_request( @@ -169,11 +178,13 @@ async def get( config_name=config_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -200,9 +211,9 @@ async def create_or_update( resource_group_name: str, resource_name: str, config_name: str, - parameters: "_models.MaintenanceConfiguration", + parameters: _models.MaintenanceConfiguration, **kwargs: Any - ) -> "_models.MaintenanceConfiguration": + ) -> _models.MaintenanceConfiguration: """Creates or updates a maintenance configuration in the specified managed cluster. Creates or updates a maintenance configuration in the specified managed cluster. @@ -220,14 +231,17 @@ async def create_or_update( :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.MaintenanceConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfiguration"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] _json = self._serialize.body(parameters, 'MaintenanceConfiguration') @@ -240,11 +254,13 @@ async def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -288,13 +304,16 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -304,11 +323,13 @@ async def delete( # pylint: disable=inconsistent-return-statements config_name=config_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/operations/_managed_clusters_operations.py index fe53db85f864..94d52ed0e94d 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/operations/_managed_clusters_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. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ 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 @@ -26,26 +27,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ManagedClustersOperations: # pylint: disable=too-many-public-methods - """ManagedClustersOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_04_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_04_01.aio.ContainerServiceClient`'s + :attr:`managed_clusters` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace_async async def get_os_options( @@ -53,7 +52,7 @@ async def get_os_options( location: str, resource_type: Optional[str] = None, **kwargs: Any - ) -> "_models.OSOptionProfile": + ) -> _models.OSOptionProfile: """Gets supported OS options in the specified subscription. Gets supported OS options in the specified subscription. @@ -68,13 +67,16 @@ async def get_os_options( :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.OSOptionProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OSOptionProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OSOptionProfile] request = build_get_os_options_request( @@ -83,11 +85,13 @@ async def get_os_options( api_version=api_version, resource_type=resource_type, template_url=self.get_os_options.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -112,7 +116,7 @@ async def get_os_options( def list( self, **kwargs: Any - ) -> AsyncIterable["_models.ManagedClusterListResult"]: + ) -> AsyncIterable[_models.ManagedClusterListResult]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. @@ -124,13 +128,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_04_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -138,9 +145,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -148,9 +157,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -188,7 +199,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ManagedClusterListResult"]: + ) -> AsyncIterable[_models.ManagedClusterListResult]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. @@ -202,13 +213,16 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_04_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -217,9 +231,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -228,9 +244,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -269,7 +287,7 @@ async def get_upgrade_profile( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedClusterUpgradeProfile": + ) -> _models.ManagedClusterUpgradeProfile: """Gets the upgrade profile of a managed cluster. Gets the upgrade profile of a managed cluster. @@ -283,13 +301,16 @@ async def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.ManagedClusterUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] request = build_get_upgrade_profile_request( @@ -298,11 +319,13 @@ async def get_upgrade_profile( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -330,7 +353,7 @@ async def get_access_profile( resource_name: str, role_name: str, **kwargs: Any - ) -> "_models.ManagedClusterAccessProfile": + ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. **WARNING**\ : This API will be deprecated. Instead use `ListClusterUserCredentials @@ -349,13 +372,16 @@ async def get_access_profile( :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.ManagedClusterAccessProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterAccessProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] request = build_get_access_profile_request( @@ -365,11 +391,13 @@ async def get_access_profile( role_name=role_name, api_version=api_version, template_url=self.get_access_profile.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -397,7 +425,7 @@ async def list_cluster_admin_credentials( resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Lists the admin credentials of a managed cluster. Lists the admin credentials of a managed cluster. @@ -413,13 +441,16 @@ async def list_cluster_admin_credentials( :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_admin_credentials_request( @@ -429,11 +460,13 @@ async def list_cluster_admin_credentials( api_version=api_version, server_fqdn=server_fqdn, template_url=self.list_cluster_admin_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -462,7 +495,7 @@ async def list_cluster_user_credentials( server_fqdn: Optional[str] = None, format: Optional[Union[str, "_models.Format"]] = None, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Lists the user credentials of a managed cluster. Lists the user credentials of a managed cluster. @@ -482,13 +515,16 @@ async def list_cluster_user_credentials( :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_user_credentials_request( @@ -499,11 +535,13 @@ async def list_cluster_user_credentials( server_fqdn=server_fqdn, format=format, template_url=self.list_cluster_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -531,7 +569,7 @@ async def list_cluster_monitoring_user_credentials( resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Lists the cluster monitoring user credentials of a managed cluster. Lists the cluster monitoring user credentials of a managed cluster. @@ -547,13 +585,16 @@ async def list_cluster_monitoring_user_credentials( :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_monitoring_user_credentials_request( @@ -563,11 +604,13 @@ async def list_cluster_monitoring_user_credentials( api_version=api_version, server_fqdn=server_fqdn, template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -594,7 +637,7 @@ async def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedCluster": + ) -> _models.ManagedCluster: """Gets a managed cluster. Gets a managed cluster. @@ -608,13 +651,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.ManagedCluster :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] request = build_get_request( @@ -623,11 +669,13 @@ async def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -652,17 +700,20 @@ async def _create_or_update_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'ManagedCluster') @@ -674,11 +725,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -708,9 +761,9 @@ async def begin_create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> AsyncLROPoller["_models.ManagedCluster"]: + ) -> AsyncLROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. Creates or updates a managed cluster. @@ -735,37 +788,47 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_04_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -782,17 +845,20 @@ async def _update_tags_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'TagsObject') @@ -804,11 +870,13 @@ async def _update_tags_initial( content_type=content_type, json=_json, template_url=self._update_tags_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -834,9 +902,9 @@ async def begin_update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> AsyncLROPoller["_models.ManagedCluster"]: + ) -> AsyncLROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates tags on a managed cluster. @@ -861,37 +929,47 @@ async def begin_update_tags( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_04_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._update_tags_initial( + raw_result = await self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -910,13 +988,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -925,11 +1006,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -973,20 +1056,25 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_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) @@ -996,8 +1084,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1014,17 +1108,20 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') @@ -1036,11 +1133,13 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist content_type=content_type, json=_json, template_url=self._reset_service_principal_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1062,7 +1161,7 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> AsyncLROPoller[None]: """Reset the Service Principal Profile of a managed cluster. @@ -1088,23 +1187,28 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._reset_service_principal_profile_initial( + raw_result = await self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1114,8 +1218,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1132,17 +1242,20 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') @@ -1154,11 +1267,13 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta content_type=content_type, json=_json, template_url=self._reset_aad_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1180,7 +1295,7 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> AsyncLROPoller[None]: """Reset the AAD Profile of a managed cluster. @@ -1205,23 +1320,28 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._reset_aad_profile_initial( + raw_result = await self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1231,8 +1351,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1251,13 +1377,16 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_rotate_cluster_certificates_request_initial( @@ -1266,11 +1395,13 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- resource_name=resource_name, api_version=api_version, template_url=self._rotate_cluster_certificates_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1315,20 +1446,25 @@ async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-ret :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._rotate_cluster_certificates_initial( + raw_result = await self._rotate_cluster_certificates_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) @@ -1338,8 +1474,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1358,13 +1500,16 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_stop_request_initial( @@ -1373,11 +1518,13 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_name, api_version=api_version, template_url=self._stop_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1425,20 +1572,25 @@ async def begin_stop( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._stop_initial( + raw_result = await self._stop_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) @@ -1448,8 +1600,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1468,13 +1626,16 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_start_request_initial( @@ -1483,11 +1644,13 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_name, api_version=api_version, template_url=self._start_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1532,20 +1695,25 @@ async def begin_start( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._start_initial( + raw_result = await self._start_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) @@ -1555,8 +1723,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1573,17 +1747,20 @@ async def _run_command_initial( self, resource_group_name: str, resource_name: str, - request_payload: "_models.RunCommandRequest", + request_payload: _models.RunCommandRequest, **kwargs: Any - ) -> Optional["_models.RunCommandResult"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RunCommandResult"]] + ) -> Optional[_models.RunCommandResult]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] _json = self._serialize.body(request_payload, 'RunCommandRequest') @@ -1595,11 +1772,13 @@ async def _run_command_initial( content_type=content_type, json=_json, template_url=self._run_command_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1627,9 +1806,9 @@ async def begin_run_command( self, resource_group_name: str, resource_name: str, - request_payload: "_models.RunCommandRequest", + request_payload: _models.RunCommandRequest, **kwargs: Any - ) -> AsyncLROPoller["_models.RunCommandResult"]: + ) -> AsyncLROPoller[_models.RunCommandResult]: """Submits a command to run against the Managed Cluster. AKS will create a pod to run the command. This is primarily useful for private clusters. For @@ -1656,37 +1835,47 @@ async def begin_run_command( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_04_01.models.RunCommandResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.RunCommandResult] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._run_command_initial( + raw_result = await self._run_command_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, request_payload=request_payload, 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): - response = pipeline_response.http_response deserialized = self._deserialize('RunCommandResult', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1706,7 +1895,7 @@ async def get_command_result( resource_name: str, command_id: str, **kwargs: Any - ) -> Optional["_models.RunCommandResult"]: + ) -> Optional[_models.RunCommandResult]: """Gets the results of a command which has been run on the Managed Cluster. Gets the results of a command which has been run on the Managed Cluster. @@ -1722,13 +1911,16 @@ async def get_command_result( :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.RunCommandResult or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RunCommandResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] request = build_get_command_result_request( @@ -1738,11 +1930,13 @@ async def get_command_result( command_id=command_id, api_version=api_version, template_url=self.get_command_result.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1771,7 +1965,7 @@ def list_outbound_network_dependencies_endpoints( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> AsyncIterable["_models.OutboundEnvironmentEndpointCollection"]: + ) -> AsyncIterable[_models.OutboundEnvironmentEndpointCollection]: """Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. @@ -1789,13 +1983,16 @@ def list_outbound_network_dependencies_endpoints( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_04_01.models.OutboundEnvironmentEndpointCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OutboundEnvironmentEndpointCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -1805,9 +2002,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=self.list_outbound_network_dependencies_endpoints.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -1817,9 +2016,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/operations/_operations.py index 57dda77d2d85..15113a29edd9 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/operations/_operations.py @@ -14,6 +14,7 @@ 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 @@ -23,32 +24,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class Operations: - """Operations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_04_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_04_01.aio.ContainerServiceClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.OperationListResult"]: + ) -> AsyncIterable[_models.OperationListResult]: """Gets a list of operations. Gets a list of operations. @@ -59,31 +58,38 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_04_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/operations/_private_endpoint_connections_operations.py index b54ee8fb6e29..2cbedb4fa0bb 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/operations/_private_endpoint_connections_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -14,6 +14,7 @@ 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 @@ -24,26 +25,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class PrivateEndpointConnectionsOperations: - """PrivateEndpointConnectionsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_04_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_04_01.aio.ContainerServiceClient`'s + :attr:`private_endpoint_connections` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -51,7 +50,7 @@ async def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnectionListResult": + ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. To learn more about private clusters, see: @@ -66,13 +65,16 @@ async def list( :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.PrivateEndpointConnectionListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] request = build_list_request( @@ -81,11 +83,13 @@ async def list( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -113,7 +117,7 @@ async def get( resource_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Gets the specified private endpoint connection. To learn more about private clusters, see: @@ -130,13 +134,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] request = build_get_request( @@ -146,11 +153,13 @@ async def get( private_endpoint_connection_name=private_endpoint_connection_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -177,9 +186,9 @@ async def update( resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - parameters: "_models.PrivateEndpointConnection", + parameters: _models.PrivateEndpointConnection, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. Updates a private endpoint connection. @@ -197,14 +206,17 @@ async def update( :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] _json = self._serialize.body(parameters, 'PrivateEndpointConnection') @@ -217,11 +229,13 @@ async def update( content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -249,13 +263,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -265,11 +282,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name=private_endpoint_connection_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -316,21 +335,26 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -340,8 +364,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/operations/_private_link_resources_operations.py index b8fe58c50d4b..7f5ccc87cd71 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/operations/_private_link_resources_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/operations/_private_link_resources_operations.py @@ -13,6 +13,7 @@ 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 @@ -22,26 +23,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class PrivateLinkResourcesOperations: - """PrivateLinkResourcesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_04_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_04_01.aio.ContainerServiceClient`'s + :attr:`private_link_resources` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -49,7 +48,7 @@ async def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.PrivateLinkResourcesListResult": + ) -> _models.PrivateLinkResourcesListResult: """Gets a list of private link resources in the specified managed cluster. To learn more about private clusters, see: @@ -64,13 +63,16 @@ async def list( :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.PrivateLinkResourcesListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourcesListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] request = build_list_request( @@ -79,11 +81,13 @@ async def list( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/operations/_resolve_private_link_service_id_operations.py index 5e368a1d8f27..29dacfbc6690 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/operations/_resolve_private_link_service_id_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/operations/_resolve_private_link_service_id_operations.py @@ -13,6 +13,7 @@ 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 @@ -22,35 +23,33 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ResolvePrivateLinkServiceIdOperations: - """ResolvePrivateLinkServiceIdOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_04_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_04_01.aio.ContainerServiceClient`'s + :attr:`resolve_private_link_service_id` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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 post( self, resource_group_name: str, resource_name: str, - parameters: "_models.PrivateLinkResource", + parameters: _models.PrivateLinkResource, **kwargs: Any - ) -> "_models.PrivateLinkResource": + ) -> _models.PrivateLinkResource: """Gets the private link service ID for the specified managed cluster. Gets the private link service ID for the specified managed cluster. @@ -66,14 +65,17 @@ async def post( :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.PrivateLinkResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] _json = self._serialize.body(parameters, 'PrivateLinkResource') @@ -85,11 +87,13 @@ async def post( content_type=content_type, json=_json, template_url=self.post.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/operations/_snapshots_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/operations/_snapshots_operations.py index 11882ad595aa..575798ae56e4 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/operations/_snapshots_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/aio/operations/_snapshots_operations.py @@ -15,6 +15,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -24,32 +25,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class SnapshotsOperations: - """SnapshotsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_04_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_04_01.aio.ContainerServiceClient`'s + :attr:`snapshots` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.SnapshotListResult"]: + ) -> AsyncIterable[_models.SnapshotListResult]: """Gets a list of snapshots in the specified subscription. Gets a list of snapshots in the specified subscription. @@ -60,13 +59,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_04_01.models.SnapshotListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -74,9 +76,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -84,9 +88,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -124,7 +130,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.SnapshotListResult"]: + ) -> AsyncIterable[_models.SnapshotListResult]: """Lists snapshots in the specified subscription and resource group. Lists snapshots in the specified subscription and resource group. @@ -137,13 +143,16 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_04_01.models.SnapshotListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -152,9 +161,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -163,9 +174,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -204,7 +217,7 @@ async def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.Snapshot": + ) -> _models.Snapshot: """Gets a snapshot. Gets a snapshot. @@ -218,13 +231,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.Snapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] request = build_get_request( @@ -233,11 +249,13 @@ async def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -263,9 +281,9 @@ async def create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.Snapshot", + parameters: _models.Snapshot, **kwargs: Any - ) -> "_models.Snapshot": + ) -> _models.Snapshot: """Creates or updates a snapshot. Creates or updates a snapshot. @@ -281,14 +299,17 @@ async def create_or_update( :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.Snapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] _json = self._serialize.body(parameters, 'Snapshot') @@ -300,11 +321,13 @@ async def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -334,9 +357,9 @@ async def update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.Snapshot": + ) -> _models.Snapshot: """Updates tags on a snapshot. Updates tags on a snapshot. @@ -352,14 +375,17 @@ async def update_tags( :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.Snapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] _json = self._serialize.body(parameters, 'TagsObject') @@ -371,11 +397,13 @@ async def update_tags( content_type=content_type, json=_json, template_url=self.update_tags.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -416,13 +444,16 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -431,11 +462,13 @@ async def delete( # pylint: disable=inconsistent-return-statements resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/models/__init__.py index c5035d3c2558..4adc3fedca9d 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/models/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/models/__init__.py @@ -137,7 +137,9 @@ WeekDay, WorkloadRuntime, ) - +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'AgentPool', 'AgentPoolAvailableVersions', @@ -267,3 +269,5 @@ 'WeekDay', 'WorkloadRuntime', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/models/_container_service_client_enums.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/models/_container_service_client_enums.py index aa3de5ebe54e..cb066b7fffcc 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/models/_container_service_client_enums.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/models/_container_service_client_enums.py @@ -7,11 +7,10 @@ # -------------------------------------------------------------------------- from enum import Enum -from six import with_metaclass from azure.core import CaseInsensitiveEnumMeta -class AgentPoolMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class AgentPoolMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: https://docs.microsoft.com/azure/aks/use-system-pools @@ -24,7 +23,7 @@ class AgentPoolMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: User agent pools are primarily for hosting your application pods. USER = "User" -class AgentPoolType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class AgentPoolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of Agent Pool. """ @@ -33,7 +32,7 @@ class AgentPoolType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Use of this is strongly discouraged. AVAILABILITY_SET = "AvailabilitySet" -class Code(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class Code(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Tells whether the cluster is Running or Stopped """ @@ -42,7 +41,7 @@ class Code(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: The cluster is stopped. STOPPED = "Stopped" -class ConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The private link service connection status. """ @@ -51,7 +50,7 @@ class ConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): REJECTED = "Rejected" DISCONNECTED = "Disconnected" -class ContainerServiceStorageProfileTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Specifies what kind of storage to use. If omitted, the default will be chosen on your behalf based on the choice of orchestrator. """ @@ -59,7 +58,7 @@ class ContainerServiceStorageProfileTypes(with_metaclass(CaseInsensitiveEnumMeta STORAGE_ACCOUNT = "StorageAccount" MANAGED_DISKS = "ManagedDisks" -class ContainerServiceVMSizeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Size of agent VMs. Note: This is no longer maintained. """ @@ -238,7 +237,7 @@ class ContainerServiceVMSizeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, E STANDARD_NV24 = "Standard_NV24" STANDARD_NV6 = "Standard_NV6" -class Count(with_metaclass(CaseInsensitiveEnumMeta, int, Enum)): +class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): """Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, and 5. The default value is 1. """ @@ -247,7 +246,7 @@ class Count(with_metaclass(CaseInsensitiveEnumMeta, int, Enum)): THREE = 3 FIVE = 5 -class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of identity that created the resource. """ @@ -256,7 +255,7 @@ class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class Expander(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class Expander(str, Enum, metaclass=CaseInsensitiveEnumMeta): """If not specified, the default is 'random'. See `expanders `_ for more information. @@ -279,13 +278,13 @@ class Expander(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Used when you don't have a particular need for the node groups to scale differently. RANDOM = "random" -class ExtendedLocationTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ExtendedLocationTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of extendedLocation. """ EDGE_ZONE = "EdgeZone" -class Format(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class Format(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Return azure auth-provider kubeconfig. This format is deprecated in 1.22 and will be fully #: removed in 1.25. @@ -293,7 +292,7 @@ class Format(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Return exec format kubeconfig. This format requires kubelogin binary in the path. EXEC_ENUM = "exec" -class GPUInstanceProfile(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class GPUInstanceProfile(str, Enum, metaclass=CaseInsensitiveEnumMeta): """GPUInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU. """ @@ -303,14 +302,14 @@ class GPUInstanceProfile(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MIG4_G = "MIG4g" MIG7_G = "MIG7g" -class IpFamily(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class IpFamily(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The IP version to use for cluster networking and IP assignment. """ I_PV4 = "IPv4" I_PV6 = "IPv6" -class KubeletDiskType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class KubeletDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. """ @@ -320,7 +319,7 @@ class KubeletDiskType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Kubelet will use the temporary disk for its data. TEMPORARY = "Temporary" -class LicenseType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class LicenseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The license type to use for Windows VMs. See `Azure Hybrid User Benefits `_ for more details. """ @@ -330,7 +329,7 @@ class LicenseType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Enables Azure Hybrid User Benefits for Windows VMs. WINDOWS_SERVER = "Windows_Server" -class LoadBalancerSku(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class LoadBalancerSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the differences between load balancer SKUs. @@ -343,7 +342,7 @@ class LoadBalancerSku(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Use a basic Load Balancer with limited functionality. BASIC = "basic" -class ManagedClusterPodIdentityProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ManagedClusterPodIdentityProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The current provisioning state of the pod identity. """ @@ -352,13 +351,13 @@ class ManagedClusterPodIdentityProvisioningState(with_metaclass(CaseInsensitiveE DELETING = "Deleting" FAILED = "Failed" -class ManagedClusterSKUName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ManagedClusterSKUName(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The name of a managed cluster SKU. """ BASIC = "Basic" -class ManagedClusterSKUTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ManagedClusterSKUTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): """If not specified, the default is 'Free'. See `uptime SLA `_ for more details. """ @@ -369,7 +368,7 @@ class ManagedClusterSKUTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: No guaranteed SLA, no additional charges. Free tier clusters have an SLO of 99.5%. FREE = "Free" -class NetworkMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """This cannot be specified if networkPlugin is anything other than 'azure'. """ @@ -380,7 +379,7 @@ class NetworkMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: This is no longer supported. BRIDGE = "bridge" -class NetworkPlugin(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkPlugin(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Network plugin used for building the Kubernetes network. """ @@ -393,7 +392,7 @@ class NetworkPlugin(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: information. KUBENET = "kubenet" -class NetworkPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Network policy used for building the Kubernetes network. """ @@ -406,7 +405,7 @@ class NetworkPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: for more information. AZURE = "azure" -class OSDiskType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OSDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS @@ -422,14 +421,14 @@ class OSDiskType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: provides lower read/write latency, along with faster node scaling and cluster upgrades. EPHEMERAL = "Ephemeral" -class OSSKU(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OSSKU(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Specifies an OS SKU. This value must not be specified if OSType is Windows. """ UBUNTU = "Ubuntu" CBL_MARINER = "CBLMariner" -class OSType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The operating system type. The default is Linux. """ @@ -438,7 +437,7 @@ class OSType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Use Windows. WINDOWS = "Windows" -class OutboundType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OutboundType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type `_. """ @@ -458,7 +457,7 @@ class OutboundType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: advanced scenario and requires proper network configuration. USER_ASSIGNED_NAT_GATEWAY = "userAssignedNATGateway" -class PrivateEndpointConnectionProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class PrivateEndpointConnectionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The current provisioning state. """ @@ -467,14 +466,14 @@ class PrivateEndpointConnectionProvisioningState(with_metaclass(CaseInsensitiveE DELETING = "Deleting" FAILED = "Failed" -class PublicNetworkAccess(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class PublicNetworkAccess(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Allow or deny public network access for AKS """ ENABLED = "Enabled" DISABLED = "Disabled" -class ResourceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """For more information see `use managed identities in AKS `_. """ @@ -490,7 +489,7 @@ class ResourceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Do not use a managed identity for the Managed Cluster, service principal will be used instead. NONE = "None" -class ScaleDownMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ScaleDownMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Describes how VMs are added to or removed from Agent Pools. See `billing states `_. """ @@ -501,7 +500,7 @@ class ScaleDownMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: during scale down. DEALLOCATE = "Deallocate" -class ScaleSetEvictionPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The eviction policy specifies what to do with the VM when it is evicted. The default is Delete. For more information about eviction see `spot VMs `_ @@ -514,7 +513,7 @@ class ScaleSetEvictionPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)) #: cause issues with cluster scaling or upgrading. DEALLOCATE = "Deallocate" -class ScaleSetPriority(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ScaleSetPriority(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The Virtual Machine Scale Set priority. """ @@ -524,14 +523,14 @@ class ScaleSetPriority(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Regular VMs will be used. REGULAR = "Regular" -class SnapshotType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SnapshotType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of a snapshot. The default is NodePool. """ #: The snapshot is a snapshot of a node pool. NODE_POOL = "NodePool" -class UpgradeChannel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class UpgradeChannel(str, Enum, metaclass=CaseInsensitiveEnumMeta): """For more information see `setting the AKS cluster auto-upgrade channel `_. """ @@ -561,7 +560,7 @@ class UpgradeChannel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Disables auto-upgrades and keeps the cluster at its current version of Kubernetes. NONE = "none" -class WeekDay(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class WeekDay(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The weekday enum. """ @@ -573,7 +572,7 @@ class WeekDay(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): FRIDAY = "Friday" SATURDAY = "Saturday" -class WorkloadRuntime(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class WorkloadRuntime(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Determines the type of workload a node can run. """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/models/_models_py3.py index fd66fb3cc5aa..12805013bc25 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/models/_models_py3.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/models/_models_py3.py @@ -7,11 +7,13 @@ # -------------------------------------------------------------------------- import datetime -from typing import Dict, List, Optional, Union +from typing import Dict, List, Optional, TYPE_CHECKING, Union import msrest.serialization -from ._container_service_client_enums import * +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + import __init__ as _models class SubResource(msrest.serialization.Model): @@ -79,15 +81,15 @@ class AgentPool(SubResource): :ivar os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS - `_. Possible values - include: "Managed", "Ephemeral". + `_. Known values are: + "Managed", "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2022_04_01.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Possible values include: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_04_01.models.KubeletDiskType - :ivar workload_runtime: Determines the type of workload a node can run. Possible values - include: "OCIContainer", "WasmWasi". + :ivar workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer", "WasmWasi". :vartype workload_runtime: str or ~azure.mgmt.containerservice.v2022_04_01.models.WorkloadRuntime :ivar vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and used. @@ -101,11 +103,11 @@ class AgentPool(SubResource): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_04_01.models.OSType - :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Possible values include: "Ubuntu", "CBLMariner". + :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known + values are: "Ubuntu", "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2022_04_01.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. :vartype max_count: int @@ -114,16 +116,15 @@ class AgentPool(SubResource): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it - defaults to Delete. Possible values include: "Delete", "Deallocate". + defaults to Delete. Known values are: "Delete", "Deallocate". :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_04_01.models.ScaleDownMode - :ivar type_properties_type: The type of Agent Pool. Possible values include: + :ivar type_properties_type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :vartype type_properties_type: str or ~azure.mgmt.containerservice.v2022_04_01.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Possible values include: "System", - "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". :vartype mode: str or ~azure.mgmt.containerservice.v2022_04_01.models.AgentPoolMode :ivar orchestrator_version: Both patch version (e.g. 1.20.13) and (e.g. 1.20) are supported. When is specified, the latest supported @@ -166,12 +167,12 @@ class AgentPool(SubResource): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Possible values include: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_04_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Possible values include: "Delete", - "Deallocate". Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_04_01.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which @@ -203,7 +204,7 @@ class AgentPool(SubResource): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_04_01.models.GPUInstanceProfile :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool @@ -273,40 +274,40 @@ def __init__( count: Optional[int] = None, vm_size: Optional[str] = None, os_disk_size_gb: Optional[int] = None, - os_disk_type: Optional[Union[str, "OSDiskType"]] = None, - kubelet_disk_type: Optional[Union[str, "KubeletDiskType"]] = None, - workload_runtime: Optional[Union[str, "WorkloadRuntime"]] = None, + os_disk_type: Optional[Union[str, "_models.OSDiskType"]] = None, + kubelet_disk_type: Optional[Union[str, "_models.KubeletDiskType"]] = None, + workload_runtime: Optional[Union[str, "_models.WorkloadRuntime"]] = None, vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", - os_sku: Optional[Union[str, "OSSKU"]] = None, + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - scale_down_mode: Optional[Union[str, "ScaleDownMode"]] = None, - type_properties_type: Optional[Union[str, "AgentPoolType"]] = None, - mode: Optional[Union[str, "AgentPoolMode"]] = None, + scale_down_mode: Optional[Union[str, "_models.ScaleDownMode"]] = None, + type_properties_type: Optional[Union[str, "_models.AgentPoolType"]] = None, + mode: Optional[Union[str, "_models.AgentPoolMode"]] = None, orchestrator_version: Optional[str] = None, - upgrade_settings: Optional["AgentPoolUpgradeSettings"] = None, - power_state: Optional["PowerState"] = None, + upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, + power_state: Optional["_models.PowerState"] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", spot_max_price: Optional[float] = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, proximity_placement_group_id: Optional[str] = None, - kubelet_config: Optional["KubeletConfig"] = None, - linux_os_config: Optional["LinuxOSConfig"] = None, + kubelet_config: Optional["_models.KubeletConfig"] = None, + linux_os_config: Optional["_models.LinuxOSConfig"] = None, enable_encryption_at_host: Optional[bool] = None, enable_ultra_ssd: Optional[bool] = None, enable_fips: Optional[bool] = None, - gpu_instance_profile: Optional[Union[str, "GPUInstanceProfile"]] = None, - creation_data: Optional["CreationData"] = None, + gpu_instance_profile: Optional[Union[str, "_models.GPUInstanceProfile"]] = None, + creation_data: Optional["_models.CreationData"] = None, **kwargs ): """ @@ -325,15 +326,15 @@ def __init__( :keyword os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS - `_. Possible values - include: "Managed", "Ephemeral". + `_. Known values are: + "Managed", "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2022_04_01.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Possible values include: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_04_01.models.KubeletDiskType - :keyword workload_runtime: Determines the type of workload a node can run. Possible values - include: "OCIContainer", "WasmWasi". + :keyword workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer", "WasmWasi". :paramtype workload_runtime: str or ~azure.mgmt.containerservice.v2022_04_01.models.WorkloadRuntime :keyword vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and @@ -347,11 +348,11 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_04_01.models.OSType :keyword os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Possible values include: "Ubuntu", "CBLMariner". + Known values are: "Ubuntu", "CBLMariner". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2022_04_01.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -360,17 +361,16 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, - it defaults to Delete. Possible values include: "Delete", "Deallocate". + it defaults to Delete. Known values are: "Delete", "Deallocate". :paramtype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_04_01.models.ScaleDownMode - :keyword type_properties_type: The type of Agent Pool. Possible values include: + :keyword type_properties_type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type_properties_type: str or ~azure.mgmt.containerservice.v2022_04_01.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Possible values include: "System", - "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2022_04_01.models.AgentPoolMode :keyword orchestrator_version: Both patch version (e.g. 1.20.13) and (e.g. 1.20) are supported. When is specified, the latest supported @@ -405,12 +405,12 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Possible values include: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_04_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Possible values include: "Delete", - "Deallocate". Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_04_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which @@ -442,7 +442,7 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_04_01.models.GPUInstanceProfile @@ -525,7 +525,7 @@ class AgentPoolAvailableVersions(msrest.serialization.Model): def __init__( self, *, - agent_pool_versions: Optional[List["AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem"]] = None, + agent_pool_versions: Optional[List["_models.AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem"]] = None, **kwargs ): """ @@ -602,7 +602,7 @@ class AgentPoolListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["AgentPool"]] = None, + value: Optional[List["_models.AgentPool"]] = None, **kwargs ): """ @@ -629,8 +629,8 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): :vartype type: str :ivar kubernetes_version: Required. The Kubernetes version (major.minor.patch). :vartype kubernetes_version: str - :ivar os_type: Required. The operating system type. The default is Linux. Possible values - include: "Linux", "Windows". Default value: "Linux". + :ivar os_type: Required. The operating system type. The default is Linux. Known values are: + "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_04_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -661,16 +661,16 @@ def __init__( self, *, kubernetes_version: str, - os_type: Union[str, "OSType"] = "Linux", - upgrades: Optional[List["AgentPoolUpgradeProfilePropertiesUpgradesItem"]] = None, + os_type: Union[str, "_models.OSType"] = "Linux", + upgrades: Optional[List["_models.AgentPoolUpgradeProfilePropertiesUpgradesItem"]] = None, latest_node_image_version: Optional[str] = None, **kwargs ): """ :keyword kubernetes_version: Required. The Kubernetes version (major.minor.patch). :paramtype kubernetes_version: str - :keyword os_type: Required. The operating system type. The default is Linux. Possible values - include: "Linux", "Windows". Default value: "Linux". + :keyword os_type: Required. The operating system type. The default is Linux. Known values are: + "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_04_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: @@ -782,7 +782,7 @@ def __init__( code: Optional[str] = None, message: Optional[str] = None, target: Optional[str] = None, - details: Optional[List["CloudErrorBody"]] = None, + details: Optional[List["_models.CloudErrorBody"]] = None, **kwargs ): """ @@ -826,7 +826,7 @@ class ContainerServiceDiagnosticsProfile(msrest.serialization.Model): def __init__( self, *, - vm_diagnostics: "ContainerServiceVMDiagnostics", + vm_diagnostics: "_models.ContainerServiceVMDiagnostics", **kwargs ): """ @@ -863,7 +863,7 @@ def __init__( self, *, admin_username: str, - ssh: "ContainerServiceSshConfiguration", + ssh: "_models.ContainerServiceSshConfiguration", **kwargs ): """ @@ -886,17 +886,17 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar count: Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, - and 5. The default value is 1. Possible values include: 1, 3, 5. Default value: "1". + and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". :vartype count: int or ~azure.mgmt.containerservice.v2022_04_01.models.Count :ivar dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. :vartype dns_prefix: str - :ivar vm_size: Required. Size of agent VMs. Possible values include: "Standard_A1", - "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", - "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", - "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", - "Standard_A8m_v2", "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", - "Standard_B8ms", "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", - "Standard_D12", "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", + :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", + "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", + "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", + "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", "Standard_B8ms", + "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", "Standard_D12", + "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", "Standard_D13_v2_Promo", "Standard_D14", "Standard_D14_v2", "Standard_D14_v2_Promo", "Standard_D15_v2", "Standard_D16_v3", "Standard_D16s_v3", "Standard_D1_v2", "Standard_D2", "Standard_D2_v2", "Standard_D2_v2_Promo", "Standard_D2_v3", "Standard_D2s_v3", "Standard_D3", @@ -941,7 +941,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): :vartype first_consecutive_static_ip: str :ivar storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Possible values include: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". :vartype storage_profile: str or ~azure.mgmt.containerservice.v2022_04_01.models.ContainerServiceStorageProfileTypes :ivar fqdn: FQDN for the master pool. @@ -970,27 +970,27 @@ def __init__( self, *, dns_prefix: str, - vm_size: Union[str, "ContainerServiceVMSizeTypes"], - count: Optional[Union[int, "Count"]] = 1, + vm_size: Union[str, "_models.ContainerServiceVMSizeTypes"], + count: Optional[Union[int, "_models.Count"]] = 1, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, first_consecutive_static_ip: Optional[str] = "10.240.255.5", - storage_profile: Optional[Union[str, "ContainerServiceStorageProfileTypes"]] = None, + storage_profile: Optional[Union[str, "_models.ContainerServiceStorageProfileTypes"]] = None, **kwargs ): """ :keyword count: Number of masters (VMs) in the container service cluster. Allowed values are 1, - 3, and 5. The default value is 1. Possible values include: 1, 3, 5. Default value: "1". + 3, and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". :paramtype count: int or ~azure.mgmt.containerservice.v2022_04_01.models.Count :keyword dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. :paramtype dns_prefix: str - :keyword vm_size: Required. Size of agent VMs. Possible values include: "Standard_A1", - "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", - "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", - "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", - "Standard_A8m_v2", "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", - "Standard_B8ms", "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", - "Standard_D12", "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", + :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", + "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", + "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", + "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", "Standard_B8ms", + "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", "Standard_D12", + "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", "Standard_D13_v2_Promo", "Standard_D14", "Standard_D14_v2", "Standard_D14_v2_Promo", "Standard_D15_v2", "Standard_D16_v3", "Standard_D16s_v3", "Standard_D1_v2", "Standard_D2", "Standard_D2_v2", "Standard_D2_v2_Promo", "Standard_D2_v3", "Standard_D2s_v3", "Standard_D3", @@ -1035,7 +1035,7 @@ def __init__( :paramtype first_consecutive_static_ip: str :keyword storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Possible values include: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". :paramtype storage_profile: str or ~azure.mgmt.containerservice.v2022_04_01.models.ContainerServiceStorageProfileTypes """ @@ -1053,14 +1053,14 @@ def __init__( class ContainerServiceNetworkProfile(msrest.serialization.Model): """Profile of network configuration. - :ivar network_plugin: Network plugin used for building the Kubernetes network. Possible values - include: "azure", "kubenet". Default value: "kubenet". + :ivar network_plugin: Network plugin used for building the Kubernetes network. Known values + are: "azure", "kubenet". Default value: "kubenet". :vartype network_plugin: str or ~azure.mgmt.containerservice.v2022_04_01.models.NetworkPlugin - :ivar network_policy: Network policy used for building the Kubernetes network. Possible values - include: "calico", "azure". + :ivar network_policy: Network policy used for building the Kubernetes network. Known values + are: "calico", "azure". :vartype network_policy: str or ~azure.mgmt.containerservice.v2022_04_01.models.NetworkPolicy :ivar network_mode: This cannot be specified if networkPlugin is anything other than 'azure'. - Possible values include: "transparent", "bridge". + Known values are: "transparent", "bridge". :vartype network_mode: str or ~azure.mgmt.containerservice.v2022_04_01.models.NetworkMode :ivar pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :vartype pod_cidr: str @@ -1075,13 +1075,13 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): :vartype docker_bridge_cidr: str :ivar outbound_type: This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type - `_. Possible values include: - "loadBalancer", "userDefinedRouting", "managedNATGateway", "userAssignedNATGateway". Default - value: "loadBalancer". + `_. Known values are: "loadBalancer", + "userDefinedRouting", "managedNATGateway", "userAssignedNATGateway". Default value: + "loadBalancer". :vartype outbound_type: str or ~azure.mgmt.containerservice.v2022_04_01.models.OutboundType :ivar load_balancer_sku: The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the - differences between load balancer SKUs. Possible values include: "standard", "basic". + differences between load balancer SKUs. Known values are: "standard", "basic". :vartype load_balancer_sku: str or ~azure.mgmt.containerservice.v2022_04_01.models.LoadBalancerSku :ivar load_balancer_profile: Profile of the cluster load balancer. @@ -1130,31 +1130,31 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): def __init__( self, *, - network_plugin: Optional[Union[str, "NetworkPlugin"]] = "kubenet", - network_policy: Optional[Union[str, "NetworkPolicy"]] = None, - network_mode: Optional[Union[str, "NetworkMode"]] = None, + network_plugin: Optional[Union[str, "_models.NetworkPlugin"]] = "kubenet", + network_policy: Optional[Union[str, "_models.NetworkPolicy"]] = None, + network_mode: Optional[Union[str, "_models.NetworkMode"]] = None, pod_cidr: Optional[str] = "10.244.0.0/16", service_cidr: Optional[str] = "10.0.0.0/16", dns_service_ip: Optional[str] = "10.0.0.10", docker_bridge_cidr: Optional[str] = "172.17.0.1/16", - outbound_type: Optional[Union[str, "OutboundType"]] = "loadBalancer", - load_balancer_sku: Optional[Union[str, "LoadBalancerSku"]] = None, - load_balancer_profile: Optional["ManagedClusterLoadBalancerProfile"] = None, - nat_gateway_profile: Optional["ManagedClusterNATGatewayProfile"] = None, + outbound_type: Optional[Union[str, "_models.OutboundType"]] = "loadBalancer", + load_balancer_sku: Optional[Union[str, "_models.LoadBalancerSku"]] = None, + load_balancer_profile: Optional["_models.ManagedClusterLoadBalancerProfile"] = None, + nat_gateway_profile: Optional["_models.ManagedClusterNATGatewayProfile"] = None, pod_cidrs: Optional[List[str]] = None, service_cidrs: Optional[List[str]] = None, - ip_families: Optional[List[Union[str, "IpFamily"]]] = None, + ip_families: Optional[List[Union[str, "_models.IpFamily"]]] = None, **kwargs ): """ - :keyword network_plugin: Network plugin used for building the Kubernetes network. Possible - values include: "azure", "kubenet". Default value: "kubenet". + :keyword network_plugin: Network plugin used for building the Kubernetes network. Known values + are: "azure", "kubenet". Default value: "kubenet". :paramtype network_plugin: str or ~azure.mgmt.containerservice.v2022_04_01.models.NetworkPlugin - :keyword network_policy: Network policy used for building the Kubernetes network. Possible - values include: "calico", "azure". + :keyword network_policy: Network policy used for building the Kubernetes network. Known values + are: "calico", "azure". :paramtype network_policy: str or ~azure.mgmt.containerservice.v2022_04_01.models.NetworkPolicy :keyword network_mode: This cannot be specified if networkPlugin is anything other than - 'azure'. Possible values include: "transparent", "bridge". + 'azure'. Known values are: "transparent", "bridge". :paramtype network_mode: str or ~azure.mgmt.containerservice.v2022_04_01.models.NetworkMode :keyword pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. :paramtype pod_cidr: str @@ -1169,13 +1169,13 @@ def __init__( :paramtype docker_bridge_cidr: str :keyword outbound_type: This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type - `_. Possible values include: - "loadBalancer", "userDefinedRouting", "managedNATGateway", "userAssignedNATGateway". Default - value: "loadBalancer". + `_. Known values are: "loadBalancer", + "userDefinedRouting", "managedNATGateway", "userAssignedNATGateway". Default value: + "loadBalancer". :paramtype outbound_type: str or ~azure.mgmt.containerservice.v2022_04_01.models.OutboundType :keyword load_balancer_sku: The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the - differences between load balancer SKUs. Possible values include: "standard", "basic". + differences between load balancer SKUs. Known values are: "standard", "basic". :paramtype load_balancer_sku: str or ~azure.mgmt.containerservice.v2022_04_01.models.LoadBalancerSku :keyword load_balancer_profile: Profile of the cluster load balancer. @@ -1235,7 +1235,7 @@ class ContainerServiceSshConfiguration(msrest.serialization.Model): def __init__( self, *, - public_keys: List["ContainerServiceSshPublicKey"], + public_keys: List["_models.ContainerServiceSshPublicKey"], **kwargs ): """ @@ -1423,7 +1423,7 @@ def __init__( self, *, domain_name: Optional[str] = None, - endpoint_details: Optional[List["EndpointDetail"]] = None, + endpoint_details: Optional[List["_models.EndpointDetail"]] = None, **kwargs ): """ @@ -1489,7 +1489,7 @@ class ExtendedLocation(msrest.serialization.Model): :ivar name: The name of the extended location. :vartype name: str - :ivar type: The type of the extended location. Possible values include: "EdgeZone". + :ivar type: The type of the extended location. Known values are: "EdgeZone". :vartype type: str or ~azure.mgmt.containerservice.v2022_04_01.models.ExtendedLocationTypes """ @@ -1502,13 +1502,13 @@ def __init__( self, *, name: Optional[str] = None, - type: Optional[Union[str, "ExtendedLocationTypes"]] = None, + type: Optional[Union[str, "_models.ExtendedLocationTypes"]] = None, **kwargs ): """ :keyword name: The name of the extended location. :paramtype name: str - :keyword type: The type of the extended location. Possible values include: "EdgeZone". + :keyword type: The type of the extended location. Known values are: "EdgeZone". :paramtype type: str or ~azure.mgmt.containerservice.v2022_04_01.models.ExtendedLocationTypes """ super(ExtendedLocation, self).__init__(**kwargs) @@ -1667,7 +1667,7 @@ class LinuxOSConfig(msrest.serialization.Model): def __init__( self, *, - sysctls: Optional["SysctlConfig"] = None, + sysctls: Optional["_models.SysctlConfig"] = None, transparent_huge_page_enabled: Optional[str] = None, transparent_huge_page_defrag: Optional[str] = None, swap_file_size_mb: Optional[int] = None, @@ -1735,8 +1735,8 @@ class MaintenanceConfiguration(SubResource): def __init__( self, *, - time_in_week: Optional[List["TimeInWeek"]] = None, - not_allowed_time: Optional[List["TimeSpan"]] = None, + time_in_week: Optional[List["_models.TimeInWeek"]] = None, + not_allowed_time: Optional[List["_models.TimeSpan"]] = None, **kwargs ): """ @@ -1775,7 +1775,7 @@ class MaintenanceConfigurationListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["MaintenanceConfiguration"]] = None, + value: Optional[List["_models.MaintenanceConfiguration"]] = None, **kwargs ): """ @@ -2018,8 +2018,8 @@ class ManagedCluster(TrackedResource): :ivar storage_profile: Storage profile for the managed cluster. :vartype storage_profile: ~azure.mgmt.containerservice.v2022_04_01.models.ManagedClusterStorageProfile - :ivar public_network_access: Allow or deny public network access for AKS. Possible values - include: "Enabled", "Disabled". + :ivar public_network_access: Allow or deny public network access for AKS. Known values are: + "Enabled", "Disabled". :vartype public_network_access: str or ~azure.mgmt.containerservice.v2022_04_01.models.PublicNetworkAccess """ @@ -2088,34 +2088,34 @@ def __init__( *, location: str, tags: Optional[Dict[str, str]] = None, - sku: Optional["ManagedClusterSKU"] = None, - extended_location: Optional["ExtendedLocation"] = None, - identity: Optional["ManagedClusterIdentity"] = None, + sku: Optional["_models.ManagedClusterSKU"] = None, + extended_location: Optional["_models.ExtendedLocation"] = None, + identity: Optional["_models.ManagedClusterIdentity"] = None, kubernetes_version: Optional[str] = None, dns_prefix: Optional[str] = None, fqdn_subdomain: Optional[str] = None, - agent_pool_profiles: Optional[List["ManagedClusterAgentPoolProfile"]] = None, - linux_profile: Optional["ContainerServiceLinuxProfile"] = None, - windows_profile: Optional["ManagedClusterWindowsProfile"] = None, - service_principal_profile: Optional["ManagedClusterServicePrincipalProfile"] = None, - addon_profiles: Optional[Dict[str, "ManagedClusterAddonProfile"]] = None, - pod_identity_profile: Optional["ManagedClusterPodIdentityProfile"] = None, + agent_pool_profiles: Optional[List["_models.ManagedClusterAgentPoolProfile"]] = None, + linux_profile: Optional["_models.ContainerServiceLinuxProfile"] = None, + windows_profile: Optional["_models.ManagedClusterWindowsProfile"] = None, + service_principal_profile: Optional["_models.ManagedClusterServicePrincipalProfile"] = None, + addon_profiles: Optional[Dict[str, "_models.ManagedClusterAddonProfile"]] = None, + pod_identity_profile: Optional["_models.ManagedClusterPodIdentityProfile"] = None, node_resource_group: Optional[str] = None, enable_rbac: Optional[bool] = None, enable_pod_security_policy: Optional[bool] = None, - network_profile: Optional["ContainerServiceNetworkProfile"] = None, - aad_profile: Optional["ManagedClusterAADProfile"] = None, - auto_upgrade_profile: Optional["ManagedClusterAutoUpgradeProfile"] = None, - auto_scaler_profile: Optional["ManagedClusterPropertiesAutoScalerProfile"] = None, - api_server_access_profile: Optional["ManagedClusterAPIServerAccessProfile"] = None, + network_profile: Optional["_models.ContainerServiceNetworkProfile"] = None, + aad_profile: Optional["_models.ManagedClusterAADProfile"] = None, + auto_upgrade_profile: Optional["_models.ManagedClusterAutoUpgradeProfile"] = None, + auto_scaler_profile: Optional["_models.ManagedClusterPropertiesAutoScalerProfile"] = None, + api_server_access_profile: Optional["_models.ManagedClusterAPIServerAccessProfile"] = None, disk_encryption_set_id: Optional[str] = None, - identity_profile: Optional[Dict[str, "UserAssignedIdentity"]] = None, - private_link_resources: Optional[List["PrivateLinkResource"]] = None, + identity_profile: Optional[Dict[str, "_models.UserAssignedIdentity"]] = None, + private_link_resources: Optional[List["_models.PrivateLinkResource"]] = None, disable_local_accounts: Optional[bool] = None, - http_proxy_config: Optional["ManagedClusterHTTPProxyConfig"] = None, - security_profile: Optional["ManagedClusterSecurityProfile"] = None, - storage_profile: Optional["ManagedClusterStorageProfile"] = None, - public_network_access: Optional[Union[str, "PublicNetworkAccess"]] = None, + http_proxy_config: Optional["_models.ManagedClusterHTTPProxyConfig"] = None, + security_profile: Optional["_models.ManagedClusterSecurityProfile"] = None, + storage_profile: Optional["_models.ManagedClusterStorageProfile"] = None, + public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None, **kwargs ): """ @@ -2211,8 +2211,8 @@ def __init__( :keyword storage_profile: Storage profile for the managed cluster. :paramtype storage_profile: ~azure.mgmt.containerservice.v2022_04_01.models.ManagedClusterStorageProfile - :keyword public_network_access: Allow or deny public network access for AKS. Possible values - include: "Enabled", "Disabled". + :keyword public_network_access: Allow or deny public network access for AKS. Known values are: + "Enabled", "Disabled". :paramtype public_network_access: str or ~azure.mgmt.containerservice.v2022_04_01.models.PublicNetworkAccess """ @@ -2530,15 +2530,15 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS - `_. Possible values - include: "Managed", "Ephemeral". + `_. Known values are: + "Managed", "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2022_04_01.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Possible values include: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_04_01.models.KubeletDiskType - :ivar workload_runtime: Determines the type of workload a node can run. Possible values - include: "OCIContainer", "WasmWasi". + :ivar workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer", "WasmWasi". :vartype workload_runtime: str or ~azure.mgmt.containerservice.v2022_04_01.models.WorkloadRuntime :ivar vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and used. @@ -2552,11 +2552,11 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_04_01.models.OSType - :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Possible values include: "Ubuntu", "CBLMariner". + :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known + values are: "Ubuntu", "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2022_04_01.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. :vartype max_count: int @@ -2565,15 +2565,14 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it - defaults to Delete. Possible values include: "Delete", "Deallocate". + defaults to Delete. Known values are: "Delete", "Deallocate". :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_04_01.models.ScaleDownMode - :ivar type: The type of Agent Pool. Possible values include: "VirtualMachineScaleSets", + :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2022_04_01.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Possible values include: "System", - "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". :vartype mode: str or ~azure.mgmt.containerservice.v2022_04_01.models.AgentPoolMode :ivar orchestrator_version: Both patch version (e.g. 1.20.13) and (e.g. 1.20) are supported. When is specified, the latest supported @@ -2616,12 +2615,12 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Possible values include: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_04_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Possible values include: "Delete", - "Deallocate". Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_04_01.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which @@ -2653,7 +2652,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_04_01.models.GPUInstanceProfile :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool @@ -2717,40 +2716,40 @@ def __init__( count: Optional[int] = None, vm_size: Optional[str] = None, os_disk_size_gb: Optional[int] = None, - os_disk_type: Optional[Union[str, "OSDiskType"]] = None, - kubelet_disk_type: Optional[Union[str, "KubeletDiskType"]] = None, - workload_runtime: Optional[Union[str, "WorkloadRuntime"]] = None, + os_disk_type: Optional[Union[str, "_models.OSDiskType"]] = None, + kubelet_disk_type: Optional[Union[str, "_models.KubeletDiskType"]] = None, + workload_runtime: Optional[Union[str, "_models.WorkloadRuntime"]] = None, vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", - os_sku: Optional[Union[str, "OSSKU"]] = None, + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - scale_down_mode: Optional[Union[str, "ScaleDownMode"]] = None, - type: Optional[Union[str, "AgentPoolType"]] = None, - mode: Optional[Union[str, "AgentPoolMode"]] = None, + scale_down_mode: Optional[Union[str, "_models.ScaleDownMode"]] = None, + type: Optional[Union[str, "_models.AgentPoolType"]] = None, + mode: Optional[Union[str, "_models.AgentPoolMode"]] = None, orchestrator_version: Optional[str] = None, - upgrade_settings: Optional["AgentPoolUpgradeSettings"] = None, - power_state: Optional["PowerState"] = None, + upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, + power_state: Optional["_models.PowerState"] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", spot_max_price: Optional[float] = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, proximity_placement_group_id: Optional[str] = None, - kubelet_config: Optional["KubeletConfig"] = None, - linux_os_config: Optional["LinuxOSConfig"] = None, + kubelet_config: Optional["_models.KubeletConfig"] = None, + linux_os_config: Optional["_models.LinuxOSConfig"] = None, enable_encryption_at_host: Optional[bool] = None, enable_ultra_ssd: Optional[bool] = None, enable_fips: Optional[bool] = None, - gpu_instance_profile: Optional[Union[str, "GPUInstanceProfile"]] = None, - creation_data: Optional["CreationData"] = None, + gpu_instance_profile: Optional[Union[str, "_models.GPUInstanceProfile"]] = None, + creation_data: Optional["_models.CreationData"] = None, **kwargs ): """ @@ -2769,15 +2768,15 @@ def __init__( :keyword os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS - `_. Possible values - include: "Managed", "Ephemeral". + `_. Known values are: + "Managed", "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2022_04_01.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Possible values include: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_04_01.models.KubeletDiskType - :keyword workload_runtime: Determines the type of workload a node can run. Possible values - include: "OCIContainer", "WasmWasi". + :keyword workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer", "WasmWasi". :paramtype workload_runtime: str or ~azure.mgmt.containerservice.v2022_04_01.models.WorkloadRuntime :keyword vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and @@ -2791,11 +2790,11 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_04_01.models.OSType :keyword os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Possible values include: "Ubuntu", "CBLMariner". + Known values are: "Ubuntu", "CBLMariner". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2022_04_01.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -2804,16 +2803,15 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, - it defaults to Delete. Possible values include: "Delete", "Deallocate". + it defaults to Delete. Known values are: "Delete", "Deallocate". :paramtype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_04_01.models.ScaleDownMode - :keyword type: The type of Agent Pool. Possible values include: "VirtualMachineScaleSets", + :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2022_04_01.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Possible values include: "System", - "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2022_04_01.models.AgentPoolMode :keyword orchestrator_version: Both patch version (e.g. 1.20.13) and (e.g. 1.20) are supported. When is specified, the latest supported @@ -2848,12 +2846,12 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Possible values include: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_04_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Possible values include: "Delete", - "Deallocate". Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_04_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which @@ -2885,7 +2883,7 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_04_01.models.GPUInstanceProfile @@ -2958,15 +2956,15 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS - `_. Possible values - include: "Managed", "Ephemeral". + `_. Known values are: + "Managed", "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2022_04_01.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Possible values include: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_04_01.models.KubeletDiskType - :ivar workload_runtime: Determines the type of workload a node can run. Possible values - include: "OCIContainer", "WasmWasi". + :ivar workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer", "WasmWasi". :vartype workload_runtime: str or ~azure.mgmt.containerservice.v2022_04_01.models.WorkloadRuntime :ivar vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and used. @@ -2980,11 +2978,11 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_04_01.models.OSType - :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Possible values include: "Ubuntu", "CBLMariner". + :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known + values are: "Ubuntu", "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2022_04_01.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. :vartype max_count: int @@ -2993,15 +2991,14 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it - defaults to Delete. Possible values include: "Delete", "Deallocate". + defaults to Delete. Known values are: "Delete", "Deallocate". :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_04_01.models.ScaleDownMode - :ivar type: The type of Agent Pool. Possible values include: "VirtualMachineScaleSets", + :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2022_04_01.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Possible values include: "System", - "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". :vartype mode: str or ~azure.mgmt.containerservice.v2022_04_01.models.AgentPoolMode :ivar orchestrator_version: Both patch version (e.g. 1.20.13) and (e.g. 1.20) are supported. When is specified, the latest supported @@ -3044,12 +3041,12 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Possible values include: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_04_01.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Possible values include: "Delete", - "Deallocate". Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_04_01.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which @@ -3081,7 +3078,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_04_01.models.GPUInstanceProfile :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool @@ -3150,40 +3147,40 @@ def __init__( count: Optional[int] = None, vm_size: Optional[str] = None, os_disk_size_gb: Optional[int] = None, - os_disk_type: Optional[Union[str, "OSDiskType"]] = None, - kubelet_disk_type: Optional[Union[str, "KubeletDiskType"]] = None, - workload_runtime: Optional[Union[str, "WorkloadRuntime"]] = None, + os_disk_type: Optional[Union[str, "_models.OSDiskType"]] = None, + kubelet_disk_type: Optional[Union[str, "_models.KubeletDiskType"]] = None, + workload_runtime: Optional[Union[str, "_models.WorkloadRuntime"]] = None, vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", - os_sku: Optional[Union[str, "OSSKU"]] = None, + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - scale_down_mode: Optional[Union[str, "ScaleDownMode"]] = None, - type: Optional[Union[str, "AgentPoolType"]] = None, - mode: Optional[Union[str, "AgentPoolMode"]] = None, + scale_down_mode: Optional[Union[str, "_models.ScaleDownMode"]] = None, + type: Optional[Union[str, "_models.AgentPoolType"]] = None, + mode: Optional[Union[str, "_models.AgentPoolMode"]] = None, orchestrator_version: Optional[str] = None, - upgrade_settings: Optional["AgentPoolUpgradeSettings"] = None, - power_state: Optional["PowerState"] = None, + upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, + power_state: Optional["_models.PowerState"] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", spot_max_price: Optional[float] = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, proximity_placement_group_id: Optional[str] = None, - kubelet_config: Optional["KubeletConfig"] = None, - linux_os_config: Optional["LinuxOSConfig"] = None, + kubelet_config: Optional["_models.KubeletConfig"] = None, + linux_os_config: Optional["_models.LinuxOSConfig"] = None, enable_encryption_at_host: Optional[bool] = None, enable_ultra_ssd: Optional[bool] = None, enable_fips: Optional[bool] = None, - gpu_instance_profile: Optional[Union[str, "GPUInstanceProfile"]] = None, - creation_data: Optional["CreationData"] = None, + gpu_instance_profile: Optional[Union[str, "_models.GPUInstanceProfile"]] = None, + creation_data: Optional["_models.CreationData"] = None, **kwargs ): """ @@ -3202,15 +3199,15 @@ def __init__( :keyword os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS - `_. Possible values - include: "Managed", "Ephemeral". + `_. Known values are: + "Managed", "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2022_04_01.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Possible values include: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_04_01.models.KubeletDiskType - :keyword workload_runtime: Determines the type of workload a node can run. Possible values - include: "OCIContainer", "WasmWasi". + :keyword workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer", "WasmWasi". :paramtype workload_runtime: str or ~azure.mgmt.containerservice.v2022_04_01.models.WorkloadRuntime :keyword vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and @@ -3224,11 +3221,11 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_04_01.models.OSType :keyword os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Possible values include: "Ubuntu", "CBLMariner". + Known values are: "Ubuntu", "CBLMariner". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2022_04_01.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. :paramtype max_count: int @@ -3237,16 +3234,15 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, - it defaults to Delete. Possible values include: "Delete", "Deallocate". + it defaults to Delete. Known values are: "Delete", "Deallocate". :paramtype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_04_01.models.ScaleDownMode - :keyword type: The type of Agent Pool. Possible values include: "VirtualMachineScaleSets", + :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2022_04_01.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Possible values include: "System", - "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2022_04_01.models.AgentPoolMode :keyword orchestrator_version: Both patch version (e.g. 1.20.13) and (e.g. 1.20) are supported. When is specified, the latest supported @@ -3281,12 +3277,12 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Possible values include: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_04_01.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Possible values include: "Delete", - "Deallocate". Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_04_01.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which @@ -3318,7 +3314,7 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_04_01.models.GPUInstanceProfile @@ -3403,8 +3399,8 @@ class ManagedClusterAutoUpgradeProfile(msrest.serialization.Model): """Auto upgrade profile for a managed cluster. :ivar upgrade_channel: For more information see `setting the AKS cluster auto-upgrade channel - `_. Possible - values include: "rapid", "stable", "patch", "node-image", "none". + `_. Known values + are: "rapid", "stable", "patch", "node-image", "none". :vartype upgrade_channel: str or ~azure.mgmt.containerservice.v2022_04_01.models.UpgradeChannel """ @@ -3415,13 +3411,13 @@ class ManagedClusterAutoUpgradeProfile(msrest.serialization.Model): def __init__( self, *, - upgrade_channel: Optional[Union[str, "UpgradeChannel"]] = None, + upgrade_channel: Optional[Union[str, "_models.UpgradeChannel"]] = None, **kwargs ): """ :keyword upgrade_channel: For more information see `setting the AKS cluster auto-upgrade channel `_. - Possible values include: "rapid", "stable", "patch", "node-image", "none". + Known values are: "rapid", "stable", "patch", "node-image", "none". :paramtype upgrade_channel: str or ~azure.mgmt.containerservice.v2022_04_01.models.UpgradeChannel """ @@ -3487,7 +3483,7 @@ class ManagedClusterIdentity(msrest.serialization.Model): components. :vartype tenant_id: str :ivar type: For more information see `use managed identities in AKS - `_. Possible values include: + `_. Known values are: "SystemAssigned", "UserAssigned", "None". :vartype type: str or ~azure.mgmt.containerservice.v2022_04_01.models.ResourceIdentityType :ivar user_assigned_identities: The keys must be ARM resource IDs in the form: @@ -3511,13 +3507,13 @@ class ManagedClusterIdentity(msrest.serialization.Model): def __init__( self, *, - type: Optional[Union[str, "ResourceIdentityType"]] = None, - user_assigned_identities: Optional[Dict[str, "ManagedServiceIdentityUserAssignedIdentitiesValue"]] = None, + type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, + user_assigned_identities: Optional[Dict[str, "_models.ManagedServiceIdentityUserAssignedIdentitiesValue"]] = None, **kwargs ): """ :keyword type: For more information see `use managed identities in AKS - `_. Possible values include: + `_. Known values are: "SystemAssigned", "UserAssigned", "None". :paramtype type: str or ~azure.mgmt.containerservice.v2022_04_01.models.ResourceIdentityType :keyword user_assigned_identities: The keys must be ARM resource IDs in the form: @@ -3555,7 +3551,7 @@ class ManagedClusterListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["ManagedCluster"]] = None, + value: Optional[List["_models.ManagedCluster"]] = None, **kwargs ): """ @@ -3613,10 +3609,10 @@ class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): def __init__( self, *, - managed_outbound_i_ps: Optional["ManagedClusterLoadBalancerProfileManagedOutboundIPs"] = None, - outbound_ip_prefixes: Optional["ManagedClusterLoadBalancerProfileOutboundIPPrefixes"] = None, - outbound_i_ps: Optional["ManagedClusterLoadBalancerProfileOutboundIPs"] = None, - effective_outbound_i_ps: Optional[List["ResourceReference"]] = None, + managed_outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileManagedOutboundIPs"] = None, + outbound_ip_prefixes: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPPrefixes"] = None, + outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPs"] = None, + effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, allocated_outbound_ports: Optional[int] = 0, idle_timeout_in_minutes: Optional[int] = 30, enable_multiple_standard_load_balancers: Optional[bool] = None, @@ -3718,7 +3714,7 @@ class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.M def __init__( self, *, - public_ip_prefixes: Optional[List["ResourceReference"]] = None, + public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, **kwargs ): """ @@ -3744,7 +3740,7 @@ class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): def __init__( self, *, - public_i_ps: Optional[List["ResourceReference"]] = None, + public_i_ps: Optional[List["_models.ResourceReference"]] = None, **kwargs ): """ @@ -3814,8 +3810,8 @@ class ManagedClusterNATGatewayProfile(msrest.serialization.Model): def __init__( self, *, - managed_outbound_ip_profile: Optional["ManagedClusterManagedOutboundIPProfile"] = None, - effective_outbound_i_ps: Optional[List["ResourceReference"]] = None, + managed_outbound_ip_profile: Optional["_models.ManagedClusterManagedOutboundIPProfile"] = None, + effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, idle_timeout_in_minutes: Optional[int] = 4, **kwargs ): @@ -3853,8 +3849,8 @@ class ManagedClusterPodIdentity(msrest.serialization.Model): :vartype binding_selector: str :ivar identity: Required. The user assigned identity details. :vartype identity: ~azure.mgmt.containerservice.v2022_04_01.models.UserAssignedIdentity - :ivar provisioning_state: The current provisioning state of the pod identity. Possible values - include: "Assigned", "Updating", "Deleting", "Failed". + :ivar provisioning_state: The current provisioning state of the pod identity. Known values are: + "Assigned", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2022_04_01.models.ManagedClusterPodIdentityProvisioningState :ivar provisioning_info: @@ -3884,7 +3880,7 @@ def __init__( *, name: str, namespace: str, - identity: "UserAssignedIdentity", + identity: "_models.UserAssignedIdentity", binding_selector: Optional[str] = None, **kwargs ): @@ -3985,8 +3981,8 @@ def __init__( *, enabled: Optional[bool] = None, allow_network_plugin_kubenet: Optional[bool] = None, - user_assigned_identities: Optional[List["ManagedClusterPodIdentity"]] = None, - user_assigned_identity_exceptions: Optional[List["ManagedClusterPodIdentityException"]] = None, + user_assigned_identities: Optional[List["_models.ManagedClusterPodIdentity"]] = None, + user_assigned_identity_exceptions: Optional[List["_models.ManagedClusterPodIdentityException"]] = None, **kwargs ): """ @@ -4027,7 +4023,7 @@ class ManagedClusterPodIdentityProvisioningError(msrest.serialization.Model): def __init__( self, *, - error: Optional["ManagedClusterPodIdentityProvisioningErrorBody"] = None, + error: Optional["_models.ManagedClusterPodIdentityProvisioningErrorBody"] = None, **kwargs ): """ @@ -4069,7 +4065,7 @@ def __init__( code: Optional[str] = None, message: Optional[str] = None, target: Optional[str] = None, - details: Optional[List["ManagedClusterPodIdentityProvisioningErrorBody"]] = None, + details: Optional[List["_models.ManagedClusterPodIdentityProvisioningErrorBody"]] = None, **kwargs ): """ @@ -4108,7 +4104,7 @@ class ManagedClusterPodIdentityProvisioningInfo(msrest.serialization.Model): def __init__( self, *, - error: Optional["ManagedClusterPodIdentityProvisioningError"] = None, + error: Optional["_models.ManagedClusterPodIdentityProvisioningError"] = None, **kwargs ): """ @@ -4129,8 +4125,8 @@ class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): :vartype kubernetes_version: str :ivar name: The Agent Pool name. :vartype name: str - :ivar os_type: Required. The operating system type. The default is Linux. Possible values - include: "Linux", "Windows". Default value: "Linux". + :ivar os_type: Required. The operating system type. The default is Linux. Known values are: + "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_04_01.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -4153,9 +4149,9 @@ def __init__( self, *, kubernetes_version: str, - os_type: Union[str, "OSType"] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", name: Optional[str] = None, - upgrades: Optional[List["ManagedClusterPoolUpgradeProfileUpgradesItem"]] = None, + upgrades: Optional[List["_models.ManagedClusterPoolUpgradeProfileUpgradesItem"]] = None, **kwargs ): """ @@ -4163,8 +4159,8 @@ def __init__( :paramtype kubernetes_version: str :keyword name: The Agent Pool name. :paramtype name: str - :keyword os_type: Required. The operating system type. The default is Linux. Possible values - include: "Linux", "Windows". Default value: "Linux". + :keyword os_type: Required. The operating system type. The default is Linux. Known values are: + "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_04_01.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: @@ -4216,8 +4212,7 @@ class ManagedClusterPropertiesAutoScalerProfile(msrest.serialization.Model): :vartype balance_similar_node_groups: str :ivar expander: If not specified, the default is 'random'. See `expanders `_ - for more information. Possible values include: "least-waste", "most-pods", "priority", - "random". + for more information. Known values are: "least-waste", "most-pods", "priority", "random". :vartype expander: str or ~azure.mgmt.containerservice.v2022_04_01.models.Expander :ivar max_empty_bulk_delete: The default is 10. :vartype max_empty_bulk_delete: str @@ -4284,7 +4279,7 @@ def __init__( self, *, balance_similar_node_groups: Optional[str] = None, - expander: Optional[Union[str, "Expander"]] = None, + expander: Optional[Union[str, "_models.Expander"]] = None, max_empty_bulk_delete: Optional[str] = None, max_graceful_termination_sec: Optional[str] = None, max_node_provision_time: Optional[str] = None, @@ -4307,8 +4302,7 @@ def __init__( :paramtype balance_similar_node_groups: str :keyword expander: If not specified, the default is 'random'. See `expanders `_ - for more information. Possible values include: "least-waste", "most-pods", "priority", - "random". + for more information. Known values are: "least-waste", "most-pods", "priority", "random". :paramtype expander: str or ~azure.mgmt.containerservice.v2022_04_01.models.Expander :keyword max_empty_bulk_delete: The default is 10. :paramtype max_empty_bulk_delete: str @@ -4386,7 +4380,7 @@ class ManagedClusterSecurityProfile(msrest.serialization.Model): def __init__( self, *, - azure_defender: Optional["ManagedClusterSecurityProfileAzureDefender"] = None, + azure_defender: Optional["_models.ManagedClusterSecurityProfileAzureDefender"] = None, **kwargs ): """ @@ -4475,11 +4469,11 @@ def __init__( class ManagedClusterSKU(msrest.serialization.Model): """The SKU of a Managed Cluster. - :ivar name: The name of a managed cluster SKU. Possible values include: "Basic". + :ivar name: The name of a managed cluster SKU. Known values are: "Basic". :vartype name: str or ~azure.mgmt.containerservice.v2022_04_01.models.ManagedClusterSKUName :ivar tier: If not specified, the default is 'Free'. See `uptime SLA - `_ for more details. Possible values include: - "Paid", "Free". + `_ for more details. Known values are: "Paid", + "Free". :vartype tier: str or ~azure.mgmt.containerservice.v2022_04_01.models.ManagedClusterSKUTier """ @@ -4491,16 +4485,16 @@ class ManagedClusterSKU(msrest.serialization.Model): def __init__( self, *, - name: Optional[Union[str, "ManagedClusterSKUName"]] = None, - tier: Optional[Union[str, "ManagedClusterSKUTier"]] = None, + name: Optional[Union[str, "_models.ManagedClusterSKUName"]] = None, + tier: Optional[Union[str, "_models.ManagedClusterSKUTier"]] = None, **kwargs ): """ - :keyword name: The name of a managed cluster SKU. Possible values include: "Basic". + :keyword name: The name of a managed cluster SKU. Known values are: "Basic". :paramtype name: str or ~azure.mgmt.containerservice.v2022_04_01.models.ManagedClusterSKUName :keyword tier: If not specified, the default is 'Free'. See `uptime SLA - `_ for more details. Possible values include: - "Paid", "Free". + `_ for more details. Known values are: "Paid", + "Free". :paramtype tier: str or ~azure.mgmt.containerservice.v2022_04_01.models.ManagedClusterSKUTier """ super(ManagedClusterSKU, self).__init__(**kwargs) @@ -4531,9 +4525,9 @@ class ManagedClusterStorageProfile(msrest.serialization.Model): def __init__( self, *, - disk_csi_driver: Optional["ManagedClusterStorageProfileDiskCSIDriver"] = None, - file_csi_driver: Optional["ManagedClusterStorageProfileFileCSIDriver"] = None, - snapshot_controller: Optional["ManagedClusterStorageProfileSnapshotController"] = None, + disk_csi_driver: Optional["_models.ManagedClusterStorageProfileDiskCSIDriver"] = None, + file_csi_driver: Optional["_models.ManagedClusterStorageProfileFileCSIDriver"] = None, + snapshot_controller: Optional["_models.ManagedClusterStorageProfileSnapshotController"] = None, **kwargs ): """ @@ -4669,8 +4663,8 @@ class ManagedClusterUpgradeProfile(msrest.serialization.Model): def __init__( self, *, - control_plane_profile: "ManagedClusterPoolUpgradeProfile", - agent_pool_profiles: List["ManagedClusterPoolUpgradeProfile"], + control_plane_profile: "_models.ManagedClusterPoolUpgradeProfile", + agent_pool_profiles: List["_models.ManagedClusterPoolUpgradeProfile"], **kwargs ): """ @@ -4712,8 +4706,8 @@ class ManagedClusterWindowsProfile(msrest.serialization.Model): "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!". :vartype admin_password: str :ivar license_type: The license type to use for Windows VMs. See `Azure Hybrid User Benefits - `_ for more details. Possible values - include: "None", "Windows_Server". + `_ for more details. Known values are: + "None", "Windows_Server". :vartype license_type: str or ~azure.mgmt.containerservice.v2022_04_01.models.LicenseType :ivar enable_csi_proxy: For more details on CSI proxy, see the `CSI proxy GitHub repo `_. @@ -4739,9 +4733,9 @@ def __init__( *, admin_username: str, admin_password: Optional[str] = None, - license_type: Optional[Union[str, "LicenseType"]] = None, + license_type: Optional[Union[str, "_models.LicenseType"]] = None, enable_csi_proxy: Optional[bool] = None, - gmsa_profile: Optional["WindowsGmsaProfile"] = None, + gmsa_profile: Optional["_models.WindowsGmsaProfile"] = None, **kwargs ): """ @@ -4762,8 +4756,8 @@ def __init__( "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!". :paramtype admin_password: str :keyword license_type: The license type to use for Windows VMs. See `Azure Hybrid User Benefits - `_ for more details. Possible values - include: "None", "Windows_Server". + `_ for more details. Known values are: + "None", "Windows_Server". :paramtype license_type: str or ~azure.mgmt.containerservice.v2022_04_01.models.LicenseType :keyword enable_csi_proxy: For more details on CSI proxy, see the `CSI proxy GitHub repo `_. @@ -4925,7 +4919,7 @@ class OSOptionProfile(msrest.serialization.Model): def __init__( self, *, - os_option_property_list: List["OSOptionProperty"], + os_option_property_list: List["_models.OSOptionProperty"], **kwargs ): """ @@ -4998,7 +4992,7 @@ def __init__( self, *, category: Optional[str] = None, - endpoints: Optional[List["EndpointDependency"]] = None, + endpoints: Optional[List["_models.EndpointDependency"]] = None, **kwargs ): """ @@ -5040,7 +5034,7 @@ class OutboundEnvironmentEndpointCollection(msrest.serialization.Model): def __init__( self, *, - value: List["OutboundEnvironmentEndpoint"], + value: List["_models.OutboundEnvironmentEndpoint"], **kwargs ): """ @@ -5056,8 +5050,8 @@ def __init__( class PowerState(msrest.serialization.Model): """Describes the Power State of the cluster. - :ivar code: Tells whether the cluster is Running or Stopped. Possible values include: - "Running", "Stopped". + :ivar code: Tells whether the cluster is Running or Stopped. Known values are: "Running", + "Stopped". :vartype code: str or ~azure.mgmt.containerservice.v2022_04_01.models.Code """ @@ -5068,12 +5062,12 @@ class PowerState(msrest.serialization.Model): def __init__( self, *, - code: Optional[Union[str, "Code"]] = None, + code: Optional[Union[str, "_models.Code"]] = None, **kwargs ): """ - :keyword code: Tells whether the cluster is Running or Stopped. Possible values include: - "Running", "Stopped". + :keyword code: Tells whether the cluster is Running or Stopped. Known values are: "Running", + "Stopped". :paramtype code: str or ~azure.mgmt.containerservice.v2022_04_01.models.Code """ super(PowerState, self).__init__(**kwargs) @@ -5116,7 +5110,7 @@ class PrivateEndpointConnection(msrest.serialization.Model): :vartype name: str :ivar type: The resource type. :vartype type: str - :ivar provisioning_state: The current provisioning state. Possible values include: "Succeeded", + :ivar provisioning_state: The current provisioning state. Known values are: "Succeeded", "Creating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2022_04_01.models.PrivateEndpointConnectionProvisioningState @@ -5147,8 +5141,8 @@ class PrivateEndpointConnection(msrest.serialization.Model): def __init__( self, *, - private_endpoint: Optional["PrivateEndpoint"] = None, - private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, + private_endpoint: Optional["_models.PrivateEndpoint"] = None, + private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionState"] = None, **kwargs ): """ @@ -5182,7 +5176,7 @@ class PrivateEndpointConnectionListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["PrivateEndpointConnection"]] = None, + value: Optional[List["_models.PrivateEndpointConnection"]] = None, **kwargs ): """ @@ -5272,7 +5266,7 @@ class PrivateLinkResourcesListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["PrivateLinkResource"]] = None, + value: Optional[List["_models.PrivateLinkResource"]] = None, **kwargs ): """ @@ -5286,7 +5280,7 @@ def __init__( class PrivateLinkServiceConnectionState(msrest.serialization.Model): """The state of a private link service connection. - :ivar status: The private link service connection status. Possible values include: "Pending", + :ivar status: The private link service connection status. Known values are: "Pending", "Approved", "Rejected", "Disconnected". :vartype status: str or ~azure.mgmt.containerservice.v2022_04_01.models.ConnectionStatus :ivar description: The private link service connection description. @@ -5301,13 +5295,13 @@ class PrivateLinkServiceConnectionState(msrest.serialization.Model): def __init__( self, *, - status: Optional[Union[str, "ConnectionStatus"]] = None, + status: Optional[Union[str, "_models.ConnectionStatus"]] = None, description: Optional[str] = None, **kwargs ): """ - :keyword status: The private link service connection status. Possible values include: - "Pending", "Approved", "Rejected", "Disconnected". + :keyword status: The private link service connection status. Known values are: "Pending", + "Approved", "Rejected", "Disconnected". :paramtype status: str or ~azure.mgmt.containerservice.v2022_04_01.models.ConnectionStatus :keyword description: The private link service connection description. :paramtype description: str @@ -5469,18 +5463,18 @@ class Snapshot(TrackedResource): :ivar creation_data: CreationData to be used to specify the source agent pool resource ID to create this snapshot. :vartype creation_data: ~azure.mgmt.containerservice.v2022_04_01.models.CreationData - :ivar snapshot_type: The type of a snapshot. The default is NodePool. Possible values include: + :ivar snapshot_type: The type of a snapshot. The default is NodePool. Known values are: "NodePool". Default value: "NodePool". :vartype snapshot_type: str or ~azure.mgmt.containerservice.v2022_04_01.models.SnapshotType :ivar kubernetes_version: The version of Kubernetes. :vartype kubernetes_version: str :ivar node_image_version: The version of node image. :vartype node_image_version: str - :ivar os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_04_01.models.OSType - :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. - Possible values include: "Ubuntu", "CBLMariner". + :ivar os_sku: Specifies an OS SKU. This value must not be specified if OSType is Windows. Known + values are: "Ubuntu", "CBLMariner". :vartype os_sku: str or ~azure.mgmt.containerservice.v2022_04_01.models.OSSKU :ivar vm_size: The size of the VM. :vartype vm_size: str @@ -5524,8 +5518,8 @@ def __init__( *, location: str, tags: Optional[Dict[str, str]] = None, - creation_data: Optional["CreationData"] = None, - snapshot_type: Optional[Union[str, "SnapshotType"]] = "NodePool", + creation_data: Optional["_models.CreationData"] = None, + snapshot_type: Optional[Union[str, "_models.SnapshotType"]] = "NodePool", **kwargs ): """ @@ -5536,8 +5530,8 @@ def __init__( :keyword creation_data: CreationData to be used to specify the source agent pool resource ID to create this snapshot. :paramtype creation_data: ~azure.mgmt.containerservice.v2022_04_01.models.CreationData - :keyword snapshot_type: The type of a snapshot. The default is NodePool. Possible values - include: "NodePool". Default value: "NodePool". + :keyword snapshot_type: The type of a snapshot. The default is NodePool. Known values are: + "NodePool". Default value: "NodePool". :paramtype snapshot_type: str or ~azure.mgmt.containerservice.v2022_04_01.models.SnapshotType """ super(Snapshot, self).__init__(tags=tags, location=location, **kwargs) @@ -5574,7 +5568,7 @@ class SnapshotListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["Snapshot"]] = None, + value: Optional[List["_models.Snapshot"]] = None, **kwargs ): """ @@ -5805,15 +5799,15 @@ class SystemData(msrest.serialization.Model): :ivar created_by: The identity that created the resource. :vartype created_by: str - :ivar created_by_type: The type of identity that created the resource. Possible values include: + :ivar created_by_type: The type of identity that created the resource. Known values are: "User", "Application", "ManagedIdentity", "Key". :vartype created_by_type: str or ~azure.mgmt.containerservice.v2022_04_01.models.CreatedByType :ivar created_at: The timestamp of resource creation (UTC). :vartype created_at: ~datetime.datetime :ivar last_modified_by: The identity that last modified the resource. :vartype last_modified_by: str - :ivar last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". + :ivar last_modified_by_type: The type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", "Key". :vartype last_modified_by_type: str or ~azure.mgmt.containerservice.v2022_04_01.models.CreatedByType :ivar last_modified_at: The timestamp of resource last modification (UTC). @@ -5833,26 +5827,26 @@ def __init__( self, *, created_by: Optional[str] = None, - created_by_type: Optional[Union[str, "CreatedByType"]] = None, + created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, created_at: Optional[datetime.datetime] = None, last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[Union[str, "CreatedByType"]] = None, + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, last_modified_at: Optional[datetime.datetime] = None, **kwargs ): """ :keyword created_by: The identity that created the resource. :paramtype created_by: str - :keyword created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". + :keyword created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", "Key". :paramtype created_by_type: str or ~azure.mgmt.containerservice.v2022_04_01.models.CreatedByType :keyword created_at: The timestamp of resource creation (UTC). :paramtype created_at: ~datetime.datetime :keyword last_modified_by: The identity that last modified the resource. :paramtype last_modified_by: str - :keyword last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". + :keyword last_modified_by_type: The type of identity that last modified the resource. Known + values are: "User", "Application", "ManagedIdentity", "Key". :paramtype last_modified_by_type: str or ~azure.mgmt.containerservice.v2022_04_01.models.CreatedByType :keyword last_modified_at: The timestamp of resource last modification (UTC). @@ -5895,8 +5889,8 @@ def __init__( class TimeInWeek(msrest.serialization.Model): """Time in a week. - :ivar day: The day of the week. Possible values include: "Sunday", "Monday", "Tuesday", - "Wednesday", "Thursday", "Friday", "Saturday". + :ivar day: The day of the week. Known values are: "Sunday", "Monday", "Tuesday", "Wednesday", + "Thursday", "Friday", "Saturday". :vartype day: str or ~azure.mgmt.containerservice.v2022_04_01.models.WeekDay :ivar hour_slots: Each integer hour represents a time range beginning at 0m after the hour ending at the next hour (non-inclusive). 0 corresponds to 00:00 UTC, 23 corresponds to 23:00 @@ -5912,12 +5906,12 @@ class TimeInWeek(msrest.serialization.Model): def __init__( self, *, - day: Optional[Union[str, "WeekDay"]] = None, + day: Optional[Union[str, "_models.WeekDay"]] = None, hour_slots: Optional[List[int]] = None, **kwargs ): """ - :keyword day: The day of the week. Possible values include: "Sunday", "Monday", "Tuesday", + :keyword day: The day of the week. Known values are: "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday". :paramtype day: str or ~azure.mgmt.containerservice.v2022_04_01.models.WeekDay :keyword hour_slots: Each integer hour represents a time range beginning at 0m after the hour diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/models/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/models/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/operations/__init__.py index 5e1e5e72fa59..e0748876288c 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/operations/__init__.py @@ -15,6 +15,9 @@ from ._resolve_private_link_service_id_operations import ResolvePrivateLinkServiceIdOperations from ._snapshots_operations import SnapshotsOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'Operations', 'ManagedClustersOperations', @@ -25,3 +28,5 @@ 'ResolvePrivateLinkServiceIdOperations', 'SnapshotsOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/operations/_agent_pools_operations.py index fca852588aeb..65692ea16221 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/operations/_agent_pools_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -35,9 +35,12 @@ def build_list_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools") # pylint: disable=line-too-long path_format_arguments = { @@ -49,18 +52,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -72,9 +73,12 @@ def build_get_request( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -87,18 +91,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -109,14 +111,17 @@ def build_create_or_update_request_initial( resource_name: str, agent_pool_name: str, *, - json: JSONType = None, + json: Optional[_models.AgentPool] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -129,20 +134,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -156,9 +159,12 @@ def build_delete_request_initial( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -171,18 +177,16 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -194,9 +198,12 @@ def build_get_upgrade_profile_request( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default") # pylint: disable=line-too-long path_format_arguments = { @@ -209,18 +216,16 @@ def build_get_upgrade_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -231,9 +236,12 @@ def build_get_available_agent_pool_versions_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions") # pylint: disable=line-too-long path_format_arguments = { @@ -245,18 +253,16 @@ def build_get_available_agent_pool_versions_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -268,9 +274,12 @@ def build_upgrade_node_image_version_request_initial( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion") # pylint: disable=line-too-long path_format_arguments = { @@ -283,42 +292,38 @@ def build_upgrade_node_image_version_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class AgentPoolsOperations(object): - """AgentPoolsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class AgentPoolsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_04_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_04_01.ContainerServiceClient`'s + :attr:`agent_pools` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -326,7 +331,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Iterable["_models.AgentPoolListResult"]: + ) -> Iterable[_models.AgentPoolListResult]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. @@ -341,13 +346,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_04_01.models.AgentPoolListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -357,9 +365,11 @@ def prepare_request(next_link=None): resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -369,9 +379,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -411,7 +423,7 @@ def get( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPool": + ) -> _models.AgentPool: """Gets the specified managed cluster agent pool. Gets the specified managed cluster agent pool. @@ -427,13 +439,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.AgentPool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] request = build_get_request( @@ -443,11 +458,13 @@ def get( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -473,17 +490,20 @@ def _create_or_update_initial( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> "_models.AgentPool": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] + ) -> _models.AgentPool: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] _json = self._serialize.body(parameters, 'AgentPool') @@ -496,11 +516,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -531,9 +553,9 @@ def begin_create_or_update( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> LROPoller["_models.AgentPool"]: + ) -> LROPoller[_models.AgentPool]: """Creates or updates an agent pool in the specified managed cluster. Creates or updates an agent pool in the specified managed cluster. @@ -559,17 +581,20 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_04_01.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, @@ -577,20 +602,27 @@ def begin_create_or_update( 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): - response = pipeline_response.http_response deserialized = self._deserialize('AgentPool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -610,13 +642,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements agent_pool_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -626,11 +661,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -677,21 +714,26 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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) @@ -701,8 +743,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -722,7 +770,7 @@ def get_upgrade_profile( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPoolUpgradeProfile": + ) -> _models.AgentPoolUpgradeProfile: """Gets the upgrade profile for an agent pool. Gets the upgrade profile for an agent pool. @@ -738,13 +786,16 @@ def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.AgentPoolUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] request = build_get_upgrade_profile_request( @@ -754,11 +805,13 @@ def get_upgrade_profile( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -785,7 +838,7 @@ def get_available_agent_pool_versions( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.AgentPoolAvailableVersions": + ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported Kubernetes versions for the specified agent pool. See `supported Kubernetes versions @@ -801,13 +854,16 @@ def get_available_agent_pool_versions( :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.AgentPoolAvailableVersions :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolAvailableVersions"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] request = build_get_available_agent_pool_versions_request( @@ -816,11 +872,13 @@ def get_available_agent_pool_versions( resource_name=resource_name, api_version=api_version, template_url=self.get_available_agent_pool_versions.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -847,14 +905,17 @@ def _upgrade_node_image_version_initial( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> Optional["_models.AgentPool"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.AgentPool"]] + ) -> Optional[_models.AgentPool]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] request = build_upgrade_node_image_version_request_initial( @@ -864,11 +925,13 @@ def _upgrade_node_image_version_initial( agent_pool_name=agent_pool_name, api_version=api_version, template_url=self._upgrade_node_image_version_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -901,7 +964,7 @@ def begin_upgrade_node_image_version( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> LROPoller["_models.AgentPool"]: + ) -> LROPoller[_models.AgentPool]: """Upgrades the node image version of an agent pool to the latest. Upgrading the node image version of an agent pool applies the newest OS and runtime updates to @@ -927,21 +990,26 @@ def begin_upgrade_node_image_version( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_04_01.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._upgrade_node_image_version_initial( + raw_result = self._upgrade_node_image_version_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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) @@ -957,8 +1025,14 @@ def get_long_running_output(pipeline_response): return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/operations/_maintenance_configurations_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/operations/_maintenance_configurations_operations.py index 6ea0430b957e..8da22a45b046 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/operations/_maintenance_configurations_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/operations/_maintenance_configurations_operations.py @@ -16,12 +16,12 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -33,9 +33,12 @@ def build_list_by_managed_cluster_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations") # pylint: disable=line-too-long path_format_arguments = { @@ -47,18 +50,16 @@ def build_list_by_managed_cluster_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -70,9 +71,12 @@ def build_get_request( config_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long path_format_arguments = { @@ -85,18 +89,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -107,14 +109,17 @@ def build_create_or_update_request( resource_name: str, config_name: str, *, - json: JSONType = None, + json: Optional[_models.MaintenanceConfiguration] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long path_format_arguments = { @@ -127,20 +132,18 @@ def build_create_or_update_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -154,9 +157,12 @@ def build_delete_request( config_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long path_format_arguments = { @@ -169,42 +175,38 @@ def build_delete_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class MaintenanceConfigurationsOperations(object): - """MaintenanceConfigurationsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class MaintenanceConfigurationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_04_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_04_01.ContainerServiceClient`'s + :attr:`maintenance_configurations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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_by_managed_cluster( @@ -212,7 +214,7 @@ def list_by_managed_cluster( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Iterable["_models.MaintenanceConfigurationListResult"]: + ) -> Iterable[_models.MaintenanceConfigurationListResult]: """Gets a list of maintenance configurations in the specified managed cluster. Gets a list of maintenance configurations in the specified managed cluster. @@ -228,13 +230,16 @@ def list_by_managed_cluster( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_04_01.models.MaintenanceConfigurationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfigurationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfigurationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -244,9 +249,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=self.list_by_managed_cluster.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -256,9 +263,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -298,7 +307,7 @@ def get( resource_name: str, config_name: str, **kwargs: Any - ) -> "_models.MaintenanceConfiguration": + ) -> _models.MaintenanceConfiguration: """Gets the specified maintenance configuration of a managed cluster. Gets the specified maintenance configuration of a managed cluster. @@ -314,13 +323,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.MaintenanceConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfiguration"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] request = build_get_request( @@ -330,11 +342,13 @@ def get( config_name=config_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -361,9 +375,9 @@ def create_or_update( resource_group_name: str, resource_name: str, config_name: str, - parameters: "_models.MaintenanceConfiguration", + parameters: _models.MaintenanceConfiguration, **kwargs: Any - ) -> "_models.MaintenanceConfiguration": + ) -> _models.MaintenanceConfiguration: """Creates or updates a maintenance configuration in the specified managed cluster. Creates or updates a maintenance configuration in the specified managed cluster. @@ -381,14 +395,17 @@ def create_or_update( :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.MaintenanceConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfiguration"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] _json = self._serialize.body(parameters, 'MaintenanceConfiguration') @@ -401,11 +418,13 @@ def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -449,13 +468,16 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -465,11 +487,13 @@ def delete( # pylint: disable=inconsistent-return-statements config_name=config_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/operations/_managed_clusters_operations.py index 722b5da5be43..b626f48287ee 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/operations/_managed_clusters_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -36,9 +36,12 @@ def build_get_os_options_request( resource_type: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default") # pylint: disable=line-too-long path_format_arguments = { @@ -49,20 +52,18 @@ def build_get_os_options_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if resource_type is not None: - _query_parameters['resource-type'] = _SERIALIZER.query("resource_type", resource_type, 'str') + _params['resource-type'] = _SERIALIZER.query("resource_type", resource_type, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -71,9 +72,12 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters") path_format_arguments = { @@ -83,18 +87,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -104,9 +106,12 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters") # pylint: disable=line-too-long path_format_arguments = { @@ -117,18 +122,16 @@ def build_list_by_resource_group_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -139,9 +142,12 @@ def build_get_upgrade_profile_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default") # pylint: disable=line-too-long path_format_arguments = { @@ -153,18 +159,16 @@ def build_get_upgrade_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -176,9 +180,12 @@ def build_get_access_profile_request( role_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -191,18 +198,16 @@ def build_get_access_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -215,9 +220,12 @@ def build_list_cluster_admin_credentials_request( server_fqdn: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -229,20 +237,18 @@ def build_list_cluster_admin_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if server_fqdn is not None: - _query_parameters['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -256,9 +262,12 @@ def build_list_cluster_user_credentials_request( format: Optional[Union[str, "_models.Format"]] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -270,22 +279,20 @@ def build_list_cluster_user_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if server_fqdn is not None: - _query_parameters['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') if format is not None: - _query_parameters['format'] = _SERIALIZER.query("format", format, 'str') + _params['format'] = _SERIALIZER.query("format", format, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -298,9 +305,12 @@ def build_list_cluster_monitoring_user_credentials_request( server_fqdn: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -312,20 +322,18 @@ def build_list_cluster_monitoring_user_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if server_fqdn is not None: - _query_parameters['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -336,9 +344,12 @@ def build_get_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -350,18 +361,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -371,14 +380,17 @@ def build_create_or_update_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedCluster] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -390,20 +402,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -415,14 +425,17 @@ def build_update_tags_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.TagsObject] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -434,20 +447,18 @@ def build_update_tags_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -460,9 +471,12 @@ def build_delete_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -474,18 +488,16 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -495,14 +507,17 @@ def build_reset_service_principal_profile_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedClusterServicePrincipalProfile] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile") # pylint: disable=line-too-long path_format_arguments = { @@ -514,20 +529,18 @@ def build_reset_service_principal_profile_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -539,14 +552,17 @@ def build_reset_aad_profile_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedClusterAADProfile] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile") # pylint: disable=line-too-long path_format_arguments = { @@ -558,20 +574,18 @@ def build_reset_aad_profile_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -584,9 +598,12 @@ def build_rotate_cluster_certificates_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates") # pylint: disable=line-too-long path_format_arguments = { @@ -598,18 +615,16 @@ def build_rotate_cluster_certificates_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -620,9 +635,12 @@ def build_stop_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop") # pylint: disable=line-too-long path_format_arguments = { @@ -634,18 +652,16 @@ def build_stop_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -656,9 +672,12 @@ def build_start_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start") # pylint: disable=line-too-long path_format_arguments = { @@ -670,18 +689,16 @@ def build_start_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -691,14 +708,17 @@ def build_run_command_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.RunCommandRequest] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand") # pylint: disable=line-too-long path_format_arguments = { @@ -710,20 +730,18 @@ def build_run_command_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -737,9 +755,12 @@ def build_get_command_result_request( command_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}") # pylint: disable=line-too-long path_format_arguments = { @@ -752,18 +773,16 @@ def build_get_command_result_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -774,9 +793,12 @@ def build_list_outbound_network_dependencies_endpoints_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints") # pylint: disable=line-too-long path_format_arguments = { @@ -788,42 +810,38 @@ def build_list_outbound_network_dependencies_endpoints_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class ManagedClustersOperations(object): # pylint: disable=too-many-public-methods - """ManagedClustersOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ManagedClustersOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_04_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_04_01.ContainerServiceClient`'s + :attr:`managed_clusters` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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_os_options( @@ -831,7 +849,7 @@ def get_os_options( location: str, resource_type: Optional[str] = None, **kwargs: Any - ) -> "_models.OSOptionProfile": + ) -> _models.OSOptionProfile: """Gets supported OS options in the specified subscription. Gets supported OS options in the specified subscription. @@ -846,13 +864,16 @@ def get_os_options( :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.OSOptionProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OSOptionProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OSOptionProfile] request = build_get_os_options_request( @@ -861,11 +882,13 @@ def get_os_options( api_version=api_version, resource_type=resource_type, template_url=self.get_os_options.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -890,7 +913,7 @@ def get_os_options( def list( self, **kwargs: Any - ) -> Iterable["_models.ManagedClusterListResult"]: + ) -> Iterable[_models.ManagedClusterListResult]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. @@ -902,13 +925,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_04_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -916,9 +942,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -926,9 +954,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -966,7 +996,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.ManagedClusterListResult"]: + ) -> Iterable[_models.ManagedClusterListResult]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. @@ -980,13 +1010,16 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_04_01.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -995,9 +1028,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -1006,9 +1041,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -1047,7 +1084,7 @@ def get_upgrade_profile( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedClusterUpgradeProfile": + ) -> _models.ManagedClusterUpgradeProfile: """Gets the upgrade profile of a managed cluster. Gets the upgrade profile of a managed cluster. @@ -1061,13 +1098,16 @@ def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.ManagedClusterUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] request = build_get_upgrade_profile_request( @@ -1076,11 +1116,13 @@ def get_upgrade_profile( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1108,7 +1150,7 @@ def get_access_profile( resource_name: str, role_name: str, **kwargs: Any - ) -> "_models.ManagedClusterAccessProfile": + ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. **WARNING**\ : This API will be deprecated. Instead use `ListClusterUserCredentials @@ -1127,13 +1169,16 @@ def get_access_profile( :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.ManagedClusterAccessProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterAccessProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] request = build_get_access_profile_request( @@ -1143,11 +1188,13 @@ def get_access_profile( role_name=role_name, api_version=api_version, template_url=self.get_access_profile.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1175,7 +1222,7 @@ def list_cluster_admin_credentials( resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Lists the admin credentials of a managed cluster. Lists the admin credentials of a managed cluster. @@ -1191,13 +1238,16 @@ def list_cluster_admin_credentials( :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_admin_credentials_request( @@ -1207,11 +1257,13 @@ def list_cluster_admin_credentials( api_version=api_version, server_fqdn=server_fqdn, template_url=self.list_cluster_admin_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1240,7 +1292,7 @@ def list_cluster_user_credentials( server_fqdn: Optional[str] = None, format: Optional[Union[str, "_models.Format"]] = None, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Lists the user credentials of a managed cluster. Lists the user credentials of a managed cluster. @@ -1260,13 +1312,16 @@ def list_cluster_user_credentials( :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_user_credentials_request( @@ -1277,11 +1332,13 @@ def list_cluster_user_credentials( server_fqdn=server_fqdn, format=format, template_url=self.list_cluster_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1309,7 +1366,7 @@ def list_cluster_monitoring_user_credentials( resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Lists the cluster monitoring user credentials of a managed cluster. Lists the cluster monitoring user credentials of a managed cluster. @@ -1325,13 +1382,16 @@ def list_cluster_monitoring_user_credentials( :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_monitoring_user_credentials_request( @@ -1341,11 +1401,13 @@ def list_cluster_monitoring_user_credentials( api_version=api_version, server_fqdn=server_fqdn, template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1372,7 +1434,7 @@ def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedCluster": + ) -> _models.ManagedCluster: """Gets a managed cluster. Gets a managed cluster. @@ -1386,13 +1448,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.ManagedCluster :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] request = build_get_request( @@ -1401,11 +1466,13 @@ def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1430,17 +1497,20 @@ def _create_or_update_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'ManagedCluster') @@ -1452,11 +1522,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1486,9 +1558,9 @@ def begin_create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> LROPoller["_models.ManagedCluster"]: + ) -> LROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. Creates or updates a managed cluster. @@ -1513,37 +1585,47 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_04_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1560,17 +1642,20 @@ def _update_tags_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'TagsObject') @@ -1582,11 +1667,13 @@ def _update_tags_initial( content_type=content_type, json=_json, template_url=self._update_tags_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1612,9 +1699,9 @@ def begin_update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> LROPoller["_models.ManagedCluster"]: + ) -> LROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates tags on a managed cluster. @@ -1639,37 +1726,47 @@ def begin_update_tags( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_04_01.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._update_tags_initial( + raw_result = self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1688,13 +1785,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -1703,11 +1803,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1751,20 +1853,25 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_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) @@ -1774,8 +1881,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1792,17 +1905,20 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') @@ -1814,11 +1930,13 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re content_type=content_type, json=_json, template_url=self._reset_service_principal_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1840,7 +1958,7 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> LROPoller[None]: """Reset the Service Principal Profile of a managed cluster. @@ -1866,23 +1984,28 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._reset_service_principal_profile_initial( + raw_result = self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1892,8 +2015,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1910,17 +2039,20 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') @@ -1932,11 +2064,13 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement content_type=content_type, json=_json, template_url=self._reset_aad_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1958,7 +2092,7 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> LROPoller[None]: """Reset the AAD Profile of a managed cluster. @@ -1983,23 +2117,28 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._reset_aad_profile_initial( + raw_result = self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -2009,8 +2148,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2029,13 +2174,16 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_rotate_cluster_certificates_request_initial( @@ -2044,11 +2192,13 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return resource_name=resource_name, api_version=api_version, template_url=self._rotate_cluster_certificates_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2093,20 +2243,25 @@ def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-st :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._rotate_cluster_certificates_initial( + raw_result = self._rotate_cluster_certificates_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) @@ -2116,8 +2271,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2136,13 +2297,16 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_stop_request_initial( @@ -2151,11 +2315,13 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_name, api_version=api_version, template_url=self._stop_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2203,20 +2369,25 @@ def begin_stop( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._stop_initial( + raw_result = self._stop_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) @@ -2226,8 +2397,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2246,13 +2423,16 @@ def _start_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_start_request_initial( @@ -2261,11 +2441,13 @@ def _start_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_name, api_version=api_version, template_url=self._start_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2310,20 +2492,25 @@ def begin_start( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._start_initial( + raw_result = self._start_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) @@ -2333,8 +2520,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2351,17 +2544,20 @@ def _run_command_initial( self, resource_group_name: str, resource_name: str, - request_payload: "_models.RunCommandRequest", + request_payload: _models.RunCommandRequest, **kwargs: Any - ) -> Optional["_models.RunCommandResult"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RunCommandResult"]] + ) -> Optional[_models.RunCommandResult]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] _json = self._serialize.body(request_payload, 'RunCommandRequest') @@ -2373,11 +2569,13 @@ def _run_command_initial( content_type=content_type, json=_json, template_url=self._run_command_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2405,9 +2603,9 @@ def begin_run_command( self, resource_group_name: str, resource_name: str, - request_payload: "_models.RunCommandRequest", + request_payload: _models.RunCommandRequest, **kwargs: Any - ) -> LROPoller["_models.RunCommandResult"]: + ) -> LROPoller[_models.RunCommandResult]: """Submits a command to run against the Managed Cluster. AKS will create a pod to run the command. This is primarily useful for private clusters. For @@ -2434,37 +2632,47 @@ def begin_run_command( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_04_01.models.RunCommandResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.RunCommandResult] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._run_command_initial( + raw_result = self._run_command_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, request_payload=request_payload, 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): - response = pipeline_response.http_response deserialized = self._deserialize('RunCommandResult', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2484,7 +2692,7 @@ def get_command_result( resource_name: str, command_id: str, **kwargs: Any - ) -> Optional["_models.RunCommandResult"]: + ) -> Optional[_models.RunCommandResult]: """Gets the results of a command which has been run on the Managed Cluster. Gets the results of a command which has been run on the Managed Cluster. @@ -2500,13 +2708,16 @@ def get_command_result( :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.RunCommandResult or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RunCommandResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] request = build_get_command_result_request( @@ -2516,11 +2727,13 @@ def get_command_result( command_id=command_id, api_version=api_version, template_url=self.get_command_result.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2549,7 +2762,7 @@ def list_outbound_network_dependencies_endpoints( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Iterable["_models.OutboundEnvironmentEndpointCollection"]: + ) -> Iterable[_models.OutboundEnvironmentEndpointCollection]: """Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. @@ -2567,13 +2780,16 @@ def list_outbound_network_dependencies_endpoints( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_04_01.models.OutboundEnvironmentEndpointCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OutboundEnvironmentEndpointCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -2583,9 +2799,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=self.list_outbound_network_dependencies_endpoints.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -2595,9 +2813,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/operations/_operations.py index 966fcaefe931..949783cfe7e0 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/operations/_operations.py @@ -16,6 +16,7 @@ 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 @@ -29,55 +30,54 @@ def build_list_request( **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.ContainerService/operations") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class Operations(object): - """Operations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_04_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_04_01.ContainerServiceClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> Iterable["_models.OperationListResult"]: + ) -> Iterable[_models.OperationListResult]: """Gets a list of operations. Gets a list of operations. @@ -88,31 +88,38 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_04_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/operations/_private_endpoint_connections_operations.py index 6194e00e76ee..1eb92fbe199e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/operations/_private_endpoint_connections_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast from msrest import Serializer @@ -16,13 +16,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -34,9 +34,12 @@ def build_list_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections") # pylint: disable=line-too-long path_format_arguments = { @@ -48,18 +51,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -71,9 +72,12 @@ def build_get_request( private_endpoint_connection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -86,18 +90,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -108,14 +110,17 @@ def build_update_request( resource_name: str, private_endpoint_connection_name: str, *, - json: JSONType = None, + json: Optional[_models.PrivateEndpointConnection] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -128,20 +133,18 @@ def build_update_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -155,9 +158,12 @@ def build_delete_request_initial( private_endpoint_connection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -170,42 +176,38 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class PrivateEndpointConnectionsOperations(object): - """PrivateEndpointConnectionsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class PrivateEndpointConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_04_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_04_01.ContainerServiceClient`'s + :attr:`private_endpoint_connections` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -213,7 +215,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnectionListResult": + ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. To learn more about private clusters, see: @@ -228,13 +230,16 @@ def list( :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.PrivateEndpointConnectionListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] request = build_list_request( @@ -243,11 +248,13 @@ def list( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -275,7 +282,7 @@ def get( resource_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Gets the specified private endpoint connection. To learn more about private clusters, see: @@ -292,13 +299,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] request = build_get_request( @@ -308,11 +318,13 @@ def get( private_endpoint_connection_name=private_endpoint_connection_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -339,9 +351,9 @@ def update( resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - parameters: "_models.PrivateEndpointConnection", + parameters: _models.PrivateEndpointConnection, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. Updates a private endpoint connection. @@ -359,14 +371,17 @@ def update( :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] _json = self._serialize.body(parameters, 'PrivateEndpointConnection') @@ -379,11 +394,13 @@ def update( content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -411,13 +428,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -427,11 +447,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name=private_endpoint_connection_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -478,21 +500,26 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -502,8 +529,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/operations/_private_link_resources_operations.py index f70054db99d6..3992b329d04c 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/operations/_private_link_resources_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/operations/_private_link_resources_operations.py @@ -15,6 +15,7 @@ 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 @@ -31,9 +32,12 @@ def build_list_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources") # pylint: disable=line-too-long path_format_arguments = { @@ -45,42 +49,38 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class PrivateLinkResourcesOperations(object): - """PrivateLinkResourcesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class PrivateLinkResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_04_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_04_01.ContainerServiceClient`'s + :attr:`private_link_resources` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -88,7 +88,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.PrivateLinkResourcesListResult": + ) -> _models.PrivateLinkResourcesListResult: """Gets a list of private link resources in the specified managed cluster. To learn more about private clusters, see: @@ -103,13 +103,16 @@ def list( :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.PrivateLinkResourcesListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourcesListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] request = build_list_request( @@ -118,11 +121,13 @@ def list( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/operations/_resolve_private_link_service_id_operations.py index df8b076d4396..57538a964806 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/operations/_resolve_private_link_service_id_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/operations/_resolve_private_link_service_id_operations.py @@ -15,12 +15,12 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -31,14 +31,17 @@ def build_post_request( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.PrivateLinkResource] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId") # pylint: disable=line-too-long path_format_arguments = { @@ -50,55 +53,51 @@ def build_post_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs ) -class ResolvePrivateLinkServiceIdOperations(object): - """ResolvePrivateLinkServiceIdOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ResolvePrivateLinkServiceIdOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_04_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_04_01.ContainerServiceClient`'s + :attr:`resolve_private_link_service_id` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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 post( self, resource_group_name: str, resource_name: str, - parameters: "_models.PrivateLinkResource", + parameters: _models.PrivateLinkResource, **kwargs: Any - ) -> "_models.PrivateLinkResource": + ) -> _models.PrivateLinkResource: """Gets the private link service ID for the specified managed cluster. Gets the private link service ID for the specified managed cluster. @@ -114,14 +113,17 @@ def post( :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.PrivateLinkResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] _json = self._serialize.body(parameters, 'PrivateLinkResource') @@ -133,11 +135,13 @@ def post( content_type=content_type, json=_json, template_url=self.post.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/operations/_snapshots_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/operations/_snapshots_operations.py index f022960d7447..675ca43b97b5 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/operations/_snapshots_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_01/operations/_snapshots_operations.py @@ -16,12 +16,12 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -31,9 +31,12 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots") path_format_arguments = { @@ -43,18 +46,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -64,9 +65,12 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots") # pylint: disable=line-too-long path_format_arguments = { @@ -77,18 +81,16 @@ def build_list_by_resource_group_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -99,9 +101,12 @@ def build_get_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -113,18 +118,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -134,14 +137,17 @@ def build_create_or_update_request( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.Snapshot] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -153,20 +159,18 @@ def build_create_or_update_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -178,14 +182,17 @@ def build_update_tags_request( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.TagsObject] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -197,20 +204,18 @@ def build_update_tags_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -223,9 +228,12 @@ def build_delete_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -237,48 +245,44 @@ def build_delete_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class SnapshotsOperations(object): - """SnapshotsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class SnapshotsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_04_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_04_01.ContainerServiceClient`'s + :attr:`snapshots` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> Iterable["_models.SnapshotListResult"]: + ) -> Iterable[_models.SnapshotListResult]: """Gets a list of snapshots in the specified subscription. Gets a list of snapshots in the specified subscription. @@ -289,13 +293,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_04_01.models.SnapshotListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -303,9 +310,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -313,9 +322,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -353,7 +364,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.SnapshotListResult"]: + ) -> Iterable[_models.SnapshotListResult]: """Lists snapshots in the specified subscription and resource group. Lists snapshots in the specified subscription and resource group. @@ -366,13 +377,16 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_04_01.models.SnapshotListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -381,9 +395,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -392,9 +408,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -433,7 +451,7 @@ def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.Snapshot": + ) -> _models.Snapshot: """Gets a snapshot. Gets a snapshot. @@ -447,13 +465,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.Snapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] request = build_get_request( @@ -462,11 +483,13 @@ def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -492,9 +515,9 @@ def create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.Snapshot", + parameters: _models.Snapshot, **kwargs: Any - ) -> "_models.Snapshot": + ) -> _models.Snapshot: """Creates or updates a snapshot. Creates or updates a snapshot. @@ -510,14 +533,17 @@ def create_or_update( :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.Snapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] _json = self._serialize.body(parameters, 'Snapshot') @@ -529,11 +555,13 @@ def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -563,9 +591,9 @@ def update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.Snapshot": + ) -> _models.Snapshot: """Updates tags on a snapshot. Updates tags on a snapshot. @@ -581,14 +609,17 @@ def update_tags( :rtype: ~azure.mgmt.containerservice.v2022_04_01.models.Snapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] _json = self._serialize.body(parameters, 'TagsObject') @@ -600,11 +631,13 @@ def update_tags( content_type=content_type, json=_json, template_url=self.update_tags.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -645,13 +678,16 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -660,11 +696,13 @@ def delete( # pylint: disable=inconsistent-return-statements resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/__init__.py index 53c675bd95e2..37a5f9e02e6f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._container_service_client import ContainerServiceClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['ContainerServiceClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/_container_service_client.py index e4ae8f978eaa..4ad4c1107c46 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/_container_service_client.py @@ -84,17 +84,39 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.managed_clusters = ManagedClustersOperations(self._client, self._config, self._serialize, self._deserialize) - self.maintenance_configurations = MaintenanceConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) - self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) - self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations(self._client, self._config, self._serialize, self._deserialize) - self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) - self.managed_cluster_snapshots = ManagedClusterSnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) - self.trusted_access_roles = TrustedAccessRolesOperations(self._client, self._config, self._serialize, self._deserialize) - self.trusted_access_role_bindings = TrustedAccessRoleBindingsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_clusters = ManagedClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.maintenance_configurations = MaintenanceConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.agent_pools = AgentPoolsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.snapshots = SnapshotsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_cluster_snapshots = ManagedClusterSnapshotsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.trusted_access_roles = TrustedAccessRolesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.trusted_access_role_bindings = TrustedAccessRoleBindingsOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/__init__.py index 53c675bd95e2..37a5f9e02e6f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._container_service_client import ContainerServiceClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['ContainerServiceClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/_container_service_client.py index f9cc430a0ab0..5430478cae15 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/_container_service_client.py @@ -84,17 +84,39 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.managed_clusters = ManagedClustersOperations(self._client, self._config, self._serialize, self._deserialize) - self.maintenance_configurations = MaintenanceConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) - self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) - self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations(self._client, self._config, self._serialize, self._deserialize) - self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) - self.managed_cluster_snapshots = ManagedClusterSnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) - self.trusted_access_roles = TrustedAccessRolesOperations(self._client, self._config, self._serialize, self._deserialize) - self.trusted_access_role_bindings = TrustedAccessRoleBindingsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_clusters = ManagedClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.maintenance_configurations = MaintenanceConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.agent_pools = AgentPoolsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.snapshots = SnapshotsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_cluster_snapshots = ManagedClusterSnapshotsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.trusted_access_roles = TrustedAccessRolesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.trusted_access_role_bindings = TrustedAccessRoleBindingsOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/__init__.py index 4a9011533682..fe53dc12e778 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/__init__.py @@ -18,6 +18,9 @@ from ._trusted_access_roles_operations import TrustedAccessRolesOperations from ._trusted_access_role_bindings_operations import TrustedAccessRoleBindingsOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'Operations', 'ManagedClustersOperations', @@ -31,3 +34,5 @@ 'TrustedAccessRolesOperations', 'TrustedAccessRoleBindingsOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_agent_pools_operations.py index b2432a63922f..02533969c46e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_agent_pools_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. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ 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 @@ -26,26 +27,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class AgentPoolsOperations: - """AgentPoolsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_04_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_04_02_preview.aio.ContainerServiceClient`'s + :attr:`agent_pools` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -53,7 +52,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> AsyncIterable["_models.AgentPoolListResult"]: + ) -> AsyncIterable[_models.AgentPoolListResult]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. @@ -68,13 +67,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_04_02_preview.models.AgentPoolListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -84,9 +86,11 @@ def prepare_request(next_link=None): resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -96,9 +100,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -138,7 +144,7 @@ async def get( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPool": + ) -> _models.AgentPool: """Gets the specified managed cluster agent pool. Gets the specified managed cluster agent pool. @@ -154,13 +160,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.AgentPool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] request = build_get_request( @@ -170,11 +179,13 @@ async def get( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -200,17 +211,20 @@ async def _create_or_update_initial( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> "_models.AgentPool": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] + ) -> _models.AgentPool: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-04-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] _json = self._serialize.body(parameters, 'AgentPool') @@ -223,11 +237,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -258,9 +274,9 @@ async def begin_create_or_update( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> AsyncLROPoller["_models.AgentPool"]: + ) -> AsyncLROPoller[_models.AgentPool]: """Creates or updates an agent pool in the specified managed cluster. Creates or updates an agent pool in the specified managed cluster. @@ -287,17 +303,20 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_04_02_preview.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, @@ -305,20 +324,27 @@ async def begin_create_or_update( 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): - response = pipeline_response.http_response deserialized = self._deserialize('AgentPool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -339,13 +365,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements ignore_pod_disruption_budget: Optional[bool] = None, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -356,11 +385,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements api_version=api_version, ignore_pod_disruption_budget=ignore_pod_disruption_budget, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -411,22 +442,27 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, ignore_pod_disruption_budget=ignore_pod_disruption_budget, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -436,8 +472,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -457,7 +499,7 @@ async def get_upgrade_profile( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPoolUpgradeProfile": + ) -> _models.AgentPoolUpgradeProfile: """Gets the upgrade profile for an agent pool. Gets the upgrade profile for an agent pool. @@ -473,13 +515,16 @@ async def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.AgentPoolUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] request = build_get_upgrade_profile_request( @@ -489,11 +534,13 @@ async def get_upgrade_profile( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -520,7 +567,7 @@ async def get_available_agent_pool_versions( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.AgentPoolAvailableVersions": + ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported Kubernetes versions for the specified agent pool. See `supported Kubernetes versions @@ -536,13 +583,16 @@ async def get_available_agent_pool_versions( :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.AgentPoolAvailableVersions :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolAvailableVersions"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] request = build_get_available_agent_pool_versions_request( @@ -551,11 +601,13 @@ async def get_available_agent_pool_versions( resource_name=resource_name, api_version=api_version, template_url=self.get_available_agent_pool_versions.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -582,14 +634,17 @@ async def _upgrade_node_image_version_initial( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> Optional["_models.AgentPool"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.AgentPool"]] + ) -> Optional[_models.AgentPool]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] request = build_upgrade_node_image_version_request_initial( @@ -599,11 +654,13 @@ async def _upgrade_node_image_version_initial( agent_pool_name=agent_pool_name, api_version=api_version, template_url=self._upgrade_node_image_version_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -636,7 +693,7 @@ async def begin_upgrade_node_image_version( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> AsyncLROPoller["_models.AgentPool"]: + ) -> AsyncLROPoller[_models.AgentPool]: """Upgrades the node image version of an agent pool to the latest. Upgrading the node image version of an agent pool applies the newest OS and runtime updates to @@ -663,21 +720,26 @@ async def begin_upgrade_node_image_version( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_04_02_preview.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._upgrade_node_image_version_initial( + raw_result = await self._upgrade_node_image_version_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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) @@ -693,8 +755,14 @@ def get_long_running_output(pipeline_response): return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_maintenance_configurations_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_maintenance_configurations_operations.py index 4c2508631d56..310e5a77185f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_maintenance_configurations_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_maintenance_configurations_operations.py @@ -15,6 +15,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -24,26 +25,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class MaintenanceConfigurationsOperations: - """MaintenanceConfigurationsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_04_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_04_02_preview.aio.ContainerServiceClient`'s + :attr:`maintenance_configurations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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_by_managed_cluster( @@ -51,7 +50,7 @@ def list_by_managed_cluster( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> AsyncIterable["_models.MaintenanceConfigurationListResult"]: + ) -> AsyncIterable[_models.MaintenanceConfigurationListResult]: """Gets a list of maintenance configurations in the specified managed cluster. Gets a list of maintenance configurations in the specified managed cluster. @@ -67,13 +66,16 @@ def list_by_managed_cluster( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_04_02_preview.models.MaintenanceConfigurationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfigurationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfigurationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -83,9 +85,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=self.list_by_managed_cluster.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -95,9 +99,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -137,7 +143,7 @@ async def get( resource_name: str, config_name: str, **kwargs: Any - ) -> "_models.MaintenanceConfiguration": + ) -> _models.MaintenanceConfiguration: """Gets the specified maintenance configuration of a managed cluster. Gets the specified maintenance configuration of a managed cluster. @@ -153,13 +159,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.MaintenanceConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfiguration"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] request = build_get_request( @@ -169,11 +178,13 @@ async def get( config_name=config_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -200,9 +211,9 @@ async def create_or_update( resource_group_name: str, resource_name: str, config_name: str, - parameters: "_models.MaintenanceConfiguration", + parameters: _models.MaintenanceConfiguration, **kwargs: Any - ) -> "_models.MaintenanceConfiguration": + ) -> _models.MaintenanceConfiguration: """Creates or updates a maintenance configuration in the specified managed cluster. Creates or updates a maintenance configuration in the specified managed cluster. @@ -221,14 +232,17 @@ async def create_or_update( :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.MaintenanceConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfiguration"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] _json = self._serialize.body(parameters, 'MaintenanceConfiguration') @@ -241,11 +255,13 @@ async def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -289,13 +305,16 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -305,11 +324,13 @@ async def delete( # pylint: disable=inconsistent-return-statements config_name=config_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_managed_cluster_snapshots_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_managed_cluster_snapshots_operations.py index 586d7b85df05..8b4c68e3dac5 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_managed_cluster_snapshots_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_managed_cluster_snapshots_operations.py @@ -15,6 +15,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -24,32 +25,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ManagedClusterSnapshotsOperations: - """ManagedClusterSnapshotsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_04_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_04_02_preview.aio.ContainerServiceClient`'s + :attr:`managed_cluster_snapshots` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.ManagedClusterSnapshotListResult"]: + ) -> AsyncIterable[_models.ManagedClusterSnapshotListResult]: """Gets a list of managed cluster snapshots in the specified subscription. Gets a list of managed cluster snapshots in the specified subscription. @@ -61,13 +60,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedClusterSnapshotListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshotListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterSnapshotListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -75,9 +77,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -85,9 +89,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -125,7 +131,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ManagedClusterSnapshotListResult"]: + ) -> AsyncIterable[_models.ManagedClusterSnapshotListResult]: """Lists managed cluster snapshots in the specified subscription and resource group. Lists managed cluster snapshots in the specified subscription and resource group. @@ -139,13 +145,16 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedClusterSnapshotListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshotListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterSnapshotListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -154,9 +163,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -165,9 +176,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -206,7 +219,7 @@ async def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedClusterSnapshot": + ) -> _models.ManagedClusterSnapshot: """Gets a managed cluster snapshot. Gets a managed cluster snapshot. @@ -220,13 +233,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedClusterSnapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterSnapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshot] request = build_get_request( @@ -235,11 +251,13 @@ async def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -265,9 +283,9 @@ async def create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterSnapshot", + parameters: _models.ManagedClusterSnapshot, **kwargs: Any - ) -> "_models.ManagedClusterSnapshot": + ) -> _models.ManagedClusterSnapshot: """Creates or updates a managed cluster snapshot. Creates or updates a managed cluster snapshot. @@ -284,14 +302,17 @@ async def create_or_update( :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedClusterSnapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterSnapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshot] _json = self._serialize.body(parameters, 'ManagedClusterSnapshot') @@ -303,11 +324,13 @@ async def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -337,9 +360,9 @@ async def update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.ManagedClusterSnapshot": + ) -> _models.ManagedClusterSnapshot: """Updates tags on a managed cluster snapshot. Updates tags on a managed cluster snapshot. @@ -355,14 +378,17 @@ async def update_tags( :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedClusterSnapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterSnapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-04-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshot] _json = self._serialize.body(parameters, 'TagsObject') @@ -374,11 +400,13 @@ async def update_tags( content_type=content_type, json=_json, template_url=self.update_tags.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -419,13 +447,16 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -434,11 +465,13 @@ async def delete( # pylint: disable=inconsistent-return-statements resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_managed_clusters_operations.py index d690ad6c5b88..3e1362db70c3 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_managed_clusters_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. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ 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 @@ -26,26 +27,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ManagedClustersOperations: # pylint: disable=too-many-public-methods - """ManagedClustersOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_04_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_04_02_preview.aio.ContainerServiceClient`'s + :attr:`managed_clusters` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace_async async def get_os_options( @@ -53,7 +52,7 @@ async def get_os_options( location: str, resource_type: Optional[str] = None, **kwargs: Any - ) -> "_models.OSOptionProfile": + ) -> _models.OSOptionProfile: """Gets supported OS options in the specified subscription. Gets supported OS options in the specified subscription. @@ -68,13 +67,16 @@ async def get_os_options( :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.OSOptionProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OSOptionProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OSOptionProfile] request = build_get_os_options_request( @@ -83,11 +85,13 @@ async def get_os_options( api_version=api_version, resource_type=resource_type, template_url=self.get_os_options.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -112,7 +116,7 @@ async def get_os_options( def list( self, **kwargs: Any - ) -> AsyncIterable["_models.ManagedClusterListResult"]: + ) -> AsyncIterable[_models.ManagedClusterListResult]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. @@ -124,13 +128,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -138,9 +145,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -148,9 +157,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -188,7 +199,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ManagedClusterListResult"]: + ) -> AsyncIterable[_models.ManagedClusterListResult]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. @@ -202,13 +213,16 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -217,9 +231,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -228,9 +244,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -269,7 +287,7 @@ async def get_upgrade_profile( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedClusterUpgradeProfile": + ) -> _models.ManagedClusterUpgradeProfile: """Gets the upgrade profile of a managed cluster. Gets the upgrade profile of a managed cluster. @@ -283,13 +301,16 @@ async def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedClusterUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] request = build_get_upgrade_profile_request( @@ -298,11 +319,13 @@ async def get_upgrade_profile( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -330,7 +353,7 @@ async def get_access_profile( resource_name: str, role_name: str, **kwargs: Any - ) -> "_models.ManagedClusterAccessProfile": + ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. **WARNING**\ : This API will be deprecated. Instead use `ListClusterUserCredentials @@ -349,13 +372,16 @@ async def get_access_profile( :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedClusterAccessProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterAccessProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] request = build_get_access_profile_request( @@ -365,11 +391,13 @@ async def get_access_profile( role_name=role_name, api_version=api_version, template_url=self.get_access_profile.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -397,7 +425,7 @@ async def list_cluster_admin_credentials( resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Lists the admin credentials of a managed cluster. Lists the admin credentials of a managed cluster. @@ -413,13 +441,16 @@ async def list_cluster_admin_credentials( :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_admin_credentials_request( @@ -429,11 +460,13 @@ async def list_cluster_admin_credentials( api_version=api_version, server_fqdn=server_fqdn, template_url=self.list_cluster_admin_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -462,7 +495,7 @@ async def list_cluster_user_credentials( server_fqdn: Optional[str] = None, format: Optional[Union[str, "_models.Format"]] = None, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Lists the user credentials of a managed cluster. Lists the user credentials of a managed cluster. @@ -482,13 +515,16 @@ async def list_cluster_user_credentials( :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_user_credentials_request( @@ -499,11 +535,13 @@ async def list_cluster_user_credentials( server_fqdn=server_fqdn, format=format, template_url=self.list_cluster_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -531,7 +569,7 @@ async def list_cluster_monitoring_user_credentials( resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Lists the cluster monitoring user credentials of a managed cluster. Lists the cluster monitoring user credentials of a managed cluster. @@ -547,13 +585,16 @@ async def list_cluster_monitoring_user_credentials( :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_monitoring_user_credentials_request( @@ -563,11 +604,13 @@ async def list_cluster_monitoring_user_credentials( api_version=api_version, server_fqdn=server_fqdn, template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -594,7 +637,7 @@ async def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedCluster": + ) -> _models.ManagedCluster: """Gets a managed cluster. Gets a managed cluster. @@ -608,13 +651,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedCluster :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] request = build_get_request( @@ -623,11 +669,13 @@ async def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -652,17 +700,20 @@ async def _create_or_update_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'ManagedCluster') @@ -674,11 +725,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -708,9 +761,9 @@ async def begin_create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> AsyncLROPoller["_models.ManagedCluster"]: + ) -> AsyncLROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. Creates or updates a managed cluster. @@ -735,37 +788,47 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -782,17 +845,20 @@ async def _update_tags_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'TagsObject') @@ -804,11 +870,13 @@ async def _update_tags_initial( content_type=content_type, json=_json, template_url=self._update_tags_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -834,9 +902,9 @@ async def begin_update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> AsyncLROPoller["_models.ManagedCluster"]: + ) -> AsyncLROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates tags on a managed cluster. @@ -861,37 +929,47 @@ async def begin_update_tags( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._update_tags_initial( + raw_result = await self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -911,13 +989,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements ignore_pod_disruption_budget: Optional[bool] = None, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -927,11 +1008,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements api_version=api_version, ignore_pod_disruption_budget=ignore_pod_disruption_budget, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -979,21 +1062,26 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, ignore_pod_disruption_budget=ignore_pod_disruption_budget, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1003,8 +1091,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1021,17 +1115,20 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-04-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') @@ -1043,11 +1140,13 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist content_type=content_type, json=_json, template_url=self._reset_service_principal_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1069,7 +1168,7 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> AsyncLROPoller[None]: """Reset the Service Principal Profile of a managed cluster. @@ -1095,23 +1194,28 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._reset_service_principal_profile_initial( + raw_result = await self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1121,8 +1225,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1139,17 +1249,20 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-04-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') @@ -1161,11 +1274,13 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta content_type=content_type, json=_json, template_url=self._reset_aad_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1187,7 +1302,7 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> AsyncLROPoller[None]: """Reset the AAD Profile of a managed cluster. @@ -1213,23 +1328,28 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._reset_aad_profile_initial( + raw_result = await self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1239,8 +1359,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1259,13 +1385,16 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_rotate_cluster_certificates_request_initial( @@ -1274,11 +1403,13 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- resource_name=resource_name, api_version=api_version, template_url=self._rotate_cluster_certificates_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1323,20 +1454,25 @@ async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-ret :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._rotate_cluster_certificates_initial( + raw_result = await self._rotate_cluster_certificates_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) @@ -1346,8 +1482,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1366,13 +1508,16 @@ async def _rotate_service_account_signing_keys_initial( # pylint: disable=incon resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_rotate_service_account_signing_keys_request_initial( @@ -1381,11 +1526,13 @@ async def _rotate_service_account_signing_keys_initial( # pylint: disable=incon resource_name=resource_name, api_version=api_version, template_url=self._rotate_service_account_signing_keys_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1429,20 +1576,25 @@ async def begin_rotate_service_account_signing_keys( # pylint: disable=inconsis :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._rotate_service_account_signing_keys_initial( + raw_result = await self._rotate_service_account_signing_keys_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) @@ -1452,8 +1604,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1472,13 +1630,16 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_stop_request_initial( @@ -1487,11 +1648,13 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_name, api_version=api_version, template_url=self._stop_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1539,20 +1702,25 @@ async def begin_stop( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._stop_initial( + raw_result = await self._stop_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) @@ -1562,8 +1730,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1582,13 +1756,16 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_start_request_initial( @@ -1597,11 +1774,13 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_name, api_version=api_version, template_url=self._start_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1646,20 +1825,25 @@ async def begin_start( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._start_initial( + raw_result = await self._start_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) @@ -1669,8 +1853,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1687,17 +1877,20 @@ async def _run_command_initial( self, resource_group_name: str, resource_name: str, - request_payload: "_models.RunCommandRequest", + request_payload: _models.RunCommandRequest, **kwargs: Any - ) -> Optional["_models.RunCommandResult"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RunCommandResult"]] + ) -> Optional[_models.RunCommandResult]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] _json = self._serialize.body(request_payload, 'RunCommandRequest') @@ -1709,11 +1902,13 @@ async def _run_command_initial( content_type=content_type, json=_json, template_url=self._run_command_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1741,9 +1936,9 @@ async def begin_run_command( self, resource_group_name: str, resource_name: str, - request_payload: "_models.RunCommandRequest", + request_payload: _models.RunCommandRequest, **kwargs: Any - ) -> AsyncLROPoller["_models.RunCommandResult"]: + ) -> AsyncLROPoller[_models.RunCommandResult]: """Submits a command to run against the Managed Cluster. AKS will create a pod to run the command. This is primarily useful for private clusters. For @@ -1771,37 +1966,47 @@ async def begin_run_command( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_04_02_preview.models.RunCommandResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.RunCommandResult] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._run_command_initial( + raw_result = await self._run_command_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, request_payload=request_payload, 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): - response = pipeline_response.http_response deserialized = self._deserialize('RunCommandResult', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1821,7 +2026,7 @@ async def get_command_result( resource_name: str, command_id: str, **kwargs: Any - ) -> Optional["_models.RunCommandResult"]: + ) -> Optional[_models.RunCommandResult]: """Gets the results of a command which has been run on the Managed Cluster. Gets the results of a command which has been run on the Managed Cluster. @@ -1837,13 +2042,16 @@ async def get_command_result( :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.RunCommandResult or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RunCommandResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] request = build_get_command_result_request( @@ -1853,11 +2061,13 @@ async def get_command_result( command_id=command_id, api_version=api_version, template_url=self.get_command_result.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1886,7 +2096,7 @@ def list_outbound_network_dependencies_endpoints( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> AsyncIterable["_models.OutboundEnvironmentEndpointCollection"]: + ) -> AsyncIterable[_models.OutboundEnvironmentEndpointCollection]: """Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. @@ -1904,13 +2114,16 @@ def list_outbound_network_dependencies_endpoints( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_04_02_preview.models.OutboundEnvironmentEndpointCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OutboundEnvironmentEndpointCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -1920,9 +2133,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=self.list_outbound_network_dependencies_endpoints.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -1932,9 +2147,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_operations.py index 7abbc49995db..634c0c65a1dc 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_operations.py @@ -14,6 +14,7 @@ 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 @@ -23,32 +24,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class Operations: - """Operations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_04_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_04_02_preview.aio.ContainerServiceClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.OperationListResult"]: + ) -> AsyncIterable[_models.OperationListResult]: """Gets a list of operations. Gets a list of operations. @@ -59,31 +58,38 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_04_02_preview.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_private_endpoint_connections_operations.py index 8b3d6aa5a62b..137b7ad735ce 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_private_endpoint_connections_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -14,6 +14,7 @@ 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 @@ -24,26 +25,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class PrivateEndpointConnectionsOperations: - """PrivateEndpointConnectionsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_04_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_04_02_preview.aio.ContainerServiceClient`'s + :attr:`private_endpoint_connections` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -51,7 +50,7 @@ async def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnectionListResult": + ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. To learn more about private clusters, see: @@ -67,13 +66,16 @@ async def list( ~azure.mgmt.containerservice.v2022_04_02_preview.models.PrivateEndpointConnectionListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] request = build_list_request( @@ -82,11 +84,13 @@ async def list( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -114,7 +118,7 @@ async def get( resource_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Gets the specified private endpoint connection. To learn more about private clusters, see: @@ -131,13 +135,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] request = build_get_request( @@ -147,11 +154,13 @@ async def get( private_endpoint_connection_name=private_endpoint_connection_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -178,9 +187,9 @@ async def update( resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - parameters: "_models.PrivateEndpointConnection", + parameters: _models.PrivateEndpointConnection, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. Updates a private endpoint connection. @@ -199,14 +208,17 @@ async def update( :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-04-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] _json = self._serialize.body(parameters, 'PrivateEndpointConnection') @@ -219,11 +231,13 @@ async def update( content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -251,13 +265,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -267,11 +284,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name=private_endpoint_connection_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -318,21 +337,26 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -342,8 +366,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_private_link_resources_operations.py index 766ee97a1bea..848df481de07 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_private_link_resources_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_private_link_resources_operations.py @@ -13,6 +13,7 @@ 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 @@ -22,26 +23,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class PrivateLinkResourcesOperations: - """PrivateLinkResourcesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_04_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_04_02_preview.aio.ContainerServiceClient`'s + :attr:`private_link_resources` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -49,7 +48,7 @@ async def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.PrivateLinkResourcesListResult": + ) -> _models.PrivateLinkResourcesListResult: """Gets a list of private link resources in the specified managed cluster. To learn more about private clusters, see: @@ -64,13 +63,16 @@ async def list( :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.PrivateLinkResourcesListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourcesListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] request = build_list_request( @@ -79,11 +81,13 @@ async def list( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_resolve_private_link_service_id_operations.py index 0937b600ffde..64b1f8767252 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_resolve_private_link_service_id_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_resolve_private_link_service_id_operations.py @@ -13,6 +13,7 @@ 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 @@ -22,35 +23,33 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ResolvePrivateLinkServiceIdOperations: - """ResolvePrivateLinkServiceIdOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_04_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_04_02_preview.aio.ContainerServiceClient`'s + :attr:`resolve_private_link_service_id` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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 post( self, resource_group_name: str, resource_name: str, - parameters: "_models.PrivateLinkResource", + parameters: _models.PrivateLinkResource, **kwargs: Any - ) -> "_models.PrivateLinkResource": + ) -> _models.PrivateLinkResource: """Gets the private link service ID for the specified managed cluster. Gets the private link service ID for the specified managed cluster. @@ -66,14 +65,17 @@ async def post( :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.PrivateLinkResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-04-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] _json = self._serialize.body(parameters, 'PrivateLinkResource') @@ -85,11 +87,13 @@ async def post( content_type=content_type, json=_json, template_url=self.post.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_snapshots_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_snapshots_operations.py index 5c24b4f40a24..dcf9f55bc0ca 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_snapshots_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_snapshots_operations.py @@ -15,6 +15,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -24,32 +25,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class SnapshotsOperations: - """SnapshotsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_04_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_04_02_preview.aio.ContainerServiceClient`'s + :attr:`snapshots` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.SnapshotListResult"]: + ) -> AsyncIterable[_models.SnapshotListResult]: """Gets a list of snapshots in the specified subscription. Gets a list of snapshots in the specified subscription. @@ -60,13 +59,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_04_02_preview.models.SnapshotListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -74,9 +76,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -84,9 +88,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -124,7 +130,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.SnapshotListResult"]: + ) -> AsyncIterable[_models.SnapshotListResult]: """Lists snapshots in the specified subscription and resource group. Lists snapshots in the specified subscription and resource group. @@ -137,13 +143,16 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_04_02_preview.models.SnapshotListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -152,9 +161,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -163,9 +174,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -204,7 +217,7 @@ async def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.Snapshot": + ) -> _models.Snapshot: """Gets a snapshot. Gets a snapshot. @@ -218,13 +231,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.Snapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] request = build_get_request( @@ -233,11 +249,13 @@ async def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -263,9 +281,9 @@ async def create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.Snapshot", + parameters: _models.Snapshot, **kwargs: Any - ) -> "_models.Snapshot": + ) -> _models.Snapshot: """Creates or updates a snapshot. Creates or updates a snapshot. @@ -281,14 +299,17 @@ async def create_or_update( :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.Snapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] _json = self._serialize.body(parameters, 'Snapshot') @@ -300,11 +321,13 @@ async def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -334,9 +357,9 @@ async def update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.Snapshot": + ) -> _models.Snapshot: """Updates tags on a snapshot. Updates tags on a snapshot. @@ -352,14 +375,17 @@ async def update_tags( :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.Snapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-04-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] _json = self._serialize.body(parameters, 'TagsObject') @@ -371,11 +397,13 @@ async def update_tags( content_type=content_type, json=_json, template_url=self.update_tags.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -416,13 +444,16 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -431,11 +462,13 @@ async def delete( # pylint: disable=inconsistent-return-statements resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_trusted_access_role_bindings_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_trusted_access_role_bindings_operations.py index 8996bd6b92a7..67bca0b27d66 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_trusted_access_role_bindings_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_trusted_access_role_bindings_operations.py @@ -15,6 +15,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -24,26 +25,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class TrustedAccessRoleBindingsOperations: - """TrustedAccessRoleBindingsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_04_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_04_02_preview.aio.ContainerServiceClient`'s + :attr:`trusted_access_role_bindings` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -51,7 +50,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> AsyncIterable["_models.TrustedAccessRoleBindingListResult"]: + ) -> AsyncIterable[_models.TrustedAccessRoleBindingListResult]: """List trusted access role bindings. List trusted access role bindings. @@ -67,13 +66,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_04_02_preview.models.TrustedAccessRoleBindingListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.TrustedAccessRoleBindingListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.TrustedAccessRoleBindingListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -83,9 +85,11 @@ def prepare_request(next_link=None): resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -95,9 +99,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -137,7 +143,7 @@ async def get( resource_name: str, trusted_access_role_binding_name: str, **kwargs: Any - ) -> "_models.TrustedAccessRoleBinding": + ) -> _models.TrustedAccessRoleBinding: """Get a trusted access role binding. Get a trusted access role binding. @@ -153,13 +159,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.TrustedAccessRoleBinding :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.TrustedAccessRoleBinding"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.TrustedAccessRoleBinding] request = build_get_request( @@ -169,11 +178,13 @@ async def get( trusted_access_role_binding_name=trusted_access_role_binding_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -200,9 +211,9 @@ async def create_or_update( resource_group_name: str, resource_name: str, trusted_access_role_binding_name: str, - trusted_access_role_binding: "_models.TrustedAccessRoleBinding", + trusted_access_role_binding: _models.TrustedAccessRoleBinding, **kwargs: Any - ) -> "_models.TrustedAccessRoleBinding": + ) -> _models.TrustedAccessRoleBinding: """Create or update a trusted access role binding. Create or update a trusted access role binding. @@ -221,14 +232,17 @@ async def create_or_update( :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.TrustedAccessRoleBinding :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.TrustedAccessRoleBinding"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.TrustedAccessRoleBinding] _json = self._serialize.body(trusted_access_role_binding, 'TrustedAccessRoleBinding') @@ -241,11 +255,13 @@ async def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -289,13 +305,16 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -305,11 +324,13 @@ async def delete( # pylint: disable=inconsistent-return-statements trusted_access_role_binding_name=trusted_access_role_binding_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_trusted_access_roles_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_trusted_access_roles_operations.py index 44cd37712720..b722cb095a44 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_trusted_access_roles_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/aio/operations/_trusted_access_roles_operations.py @@ -14,6 +14,7 @@ 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 @@ -23,33 +24,31 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class TrustedAccessRolesOperations: - """TrustedAccessRolesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_04_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_04_02_preview.aio.ContainerServiceClient`'s + :attr:`trusted_access_roles` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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, location: str, **kwargs: Any - ) -> AsyncIterable["_models.TrustedAccessRoleListResult"]: + ) -> AsyncIterable[_models.TrustedAccessRoleListResult]: """List supported trusted access roles. List supported trusted access roles. @@ -63,13 +62,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_04_02_preview.models.TrustedAccessRoleListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.TrustedAccessRoleListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.TrustedAccessRoleListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -78,9 +80,11 @@ def prepare_request(next_link=None): location=location, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -89,9 +93,11 @@ def prepare_request(next_link=None): location=location, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/models/__init__.py index ec5532f3845e..fd6f4108856b 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/models/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/models/__init__.py @@ -153,7 +153,9 @@ WeekDay, WorkloadRuntime, ) - +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'AgentPool', 'AgentPoolAvailableVersions', @@ -299,3 +301,5 @@ 'WeekDay', 'WorkloadRuntime', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/models/_container_service_client_enums.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/models/_container_service_client_enums.py index dbd286e52ca9..d98ebcc9fce9 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/models/_container_service_client_enums.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/models/_container_service_client_enums.py @@ -7,11 +7,10 @@ # -------------------------------------------------------------------------- from enum import Enum -from six import with_metaclass from azure.core import CaseInsensitiveEnumMeta -class AgentPoolMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class AgentPoolMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: https://docs.microsoft.com/azure/aks/use-system-pools @@ -24,7 +23,7 @@ class AgentPoolMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: User agent pools are primarily for hosting your application pods. USER = "User" -class AgentPoolType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class AgentPoolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of Agent Pool. """ @@ -33,7 +32,7 @@ class AgentPoolType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Use of this is strongly discouraged. AVAILABILITY_SET = "AvailabilitySet" -class Code(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class Code(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Tells whether the cluster is Running or Stopped """ @@ -42,7 +41,7 @@ class Code(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: The cluster is stopped. STOPPED = "Stopped" -class ConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The private link service connection status. """ @@ -51,7 +50,7 @@ class ConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): REJECTED = "Rejected" DISCONNECTED = "Disconnected" -class ContainerServiceStorageProfileTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Specifies what kind of storage to use. If omitted, the default will be chosen on your behalf based on the choice of orchestrator. """ @@ -59,7 +58,7 @@ class ContainerServiceStorageProfileTypes(with_metaclass(CaseInsensitiveEnumMeta STORAGE_ACCOUNT = "StorageAccount" MANAGED_DISKS = "ManagedDisks" -class ContainerServiceVMSizeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Size of agent VMs. Note: This is no longer maintained. """ @@ -238,7 +237,7 @@ class ContainerServiceVMSizeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, E STANDARD_NV24 = "Standard_NV24" STANDARD_NV6 = "Standard_NV6" -class Count(with_metaclass(CaseInsensitiveEnumMeta, int, Enum)): +class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): """Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, and 5. The default value is 1. """ @@ -247,7 +246,7 @@ class Count(with_metaclass(CaseInsensitiveEnumMeta, int, Enum)): THREE = 3 FIVE = 5 -class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of identity that created the resource. """ @@ -256,7 +255,7 @@ class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class Expander(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class Expander(str, Enum, metaclass=CaseInsensitiveEnumMeta): """If not specified, the default is 'random'. See `expanders `_ for more information. @@ -279,13 +278,13 @@ class Expander(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Used when you don't have a particular need for the node groups to scale differently. RANDOM = "random" -class ExtendedLocationTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ExtendedLocationTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of extendedLocation. """ EDGE_ZONE = "EdgeZone" -class Format(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class Format(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Return azure auth-provider kubeconfig. This format is deprecated in 1.22 and will be fully #: removed in 1.25. @@ -293,7 +292,7 @@ class Format(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Return exec format kubeconfig. This format requires kubelogin binary in the path. EXEC_ENUM = "exec" -class GPUInstanceProfile(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class GPUInstanceProfile(str, Enum, metaclass=CaseInsensitiveEnumMeta): """GPUInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU. """ @@ -303,14 +302,14 @@ class GPUInstanceProfile(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MIG4_G = "MIG4g" MIG7_G = "MIG7g" -class IpFamily(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class IpFamily(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The IP version to use for cluster networking and IP assignment. """ I_PV4 = "IPv4" I_PV6 = "IPv6" -class KubeletDiskType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class KubeletDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. """ @@ -320,7 +319,7 @@ class KubeletDiskType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Kubelet will use the temporary disk for its data. TEMPORARY = "Temporary" -class LicenseType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class LicenseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The license type to use for Windows VMs. See `Azure Hybrid User Benefits `_ for more details. """ @@ -330,7 +329,7 @@ class LicenseType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Enables Azure Hybrid User Benefits for Windows VMs. WINDOWS_SERVER = "Windows_Server" -class LoadBalancerSku(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class LoadBalancerSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the differences between load balancer SKUs. @@ -343,7 +342,7 @@ class LoadBalancerSku(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Use a basic Load Balancer with limited functionality. BASIC = "basic" -class ManagedClusterPodIdentityProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ManagedClusterPodIdentityProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The current provisioning state of the pod identity. """ @@ -352,13 +351,13 @@ class ManagedClusterPodIdentityProvisioningState(with_metaclass(CaseInsensitiveE DELETING = "Deleting" FAILED = "Failed" -class ManagedClusterSKUName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ManagedClusterSKUName(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The name of a managed cluster SKU. """ BASIC = "Basic" -class ManagedClusterSKUTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ManagedClusterSKUTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): """If not specified, the default is 'Free'. See `uptime SLA `_ for more details. """ @@ -369,7 +368,7 @@ class ManagedClusterSKUTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: No guaranteed SLA, no additional charges. Free tier clusters have an SLO of 99.5%. FREE = "Free" -class NetworkMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """This cannot be specified if networkPlugin is anything other than 'azure'. """ @@ -380,7 +379,7 @@ class NetworkMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: This is no longer supported. BRIDGE = "bridge" -class NetworkPlugin(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkPlugin(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Network plugin used for building the Kubernetes network. """ @@ -396,7 +395,7 @@ class NetworkPlugin(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: networking functionality. NONE = "none" -class NetworkPluginMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkPluginMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The mode the network plugin should use. """ @@ -404,7 +403,7 @@ class NetworkPluginMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Kubenet reference plugins host-local and bridge. OVERLAY = "Overlay" -class NetworkPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Network policy used for building the Kubernetes network. """ @@ -417,7 +416,7 @@ class NetworkPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: for more information. AZURE = "azure" -class OSDiskType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OSDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS @@ -433,7 +432,7 @@ class OSDiskType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: provides lower read/write latency, along with faster node scaling and cluster upgrades. EPHEMERAL = "Ephemeral" -class OSSKU(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OSSKU(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Specifies the OS SKU used by the agent pool. If not specified, the default is Ubuntu if OSType=Linux or Windows2019 if OSType=Windows. And the default Windows OSSKU will be changed to Windows2022 after Windows2019 is deprecated. @@ -444,7 +443,7 @@ class OSSKU(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): WINDOWS2019 = "Windows2019" WINDOWS2022 = "Windows2022" -class OSType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The operating system type. The default is Linux. """ @@ -453,7 +452,7 @@ class OSType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Use Windows. WINDOWS = "Windows" -class OutboundType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OutboundType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type `_. """ @@ -473,7 +472,7 @@ class OutboundType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: advanced scenario and requires proper network configuration. USER_ASSIGNED_NAT_GATEWAY = "userAssignedNATGateway" -class PrivateEndpointConnectionProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class PrivateEndpointConnectionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The current provisioning state. """ @@ -482,14 +481,14 @@ class PrivateEndpointConnectionProvisioningState(with_metaclass(CaseInsensitiveE DELETING = "Deleting" FAILED = "Failed" -class PublicNetworkAccess(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class PublicNetworkAccess(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Allow or deny public network access for AKS """ ENABLED = "Enabled" DISABLED = "Disabled" -class ResourceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """For more information see `use managed identities in AKS `_. """ @@ -505,7 +504,7 @@ class ResourceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Do not use a managed identity for the Managed Cluster, service principal will be used instead. NONE = "None" -class ScaleDownMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ScaleDownMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Describes how VMs are added to or removed from Agent Pools. See `billing states `_. """ @@ -516,7 +515,7 @@ class ScaleDownMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: during scale down. DEALLOCATE = "Deallocate" -class ScaleSetEvictionPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The eviction policy specifies what to do with the VM when it is evicted. The default is Delete. For more information about eviction see `spot VMs `_ @@ -529,7 +528,7 @@ class ScaleSetEvictionPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)) #: cause issues with cluster scaling or upgrading. DEALLOCATE = "Deallocate" -class ScaleSetPriority(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ScaleSetPriority(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The Virtual Machine Scale Set priority. """ @@ -539,7 +538,7 @@ class ScaleSetPriority(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Regular VMs will be used. REGULAR = "Regular" -class SnapshotType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SnapshotType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of a snapshot. The default is NodePool. """ @@ -548,7 +547,7 @@ class SnapshotType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: The snapshot is a snapshot of a managed cluster. MANAGED_CLUSTER = "ManagedCluster" -class TrustedAccessRoleBindingProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class TrustedAccessRoleBindingProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The current provisioning state of trusted access role binding. """ @@ -557,7 +556,7 @@ class TrustedAccessRoleBindingProvisioningState(with_metaclass(CaseInsensitiveEn UPDATING = "Updating" DELETING = "Deleting" -class UpgradeChannel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class UpgradeChannel(str, Enum, metaclass=CaseInsensitiveEnumMeta): """For more information see `setting the AKS cluster auto-upgrade channel `_. """ @@ -587,7 +586,7 @@ class UpgradeChannel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Disables auto-upgrades and keeps the cluster at its current version of Kubernetes. NONE = "none" -class WeekDay(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class WeekDay(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The weekday enum. """ @@ -599,7 +598,7 @@ class WeekDay(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): FRIDAY = "Friday" SATURDAY = "Saturday" -class WorkloadRuntime(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class WorkloadRuntime(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Determines the type of workload a node can run. """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/models/_models_py3.py index 627d45d30471..f3c04f167732 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/models/_models_py3.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/models/_models_py3.py @@ -7,11 +7,13 @@ # -------------------------------------------------------------------------- import datetime -from typing import Dict, List, Optional, Union +from typing import Dict, List, Optional, TYPE_CHECKING, Union import msrest.serialization -from ._container_service_client_enums import * +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + import __init__ as _models class SubResource(msrest.serialization.Model): @@ -79,16 +81,16 @@ class AgentPool(SubResource): :ivar os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS - `_. Possible values - include: "Managed", "Ephemeral". + `_. Known values are: + "Managed", "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Possible values include: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.KubeletDiskType - :ivar workload_runtime: Determines the type of workload a node can run. Possible values - include: "OCIContainer", "WasmWasi". + :ivar workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer", "WasmWasi". :vartype workload_runtime: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.WorkloadRuntime :ivar message_of_the_day: A base64-encoded string which will be written to /etc/motd after @@ -107,12 +109,12 @@ class AgentPool(SubResource): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.OSType :ivar os_sku: Specifies the OS SKU used by the agent pool. If not specified, the default is Ubuntu if OSType=Linux or Windows2019 if OSType=Windows. And the default Windows OSSKU will be - changed to Windows2022 after Windows2019 is deprecated. Possible values include: "Ubuntu", + changed to Windows2022 after Windows2019 is deprecated. Known values are: "Ubuntu", "CBLMariner", "Windows2019", "Windows2022". :vartype os_sku: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. @@ -122,17 +124,16 @@ class AgentPool(SubResource): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it - defaults to Delete. Possible values include: "Delete", "Deallocate". + defaults to Delete. Known values are: "Delete", "Deallocate". :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.ScaleDownMode - :ivar type_properties_type: The type of Agent Pool. Possible values include: + :ivar type_properties_type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :vartype type_properties_type: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Possible values include: "System", - "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". :vartype mode: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.AgentPoolMode :ivar orchestrator_version: Both patch version and are supported. When is specified, the latest supported patch version is chosen @@ -178,12 +179,12 @@ class AgentPool(SubResource): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Possible values include: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Possible values include: "Delete", - "Deallocate". Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which @@ -215,7 +216,7 @@ class AgentPool(SubResource): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.GPUInstanceProfile :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool @@ -296,43 +297,43 @@ def __init__( count: Optional[int] = None, vm_size: Optional[str] = None, os_disk_size_gb: Optional[int] = None, - os_disk_type: Optional[Union[str, "OSDiskType"]] = None, - kubelet_disk_type: Optional[Union[str, "KubeletDiskType"]] = None, - workload_runtime: Optional[Union[str, "WorkloadRuntime"]] = None, + os_disk_type: Optional[Union[str, "_models.OSDiskType"]] = None, + kubelet_disk_type: Optional[Union[str, "_models.KubeletDiskType"]] = None, + workload_runtime: Optional[Union[str, "_models.WorkloadRuntime"]] = None, message_of_the_day: Optional[str] = None, vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", - os_sku: Optional[Union[str, "OSSKU"]] = None, + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - scale_down_mode: Optional[Union[str, "ScaleDownMode"]] = None, - type_properties_type: Optional[Union[str, "AgentPoolType"]] = None, - mode: Optional[Union[str, "AgentPoolMode"]] = None, + scale_down_mode: Optional[Union[str, "_models.ScaleDownMode"]] = None, + type_properties_type: Optional[Union[str, "_models.AgentPoolType"]] = None, + mode: Optional[Union[str, "_models.AgentPoolMode"]] = None, orchestrator_version: Optional[str] = None, current_orchestrator_version: Optional[str] = None, - upgrade_settings: Optional["AgentPoolUpgradeSettings"] = None, - power_state: Optional["PowerState"] = None, + upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, + power_state: Optional["_models.PowerState"] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, enable_custom_ca_trust: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", spot_max_price: Optional[float] = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, proximity_placement_group_id: Optional[str] = None, - kubelet_config: Optional["KubeletConfig"] = None, - linux_os_config: Optional["LinuxOSConfig"] = None, + kubelet_config: Optional["_models.KubeletConfig"] = None, + linux_os_config: Optional["_models.LinuxOSConfig"] = None, enable_encryption_at_host: Optional[bool] = None, enable_ultra_ssd: Optional[bool] = None, enable_fips: Optional[bool] = None, - gpu_instance_profile: Optional[Union[str, "GPUInstanceProfile"]] = None, - creation_data: Optional["CreationData"] = None, + gpu_instance_profile: Optional[Union[str, "_models.GPUInstanceProfile"]] = None, + creation_data: Optional["_models.CreationData"] = None, capacity_reservation_group_id: Optional[str] = None, host_group_id: Optional[str] = None, **kwargs @@ -353,16 +354,16 @@ def __init__( :keyword os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS - `_. Possible values - include: "Managed", "Ephemeral". + `_. Known values are: + "Managed", "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Possible values include: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.KubeletDiskType - :keyword workload_runtime: Determines the type of workload a node can run. Possible values - include: "OCIContainer", "WasmWasi". + :keyword workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer", "WasmWasi". :paramtype workload_runtime: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.WorkloadRuntime :keyword message_of_the_day: A base64-encoded string which will be written to /etc/motd after @@ -381,12 +382,12 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.OSType :keyword os_sku: Specifies the OS SKU used by the agent pool. If not specified, the default is Ubuntu if OSType=Linux or Windows2019 if OSType=Windows. And the default Windows OSSKU will be - changed to Windows2022 after Windows2019 is deprecated. Possible values include: "Ubuntu", + changed to Windows2022 after Windows2019 is deprecated. Known values are: "Ubuntu", "CBLMariner", "Windows2019", "Windows2022". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. @@ -396,17 +397,16 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, - it defaults to Delete. Possible values include: "Delete", "Deallocate". + it defaults to Delete. Known values are: "Delete", "Deallocate". :paramtype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.ScaleDownMode - :keyword type_properties_type: The type of Agent Pool. Possible values include: + :keyword type_properties_type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type_properties_type: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Possible values include: "System", - "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.AgentPoolMode :keyword orchestrator_version: Both patch version and are supported. When is specified, the latest supported patch version is chosen @@ -448,12 +448,12 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Possible values include: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Possible values include: "Delete", - "Deallocate". Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which @@ -487,7 +487,7 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.GPUInstanceProfile @@ -582,7 +582,7 @@ class AgentPoolAvailableVersions(msrest.serialization.Model): def __init__( self, *, - agent_pool_versions: Optional[List["AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem"]] = None, + agent_pool_versions: Optional[List["_models.AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem"]] = None, **kwargs ): """ @@ -659,7 +659,7 @@ class AgentPoolListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["AgentPool"]] = None, + value: Optional[List["_models.AgentPool"]] = None, **kwargs ): """ @@ -686,8 +686,8 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): :vartype type: str :ivar kubernetes_version: Required. The Kubernetes version (major.minor.patch). :vartype kubernetes_version: str - :ivar os_type: Required. The operating system type. The default is Linux. Possible values - include: "Linux", "Windows". Default value: "Linux". + :ivar os_type: Required. The operating system type. The default is Linux. Known values are: + "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -718,16 +718,16 @@ def __init__( self, *, kubernetes_version: str, - os_type: Union[str, "OSType"] = "Linux", - upgrades: Optional[List["AgentPoolUpgradeProfilePropertiesUpgradesItem"]] = None, + os_type: Union[str, "_models.OSType"] = "Linux", + upgrades: Optional[List["_models.AgentPoolUpgradeProfilePropertiesUpgradesItem"]] = None, latest_node_image_version: Optional[str] = None, **kwargs ): """ :keyword kubernetes_version: Required. The Kubernetes version (major.minor.patch). :paramtype kubernetes_version: str - :keyword os_type: Required. The operating system type. The default is Linux. Possible values - include: "Linux", "Windows". Default value: "Linux". + :keyword os_type: Required. The operating system type. The default is Linux. Known values are: + "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: @@ -880,7 +880,7 @@ def __init__( code: Optional[str] = None, message: Optional[str] = None, target: Optional[str] = None, - details: Optional[List["CloudErrorBody"]] = None, + details: Optional[List["_models.CloudErrorBody"]] = None, **kwargs ): """ @@ -925,7 +925,7 @@ class ContainerServiceDiagnosticsProfile(msrest.serialization.Model): def __init__( self, *, - vm_diagnostics: "ContainerServiceVMDiagnostics", + vm_diagnostics: "_models.ContainerServiceVMDiagnostics", **kwargs ): """ @@ -963,7 +963,7 @@ def __init__( self, *, admin_username: str, - ssh: "ContainerServiceSshConfiguration", + ssh: "_models.ContainerServiceSshConfiguration", **kwargs ): """ @@ -986,17 +986,17 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar count: Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, - and 5. The default value is 1. Possible values include: 1, 3, 5. Default value: "1". + and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". :vartype count: int or ~azure.mgmt.containerservice.v2022_04_02_preview.models.Count :ivar dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. :vartype dns_prefix: str - :ivar vm_size: Required. Size of agent VMs. Possible values include: "Standard_A1", - "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", - "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", - "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", - "Standard_A8m_v2", "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", - "Standard_B8ms", "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", - "Standard_D12", "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", + :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", + "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", + "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", + "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", "Standard_B8ms", + "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", "Standard_D12", + "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", "Standard_D13_v2_Promo", "Standard_D14", "Standard_D14_v2", "Standard_D14_v2_Promo", "Standard_D15_v2", "Standard_D16_v3", "Standard_D16s_v3", "Standard_D1_v2", "Standard_D2", "Standard_D2_v2", "Standard_D2_v2_Promo", "Standard_D2_v3", "Standard_D2s_v3", "Standard_D3", @@ -1041,7 +1041,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): :vartype first_consecutive_static_ip: str :ivar storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Possible values include: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". :vartype storage_profile: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.ContainerServiceStorageProfileTypes :ivar fqdn: FQDN for the master pool. @@ -1070,27 +1070,27 @@ def __init__( self, *, dns_prefix: str, - vm_size: Union[str, "ContainerServiceVMSizeTypes"], - count: Optional[Union[int, "Count"]] = 1, + vm_size: Union[str, "_models.ContainerServiceVMSizeTypes"], + count: Optional[Union[int, "_models.Count"]] = 1, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, first_consecutive_static_ip: Optional[str] = "10.240.255.5", - storage_profile: Optional[Union[str, "ContainerServiceStorageProfileTypes"]] = None, + storage_profile: Optional[Union[str, "_models.ContainerServiceStorageProfileTypes"]] = None, **kwargs ): """ :keyword count: Number of masters (VMs) in the container service cluster. Allowed values are 1, - 3, and 5. The default value is 1. Possible values include: 1, 3, 5. Default value: "1". + 3, and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". :paramtype count: int or ~azure.mgmt.containerservice.v2022_04_02_preview.models.Count :keyword dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. :paramtype dns_prefix: str - :keyword vm_size: Required. Size of agent VMs. Possible values include: "Standard_A1", - "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", - "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", - "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", - "Standard_A8m_v2", "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", - "Standard_B8ms", "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", - "Standard_D12", "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", + :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", + "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", + "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", + "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", "Standard_B8ms", + "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", "Standard_D12", + "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", "Standard_D13_v2_Promo", "Standard_D14", "Standard_D14_v2", "Standard_D14_v2_Promo", "Standard_D15_v2", "Standard_D16_v3", "Standard_D16s_v3", "Standard_D1_v2", "Standard_D2", "Standard_D2_v2", "Standard_D2_v2_Promo", "Standard_D2_v3", "Standard_D2s_v3", "Standard_D3", @@ -1135,7 +1135,7 @@ def __init__( :paramtype first_consecutive_static_ip: str :keyword storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Possible values include: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". :paramtype storage_profile: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.ContainerServiceStorageProfileTypes """ @@ -1153,20 +1153,20 @@ def __init__( class ContainerServiceNetworkProfile(msrest.serialization.Model): """Profile of network configuration. - :ivar network_plugin: Network plugin used for building the Kubernetes network. Possible values - include: "azure", "kubenet", "none". Default value: "kubenet". + :ivar network_plugin: Network plugin used for building the Kubernetes network. Known values + are: "azure", "kubenet", "none". Default value: "kubenet". :vartype network_plugin: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.NetworkPlugin - :ivar network_plugin_mode: Network plugin mode used for building the Kubernetes network. - Possible values include: "Overlay". + :ivar network_plugin_mode: Network plugin mode used for building the Kubernetes network. Known + values are: "Overlay". :vartype network_plugin_mode: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.NetworkPluginMode - :ivar network_policy: Network policy used for building the Kubernetes network. Possible values - include: "calico", "azure". + :ivar network_policy: Network policy used for building the Kubernetes network. Known values + are: "calico", "azure". :vartype network_policy: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.NetworkPolicy :ivar network_mode: This cannot be specified if networkPlugin is anything other than 'azure'. - Possible values include: "transparent", "bridge". + Known values are: "transparent", "bridge". :vartype network_mode: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.NetworkMode :ivar pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. @@ -1182,14 +1182,14 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): :vartype docker_bridge_cidr: str :ivar outbound_type: This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type - `_. Possible values include: - "loadBalancer", "userDefinedRouting", "managedNATGateway", "userAssignedNATGateway". Default - value: "loadBalancer". + `_. Known values are: "loadBalancer", + "userDefinedRouting", "managedNATGateway", "userAssignedNATGateway". Default value: + "loadBalancer". :vartype outbound_type: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.OutboundType :ivar load_balancer_sku: The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the - differences between load balancer SKUs. Possible values include: "standard", "basic". + differences between load balancer SKUs. Known values are: "standard", "basic". :vartype load_balancer_sku: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.LoadBalancerSku :ivar load_balancer_profile: Profile of the cluster load balancer. @@ -1240,38 +1240,38 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): def __init__( self, *, - network_plugin: Optional[Union[str, "NetworkPlugin"]] = "kubenet", - network_plugin_mode: Optional[Union[str, "NetworkPluginMode"]] = None, - network_policy: Optional[Union[str, "NetworkPolicy"]] = None, - network_mode: Optional[Union[str, "NetworkMode"]] = None, + network_plugin: Optional[Union[str, "_models.NetworkPlugin"]] = "kubenet", + network_plugin_mode: Optional[Union[str, "_models.NetworkPluginMode"]] = None, + network_policy: Optional[Union[str, "_models.NetworkPolicy"]] = None, + network_mode: Optional[Union[str, "_models.NetworkMode"]] = None, pod_cidr: Optional[str] = "10.244.0.0/16", service_cidr: Optional[str] = "10.0.0.0/16", dns_service_ip: Optional[str] = "10.0.0.10", docker_bridge_cidr: Optional[str] = "172.17.0.1/16", - outbound_type: Optional[Union[str, "OutboundType"]] = "loadBalancer", - load_balancer_sku: Optional[Union[str, "LoadBalancerSku"]] = None, - load_balancer_profile: Optional["ManagedClusterLoadBalancerProfile"] = None, - nat_gateway_profile: Optional["ManagedClusterNATGatewayProfile"] = None, + outbound_type: Optional[Union[str, "_models.OutboundType"]] = "loadBalancer", + load_balancer_sku: Optional[Union[str, "_models.LoadBalancerSku"]] = None, + load_balancer_profile: Optional["_models.ManagedClusterLoadBalancerProfile"] = None, + nat_gateway_profile: Optional["_models.ManagedClusterNATGatewayProfile"] = None, pod_cidrs: Optional[List[str]] = None, service_cidrs: Optional[List[str]] = None, - ip_families: Optional[List[Union[str, "IpFamily"]]] = None, + ip_families: Optional[List[Union[str, "_models.IpFamily"]]] = None, **kwargs ): """ - :keyword network_plugin: Network plugin used for building the Kubernetes network. Possible - values include: "azure", "kubenet", "none". Default value: "kubenet". + :keyword network_plugin: Network plugin used for building the Kubernetes network. Known values + are: "azure", "kubenet", "none". Default value: "kubenet". :paramtype network_plugin: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.NetworkPlugin :keyword network_plugin_mode: Network plugin mode used for building the Kubernetes network. - Possible values include: "Overlay". + Known values are: "Overlay". :paramtype network_plugin_mode: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.NetworkPluginMode - :keyword network_policy: Network policy used for building the Kubernetes network. Possible - values include: "calico", "azure". + :keyword network_policy: Network policy used for building the Kubernetes network. Known values + are: "calico", "azure". :paramtype network_policy: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.NetworkPolicy :keyword network_mode: This cannot be specified if networkPlugin is anything other than - 'azure'. Possible values include: "transparent", "bridge". + 'azure'. Known values are: "transparent", "bridge". :paramtype network_mode: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.NetworkMode :keyword pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. @@ -1287,14 +1287,14 @@ def __init__( :paramtype docker_bridge_cidr: str :keyword outbound_type: This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type - `_. Possible values include: - "loadBalancer", "userDefinedRouting", "managedNATGateway", "userAssignedNATGateway". Default - value: "loadBalancer". + `_. Known values are: "loadBalancer", + "userDefinedRouting", "managedNATGateway", "userAssignedNATGateway". Default value: + "loadBalancer". :paramtype outbound_type: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.OutboundType :keyword load_balancer_sku: The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the - differences between load balancer SKUs. Possible values include: "standard", "basic". + differences between load balancer SKUs. Known values are: "standard", "basic". :paramtype load_balancer_sku: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.LoadBalancerSku :keyword load_balancer_profile: Profile of the cluster load balancer. @@ -1356,7 +1356,7 @@ class ContainerServiceSshConfiguration(msrest.serialization.Model): def __init__( self, *, - public_keys: List["ContainerServiceSshPublicKey"], + public_keys: List["_models.ContainerServiceSshPublicKey"], **kwargs ): """ @@ -1546,7 +1546,7 @@ def __init__( self, *, domain_name: Optional[str] = None, - endpoint_details: Optional[List["EndpointDetail"]] = None, + endpoint_details: Optional[List["_models.EndpointDetail"]] = None, **kwargs ): """ @@ -1612,7 +1612,7 @@ class ExtendedLocation(msrest.serialization.Model): :ivar name: The name of the extended location. :vartype name: str - :ivar type: The type of the extended location. Possible values include: "EdgeZone". + :ivar type: The type of the extended location. Known values are: "EdgeZone". :vartype type: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.ExtendedLocationTypes """ @@ -1626,13 +1626,13 @@ def __init__( self, *, name: Optional[str] = None, - type: Optional[Union[str, "ExtendedLocationTypes"]] = None, + type: Optional[Union[str, "_models.ExtendedLocationTypes"]] = None, **kwargs ): """ :keyword name: The name of the extended location. :paramtype name: str - :keyword type: The type of the extended location. Possible values include: "EdgeZone". + :keyword type: The type of the extended location. Known values are: "EdgeZone". :paramtype type: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.ExtendedLocationTypes """ @@ -1792,7 +1792,7 @@ class LinuxOSConfig(msrest.serialization.Model): def __init__( self, *, - sysctls: Optional["SysctlConfig"] = None, + sysctls: Optional["_models.SysctlConfig"] = None, transparent_huge_page_enabled: Optional[str] = None, transparent_huge_page_defrag: Optional[str] = None, swap_file_size_mb: Optional[int] = None, @@ -1861,8 +1861,8 @@ class MaintenanceConfiguration(SubResource): def __init__( self, *, - time_in_week: Optional[List["TimeInWeek"]] = None, - not_allowed_time: Optional[List["TimeSpan"]] = None, + time_in_week: Optional[List["_models.TimeInWeek"]] = None, + not_allowed_time: Optional[List["_models.TimeSpan"]] = None, **kwargs ): """ @@ -1904,7 +1904,7 @@ class MaintenanceConfigurationListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["MaintenanceConfiguration"]] = None, + value: Optional[List["_models.MaintenanceConfiguration"]] = None, **kwargs ): """ @@ -2157,8 +2157,8 @@ class ManagedCluster(TrackedResource): :ivar ingress_profile: Ingress profile for the managed cluster. :vartype ingress_profile: ~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedClusterIngressProfile - :ivar public_network_access: Allow or deny public network access for AKS. Possible values - include: "Enabled", "Disabled". + :ivar public_network_access: Allow or deny public network access for AKS. Known values are: + "Enabled", "Disabled". :vartype public_network_access: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.PublicNetworkAccess """ @@ -2231,38 +2231,38 @@ def __init__( *, location: str, tags: Optional[Dict[str, str]] = None, - sku: Optional["ManagedClusterSKU"] = None, - extended_location: Optional["ExtendedLocation"] = None, - identity: Optional["ManagedClusterIdentity"] = None, - creation_data: Optional["CreationData"] = None, + sku: Optional["_models.ManagedClusterSKU"] = None, + extended_location: Optional["_models.ExtendedLocation"] = None, + identity: Optional["_models.ManagedClusterIdentity"] = None, + creation_data: Optional["_models.CreationData"] = None, kubernetes_version: Optional[str] = None, dns_prefix: Optional[str] = None, fqdn_subdomain: Optional[str] = None, - agent_pool_profiles: Optional[List["ManagedClusterAgentPoolProfile"]] = None, - linux_profile: Optional["ContainerServiceLinuxProfile"] = None, - windows_profile: Optional["ManagedClusterWindowsProfile"] = None, - service_principal_profile: Optional["ManagedClusterServicePrincipalProfile"] = None, - addon_profiles: Optional[Dict[str, "ManagedClusterAddonProfile"]] = None, - pod_identity_profile: Optional["ManagedClusterPodIdentityProfile"] = None, - oidc_issuer_profile: Optional["ManagedClusterOIDCIssuerProfile"] = None, + agent_pool_profiles: Optional[List["_models.ManagedClusterAgentPoolProfile"]] = None, + linux_profile: Optional["_models.ContainerServiceLinuxProfile"] = None, + windows_profile: Optional["_models.ManagedClusterWindowsProfile"] = None, + service_principal_profile: Optional["_models.ManagedClusterServicePrincipalProfile"] = None, + addon_profiles: Optional[Dict[str, "_models.ManagedClusterAddonProfile"]] = None, + pod_identity_profile: Optional["_models.ManagedClusterPodIdentityProfile"] = None, + oidc_issuer_profile: Optional["_models.ManagedClusterOIDCIssuerProfile"] = None, node_resource_group: Optional[str] = None, enable_rbac: Optional[bool] = None, enable_pod_security_policy: Optional[bool] = None, enable_namespace_resources: Optional[bool] = None, - network_profile: Optional["ContainerServiceNetworkProfile"] = None, - aad_profile: Optional["ManagedClusterAADProfile"] = None, - auto_upgrade_profile: Optional["ManagedClusterAutoUpgradeProfile"] = None, - auto_scaler_profile: Optional["ManagedClusterPropertiesAutoScalerProfile"] = None, - api_server_access_profile: Optional["ManagedClusterAPIServerAccessProfile"] = None, + network_profile: Optional["_models.ContainerServiceNetworkProfile"] = None, + aad_profile: Optional["_models.ManagedClusterAADProfile"] = None, + auto_upgrade_profile: Optional["_models.ManagedClusterAutoUpgradeProfile"] = None, + auto_scaler_profile: Optional["_models.ManagedClusterPropertiesAutoScalerProfile"] = None, + api_server_access_profile: Optional["_models.ManagedClusterAPIServerAccessProfile"] = None, disk_encryption_set_id: Optional[str] = None, - identity_profile: Optional[Dict[str, "UserAssignedIdentity"]] = None, - private_link_resources: Optional[List["PrivateLinkResource"]] = None, + identity_profile: Optional[Dict[str, "_models.UserAssignedIdentity"]] = None, + private_link_resources: Optional[List["_models.PrivateLinkResource"]] = None, disable_local_accounts: Optional[bool] = None, - http_proxy_config: Optional["ManagedClusterHTTPProxyConfig"] = None, - security_profile: Optional["ManagedClusterSecurityProfile"] = None, - storage_profile: Optional["ManagedClusterStorageProfile"] = None, - ingress_profile: Optional["ManagedClusterIngressProfile"] = None, - public_network_access: Optional[Union[str, "PublicNetworkAccess"]] = None, + http_proxy_config: Optional["_models.ManagedClusterHTTPProxyConfig"] = None, + security_profile: Optional["_models.ManagedClusterSecurityProfile"] = None, + storage_profile: Optional["_models.ManagedClusterStorageProfile"] = None, + ingress_profile: Optional["_models.ManagedClusterIngressProfile"] = None, + public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None, **kwargs ): """ @@ -2369,8 +2369,8 @@ def __init__( :keyword ingress_profile: Ingress profile for the managed cluster. :paramtype ingress_profile: ~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedClusterIngressProfile - :keyword public_network_access: Allow or deny public network access for AKS. Possible values - include: "Enabled", "Disabled". + :keyword public_network_access: Allow or deny public network access for AKS. Known values are: + "Enabled", "Disabled". :paramtype public_network_access: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.PublicNetworkAccess """ @@ -2692,16 +2692,16 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS - `_. Possible values - include: "Managed", "Ephemeral". + `_. Known values are: + "Managed", "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Possible values include: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.KubeletDiskType - :ivar workload_runtime: Determines the type of workload a node can run. Possible values - include: "OCIContainer", "WasmWasi". + :ivar workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer", "WasmWasi". :vartype workload_runtime: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.WorkloadRuntime :ivar message_of_the_day: A base64-encoded string which will be written to /etc/motd after @@ -2720,12 +2720,12 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.OSType :ivar os_sku: Specifies the OS SKU used by the agent pool. If not specified, the default is Ubuntu if OSType=Linux or Windows2019 if OSType=Windows. And the default Windows OSSKU will be - changed to Windows2022 after Windows2019 is deprecated. Possible values include: "Ubuntu", + changed to Windows2022 after Windows2019 is deprecated. Known values are: "Ubuntu", "CBLMariner", "Windows2019", "Windows2022". :vartype os_sku: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. @@ -2735,16 +2735,15 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it - defaults to Delete. Possible values include: "Delete", "Deallocate". + defaults to Delete. Known values are: "Delete", "Deallocate". :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.ScaleDownMode - :ivar type: The type of Agent Pool. Possible values include: "VirtualMachineScaleSets", + :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Possible values include: "System", - "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". :vartype mode: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.AgentPoolMode :ivar orchestrator_version: Both patch version and are supported. When is specified, the latest supported patch version is chosen @@ -2790,12 +2789,12 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Possible values include: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Possible values include: "Delete", - "Deallocate". Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which @@ -2827,7 +2826,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.GPUInstanceProfile :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool @@ -2902,43 +2901,43 @@ def __init__( count: Optional[int] = None, vm_size: Optional[str] = None, os_disk_size_gb: Optional[int] = None, - os_disk_type: Optional[Union[str, "OSDiskType"]] = None, - kubelet_disk_type: Optional[Union[str, "KubeletDiskType"]] = None, - workload_runtime: Optional[Union[str, "WorkloadRuntime"]] = None, + os_disk_type: Optional[Union[str, "_models.OSDiskType"]] = None, + kubelet_disk_type: Optional[Union[str, "_models.KubeletDiskType"]] = None, + workload_runtime: Optional[Union[str, "_models.WorkloadRuntime"]] = None, message_of_the_day: Optional[str] = None, vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", - os_sku: Optional[Union[str, "OSSKU"]] = None, + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - scale_down_mode: Optional[Union[str, "ScaleDownMode"]] = None, - type: Optional[Union[str, "AgentPoolType"]] = None, - mode: Optional[Union[str, "AgentPoolMode"]] = None, + scale_down_mode: Optional[Union[str, "_models.ScaleDownMode"]] = None, + type: Optional[Union[str, "_models.AgentPoolType"]] = None, + mode: Optional[Union[str, "_models.AgentPoolMode"]] = None, orchestrator_version: Optional[str] = None, current_orchestrator_version: Optional[str] = None, - upgrade_settings: Optional["AgentPoolUpgradeSettings"] = None, - power_state: Optional["PowerState"] = None, + upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, + power_state: Optional["_models.PowerState"] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, enable_custom_ca_trust: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", spot_max_price: Optional[float] = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, proximity_placement_group_id: Optional[str] = None, - kubelet_config: Optional["KubeletConfig"] = None, - linux_os_config: Optional["LinuxOSConfig"] = None, + kubelet_config: Optional["_models.KubeletConfig"] = None, + linux_os_config: Optional["_models.LinuxOSConfig"] = None, enable_encryption_at_host: Optional[bool] = None, enable_ultra_ssd: Optional[bool] = None, enable_fips: Optional[bool] = None, - gpu_instance_profile: Optional[Union[str, "GPUInstanceProfile"]] = None, - creation_data: Optional["CreationData"] = None, + gpu_instance_profile: Optional[Union[str, "_models.GPUInstanceProfile"]] = None, + creation_data: Optional["_models.CreationData"] = None, capacity_reservation_group_id: Optional[str] = None, host_group_id: Optional[str] = None, **kwargs @@ -2959,16 +2958,16 @@ def __init__( :keyword os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS - `_. Possible values - include: "Managed", "Ephemeral". + `_. Known values are: + "Managed", "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Possible values include: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.KubeletDiskType - :keyword workload_runtime: Determines the type of workload a node can run. Possible values - include: "OCIContainer", "WasmWasi". + :keyword workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer", "WasmWasi". :paramtype workload_runtime: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.WorkloadRuntime :keyword message_of_the_day: A base64-encoded string which will be written to /etc/motd after @@ -2987,12 +2986,12 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.OSType :keyword os_sku: Specifies the OS SKU used by the agent pool. If not specified, the default is Ubuntu if OSType=Linux or Windows2019 if OSType=Windows. And the default Windows OSSKU will be - changed to Windows2022 after Windows2019 is deprecated. Possible values include: "Ubuntu", + changed to Windows2022 after Windows2019 is deprecated. Known values are: "Ubuntu", "CBLMariner", "Windows2019", "Windows2022". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. @@ -3002,16 +3001,15 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, - it defaults to Delete. Possible values include: "Delete", "Deallocate". + it defaults to Delete. Known values are: "Delete", "Deallocate". :paramtype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.ScaleDownMode - :keyword type: The type of Agent Pool. Possible values include: "VirtualMachineScaleSets", + :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Possible values include: "System", - "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.AgentPoolMode :keyword orchestrator_version: Both patch version and are supported. When is specified, the latest supported patch version is chosen @@ -3053,12 +3051,12 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Possible values include: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Possible values include: "Delete", - "Deallocate". Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which @@ -3092,7 +3090,7 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.GPUInstanceProfile @@ -3177,16 +3175,16 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS - `_. Possible values - include: "Managed", "Ephemeral". + `_. Known values are: + "Managed", "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Possible values include: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.KubeletDiskType - :ivar workload_runtime: Determines the type of workload a node can run. Possible values - include: "OCIContainer", "WasmWasi". + :ivar workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer", "WasmWasi". :vartype workload_runtime: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.WorkloadRuntime :ivar message_of_the_day: A base64-encoded string which will be written to /etc/motd after @@ -3205,12 +3203,12 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.OSType :ivar os_sku: Specifies the OS SKU used by the agent pool. If not specified, the default is Ubuntu if OSType=Linux or Windows2019 if OSType=Windows. And the default Windows OSSKU will be - changed to Windows2022 after Windows2019 is deprecated. Possible values include: "Ubuntu", + changed to Windows2022 after Windows2019 is deprecated. Known values are: "Ubuntu", "CBLMariner", "Windows2019", "Windows2022". :vartype os_sku: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. @@ -3220,16 +3218,15 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it - defaults to Delete. Possible values include: "Delete", "Deallocate". + defaults to Delete. Known values are: "Delete", "Deallocate". :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.ScaleDownMode - :ivar type: The type of Agent Pool. Possible values include: "VirtualMachineScaleSets", + :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Possible values include: "System", - "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". :vartype mode: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.AgentPoolMode :ivar orchestrator_version: Both patch version and are supported. When is specified, the latest supported patch version is chosen @@ -3275,12 +3272,12 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Possible values include: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Possible values include: "Delete", - "Deallocate". Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which @@ -3312,7 +3309,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.GPUInstanceProfile :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool @@ -3392,43 +3389,43 @@ def __init__( count: Optional[int] = None, vm_size: Optional[str] = None, os_disk_size_gb: Optional[int] = None, - os_disk_type: Optional[Union[str, "OSDiskType"]] = None, - kubelet_disk_type: Optional[Union[str, "KubeletDiskType"]] = None, - workload_runtime: Optional[Union[str, "WorkloadRuntime"]] = None, + os_disk_type: Optional[Union[str, "_models.OSDiskType"]] = None, + kubelet_disk_type: Optional[Union[str, "_models.KubeletDiskType"]] = None, + workload_runtime: Optional[Union[str, "_models.WorkloadRuntime"]] = None, message_of_the_day: Optional[str] = None, vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", - os_sku: Optional[Union[str, "OSSKU"]] = None, + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - scale_down_mode: Optional[Union[str, "ScaleDownMode"]] = None, - type: Optional[Union[str, "AgentPoolType"]] = None, - mode: Optional[Union[str, "AgentPoolMode"]] = None, + scale_down_mode: Optional[Union[str, "_models.ScaleDownMode"]] = None, + type: Optional[Union[str, "_models.AgentPoolType"]] = None, + mode: Optional[Union[str, "_models.AgentPoolMode"]] = None, orchestrator_version: Optional[str] = None, current_orchestrator_version: Optional[str] = None, - upgrade_settings: Optional["AgentPoolUpgradeSettings"] = None, - power_state: Optional["PowerState"] = None, + upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, + power_state: Optional["_models.PowerState"] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, enable_custom_ca_trust: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", spot_max_price: Optional[float] = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, proximity_placement_group_id: Optional[str] = None, - kubelet_config: Optional["KubeletConfig"] = None, - linux_os_config: Optional["LinuxOSConfig"] = None, + kubelet_config: Optional["_models.KubeletConfig"] = None, + linux_os_config: Optional["_models.LinuxOSConfig"] = None, enable_encryption_at_host: Optional[bool] = None, enable_ultra_ssd: Optional[bool] = None, enable_fips: Optional[bool] = None, - gpu_instance_profile: Optional[Union[str, "GPUInstanceProfile"]] = None, - creation_data: Optional["CreationData"] = None, + gpu_instance_profile: Optional[Union[str, "_models.GPUInstanceProfile"]] = None, + creation_data: Optional["_models.CreationData"] = None, capacity_reservation_group_id: Optional[str] = None, host_group_id: Optional[str] = None, **kwargs @@ -3449,16 +3446,16 @@ def __init__( :keyword os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS - `_. Possible values - include: "Managed", "Ephemeral". + `_. Known values are: + "Managed", "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Possible values include: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.KubeletDiskType - :keyword workload_runtime: Determines the type of workload a node can run. Possible values - include: "OCIContainer", "WasmWasi". + :keyword workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer", "WasmWasi". :paramtype workload_runtime: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.WorkloadRuntime :keyword message_of_the_day: A base64-encoded string which will be written to /etc/motd after @@ -3477,12 +3474,12 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.OSType :keyword os_sku: Specifies the OS SKU used by the agent pool. If not specified, the default is Ubuntu if OSType=Linux or Windows2019 if OSType=Windows. And the default Windows OSSKU will be - changed to Windows2022 after Windows2019 is deprecated. Possible values include: "Ubuntu", + changed to Windows2022 after Windows2019 is deprecated. Known values are: "Ubuntu", "CBLMariner", "Windows2019", "Windows2022". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. @@ -3492,16 +3489,15 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, - it defaults to Delete. Possible values include: "Delete", "Deallocate". + it defaults to Delete. Known values are: "Delete", "Deallocate". :paramtype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.ScaleDownMode - :keyword type: The type of Agent Pool. Possible values include: "VirtualMachineScaleSets", + :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Possible values include: "System", - "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.AgentPoolMode :keyword orchestrator_version: Both patch version and are supported. When is specified, the latest supported patch version is chosen @@ -3543,12 +3539,12 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Possible values include: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Possible values include: "Delete", - "Deallocate". Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which @@ -3582,7 +3578,7 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.GPUInstanceProfile @@ -3693,8 +3689,8 @@ class ManagedClusterAutoUpgradeProfile(msrest.serialization.Model): """Auto upgrade profile for a managed cluster. :ivar upgrade_channel: For more information see `setting the AKS cluster auto-upgrade channel - `_. Possible - values include: "rapid", "stable", "patch", "node-image", "none". + `_. Known values + are: "rapid", "stable", "patch", "node-image", "none". :vartype upgrade_channel: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.UpgradeChannel """ @@ -3706,13 +3702,13 @@ class ManagedClusterAutoUpgradeProfile(msrest.serialization.Model): def __init__( self, *, - upgrade_channel: Optional[Union[str, "UpgradeChannel"]] = None, + upgrade_channel: Optional[Union[str, "_models.UpgradeChannel"]] = None, **kwargs ): """ :keyword upgrade_channel: For more information see `setting the AKS cluster auto-upgrade channel `_. - Possible values include: "rapid", "stable", "patch", "node-image", "none". + Known values are: "rapid", "stable", "patch", "node-image", "none". :paramtype upgrade_channel: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.UpgradeChannel """ @@ -3789,7 +3785,7 @@ class ManagedClusterIdentity(msrest.serialization.Model): components. :vartype tenant_id: str :ivar type: For more information see `use managed identities in AKS - `_. Possible values include: + `_. Known values are: "SystemAssigned", "UserAssigned", "None". :vartype type: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.ResourceIdentityType @@ -3814,13 +3810,13 @@ class ManagedClusterIdentity(msrest.serialization.Model): def __init__( self, *, - type: Optional[Union[str, "ResourceIdentityType"]] = None, - user_assigned_identities: Optional[Dict[str, "ManagedServiceIdentityUserAssignedIdentitiesValue"]] = None, + type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, + user_assigned_identities: Optional[Dict[str, "_models.ManagedServiceIdentityUserAssignedIdentitiesValue"]] = None, **kwargs ): """ :keyword type: For more information see `use managed identities in AKS - `_. Possible values include: + `_. Known values are: "SystemAssigned", "UserAssigned", "None". :paramtype type: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.ResourceIdentityType @@ -3851,7 +3847,7 @@ class ManagedClusterIngressProfile(msrest.serialization.Model): def __init__( self, *, - web_app_routing: Optional["ManagedClusterIngressProfileWebAppRouting"] = None, + web_app_routing: Optional["_models.ManagedClusterIngressProfileWebAppRouting"] = None, **kwargs ): """ @@ -3920,7 +3916,7 @@ class ManagedClusterListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["ManagedCluster"]] = None, + value: Optional[List["_models.ManagedCluster"]] = None, **kwargs ): """ @@ -3978,10 +3974,10 @@ class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): def __init__( self, *, - managed_outbound_i_ps: Optional["ManagedClusterLoadBalancerProfileManagedOutboundIPs"] = None, - outbound_ip_prefixes: Optional["ManagedClusterLoadBalancerProfileOutboundIPPrefixes"] = None, - outbound_i_ps: Optional["ManagedClusterLoadBalancerProfileOutboundIPs"] = None, - effective_outbound_i_ps: Optional[List["ResourceReference"]] = None, + managed_outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileManagedOutboundIPs"] = None, + outbound_ip_prefixes: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPPrefixes"] = None, + outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPs"] = None, + effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, allocated_outbound_ports: Optional[int] = 0, idle_timeout_in_minutes: Optional[int] = 30, enable_multiple_standard_load_balancers: Optional[bool] = None, @@ -4083,7 +4079,7 @@ class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.M def __init__( self, *, - public_ip_prefixes: Optional[List["ResourceReference"]] = None, + public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, **kwargs ): """ @@ -4110,7 +4106,7 @@ class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): def __init__( self, *, - public_i_ps: Optional[List["ResourceReference"]] = None, + public_i_ps: Optional[List["_models.ResourceReference"]] = None, **kwargs ): """ @@ -4181,8 +4177,8 @@ class ManagedClusterNATGatewayProfile(msrest.serialization.Model): def __init__( self, *, - managed_outbound_ip_profile: Optional["ManagedClusterManagedOutboundIPProfile"] = None, - effective_outbound_i_ps: Optional[List["ResourceReference"]] = None, + managed_outbound_ip_profile: Optional["_models.ManagedClusterManagedOutboundIPProfile"] = None, + effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, idle_timeout_in_minutes: Optional[int] = 4, **kwargs ): @@ -4255,8 +4251,8 @@ class ManagedClusterPodIdentity(msrest.serialization.Model): :vartype binding_selector: str :ivar identity: Required. The user assigned identity details. :vartype identity: ~azure.mgmt.containerservice.v2022_04_02_preview.models.UserAssignedIdentity - :ivar provisioning_state: The current provisioning state of the pod identity. Possible values - include: "Assigned", "Updating", "Deleting", "Failed". + :ivar provisioning_state: The current provisioning state of the pod identity. Known values are: + "Assigned", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedClusterPodIdentityProvisioningState :ivar provisioning_info: @@ -4286,7 +4282,7 @@ def __init__( *, name: str, namespace: str, - identity: "UserAssignedIdentity", + identity: "_models.UserAssignedIdentity", binding_selector: Optional[str] = None, **kwargs ): @@ -4388,8 +4384,8 @@ def __init__( *, enabled: Optional[bool] = None, allow_network_plugin_kubenet: Optional[bool] = None, - user_assigned_identities: Optional[List["ManagedClusterPodIdentity"]] = None, - user_assigned_identity_exceptions: Optional[List["ManagedClusterPodIdentityException"]] = None, + user_assigned_identities: Optional[List["_models.ManagedClusterPodIdentity"]] = None, + user_assigned_identity_exceptions: Optional[List["_models.ManagedClusterPodIdentityException"]] = None, **kwargs ): """ @@ -4430,7 +4426,7 @@ class ManagedClusterPodIdentityProvisioningError(msrest.serialization.Model): def __init__( self, *, - error: Optional["ManagedClusterPodIdentityProvisioningErrorBody"] = None, + error: Optional["_models.ManagedClusterPodIdentityProvisioningErrorBody"] = None, **kwargs ): """ @@ -4472,7 +4468,7 @@ def __init__( code: Optional[str] = None, message: Optional[str] = None, target: Optional[str] = None, - details: Optional[List["ManagedClusterPodIdentityProvisioningErrorBody"]] = None, + details: Optional[List["_models.ManagedClusterPodIdentityProvisioningErrorBody"]] = None, **kwargs ): """ @@ -4511,7 +4507,7 @@ class ManagedClusterPodIdentityProvisioningInfo(msrest.serialization.Model): def __init__( self, *, - error: Optional["ManagedClusterPodIdentityProvisioningError"] = None, + error: Optional["_models.ManagedClusterPodIdentityProvisioningError"] = None, **kwargs ): """ @@ -4532,8 +4528,8 @@ class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): :vartype kubernetes_version: str :ivar name: The Agent Pool name. :vartype name: str - :ivar os_type: Required. The operating system type. The default is Linux. Possible values - include: "Linux", "Windows". Default value: "Linux". + :ivar os_type: Required. The operating system type. The default is Linux. Known values are: + "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -4556,9 +4552,9 @@ def __init__( self, *, kubernetes_version: str, - os_type: Union[str, "OSType"] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", name: Optional[str] = None, - upgrades: Optional[List["ManagedClusterPoolUpgradeProfileUpgradesItem"]] = None, + upgrades: Optional[List["_models.ManagedClusterPoolUpgradeProfileUpgradesItem"]] = None, **kwargs ): """ @@ -4566,8 +4562,8 @@ def __init__( :paramtype kubernetes_version: str :keyword name: The Agent Pool name. :paramtype name: str - :keyword os_type: Required. The operating system type. The default is Linux. Possible values - include: "Linux", "Windows". Default value: "Linux". + :keyword os_type: Required. The operating system type. The default is Linux. Known values are: + "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: @@ -4619,8 +4615,7 @@ class ManagedClusterPropertiesAutoScalerProfile(msrest.serialization.Model): :vartype balance_similar_node_groups: str :ivar expander: If not specified, the default is 'random'. See `expanders `_ - for more information. Possible values include: "least-waste", "most-pods", "priority", - "random". + for more information. Known values are: "least-waste", "most-pods", "priority", "random". :vartype expander: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.Expander :ivar max_empty_bulk_delete: The default is 10. :vartype max_empty_bulk_delete: str @@ -4687,7 +4682,7 @@ def __init__( self, *, balance_similar_node_groups: Optional[str] = None, - expander: Optional[Union[str, "Expander"]] = None, + expander: Optional[Union[str, "_models.Expander"]] = None, max_empty_bulk_delete: Optional[str] = None, max_graceful_termination_sec: Optional[str] = None, max_node_provision_time: Optional[str] = None, @@ -4710,8 +4705,7 @@ def __init__( :paramtype balance_similar_node_groups: str :keyword expander: If not specified, the default is 'random'. See `expanders `_ - for more information. Possible values include: "least-waste", "most-pods", "priority", - "random". + for more information. Known values are: "least-waste", "most-pods", "priority", "random". :paramtype expander: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.Expander :keyword max_empty_bulk_delete: The default is 10. :paramtype max_empty_bulk_delete: str @@ -4805,7 +4799,7 @@ def __init__( self, *, kubernetes_version: Optional[str] = None, - sku: Optional["ManagedClusterSKU"] = None, + sku: Optional["_models.ManagedClusterSKU"] = None, enable_rbac: Optional[bool] = None, **kwargs ): @@ -4851,9 +4845,9 @@ class ManagedClusterSecurityProfile(msrest.serialization.Model): def __init__( self, *, - azure_defender: Optional["ManagedClusterSecurityProfileAzureDefender"] = None, - azure_key_vault_kms: Optional["AzureKeyVaultKms"] = None, - workload_identity: Optional["ManagedClusterSecurityProfileWorkloadIdentity"] = None, + azure_defender: Optional["_models.ManagedClusterSecurityProfileAzureDefender"] = None, + azure_key_vault_kms: Optional["_models.AzureKeyVaultKms"] = None, + workload_identity: Optional["_models.ManagedClusterSecurityProfileWorkloadIdentity"] = None, **kwargs ): """ @@ -4978,12 +4972,12 @@ def __init__( class ManagedClusterSKU(msrest.serialization.Model): """The SKU of a Managed Cluster. - :ivar name: The name of a managed cluster SKU. Possible values include: "Basic". + :ivar name: The name of a managed cluster SKU. Known values are: "Basic". :vartype name: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedClusterSKUName :ivar tier: If not specified, the default is 'Free'. See `uptime SLA - `_ for more details. Possible values include: - "Paid", "Free". + `_ for more details. Known values are: "Paid", + "Free". :vartype tier: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedClusterSKUTier """ @@ -4996,17 +4990,17 @@ class ManagedClusterSKU(msrest.serialization.Model): def __init__( self, *, - name: Optional[Union[str, "ManagedClusterSKUName"]] = None, - tier: Optional[Union[str, "ManagedClusterSKUTier"]] = None, + name: Optional[Union[str, "_models.ManagedClusterSKUName"]] = None, + tier: Optional[Union[str, "_models.ManagedClusterSKUTier"]] = None, **kwargs ): """ - :keyword name: The name of a managed cluster SKU. Possible values include: "Basic". + :keyword name: The name of a managed cluster SKU. Known values are: "Basic". :paramtype name: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedClusterSKUName :keyword tier: If not specified, the default is 'Free'. See `uptime SLA - `_ for more details. Possible values include: - "Paid", "Free". + `_ for more details. Known values are: "Paid", + "Free". :paramtype tier: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedClusterSKUTier """ @@ -5040,7 +5034,7 @@ class ManagedClusterSnapshot(TrackedResource): :ivar creation_data: CreationData to be used to specify the source resource ID to create this snapshot. :vartype creation_data: ~azure.mgmt.containerservice.v2022_04_02_preview.models.CreationData - :ivar snapshot_type: The type of a snapshot. The default is NodePool. Possible values include: + :ivar snapshot_type: The type of a snapshot. The default is NodePool. Known values are: "NodePool", "ManagedCluster". Default value: "NodePool". :vartype snapshot_type: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.SnapshotType @@ -5076,8 +5070,8 @@ def __init__( *, location: str, tags: Optional[Dict[str, str]] = None, - creation_data: Optional["CreationData"] = None, - snapshot_type: Optional[Union[str, "SnapshotType"]] = "NodePool", + creation_data: Optional["_models.CreationData"] = None, + snapshot_type: Optional[Union[str, "_models.SnapshotType"]] = "NodePool", **kwargs ): """ @@ -5088,8 +5082,8 @@ def __init__( :keyword creation_data: CreationData to be used to specify the source resource ID to create this snapshot. :paramtype creation_data: ~azure.mgmt.containerservice.v2022_04_02_preview.models.CreationData - :keyword snapshot_type: The type of a snapshot. The default is NodePool. Possible values - include: "NodePool", "ManagedCluster". Default value: "NodePool". + :keyword snapshot_type: The type of a snapshot. The default is NodePool. Known values are: + "NodePool", "ManagedCluster". Default value: "NodePool". :paramtype snapshot_type: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.SnapshotType """ @@ -5123,7 +5117,7 @@ class ManagedClusterSnapshotListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["ManagedClusterSnapshot"]] = None, + value: Optional[List["_models.ManagedClusterSnapshot"]] = None, **kwargs ): """ @@ -5159,9 +5153,9 @@ class ManagedClusterStorageProfile(msrest.serialization.Model): def __init__( self, *, - disk_csi_driver: Optional["ManagedClusterStorageProfileDiskCSIDriver"] = None, - file_csi_driver: Optional["ManagedClusterStorageProfileFileCSIDriver"] = None, - snapshot_controller: Optional["ManagedClusterStorageProfileSnapshotController"] = None, + disk_csi_driver: Optional["_models.ManagedClusterStorageProfileDiskCSIDriver"] = None, + file_csi_driver: Optional["_models.ManagedClusterStorageProfileFileCSIDriver"] = None, + snapshot_controller: Optional["_models.ManagedClusterStorageProfileSnapshotController"] = None, **kwargs ): """ @@ -5304,8 +5298,8 @@ class ManagedClusterUpgradeProfile(msrest.serialization.Model): def __init__( self, *, - control_plane_profile: "ManagedClusterPoolUpgradeProfile", - agent_pool_profiles: List["ManagedClusterPoolUpgradeProfile"], + control_plane_profile: "_models.ManagedClusterPoolUpgradeProfile", + agent_pool_profiles: List["_models.ManagedClusterPoolUpgradeProfile"], **kwargs ): """ @@ -5347,8 +5341,8 @@ class ManagedClusterWindowsProfile(msrest.serialization.Model): "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!". :vartype admin_password: str :ivar license_type: The license type to use for Windows VMs. See `Azure Hybrid User Benefits - `_ for more details. Possible values - include: "None", "Windows_Server". + `_ for more details. Known values are: + "None", "Windows_Server". :vartype license_type: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.LicenseType :ivar enable_csi_proxy: For more details on CSI proxy, see the `CSI proxy GitHub repo @@ -5376,9 +5370,9 @@ def __init__( *, admin_username: str, admin_password: Optional[str] = None, - license_type: Optional[Union[str, "LicenseType"]] = None, + license_type: Optional[Union[str, "_models.LicenseType"]] = None, enable_csi_proxy: Optional[bool] = None, - gmsa_profile: Optional["WindowsGmsaProfile"] = None, + gmsa_profile: Optional["_models.WindowsGmsaProfile"] = None, **kwargs ): """ @@ -5399,8 +5393,8 @@ def __init__( "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!". :paramtype admin_password: str :keyword license_type: The license type to use for Windows VMs. See `Azure Hybrid User Benefits - `_ for more details. Possible values - include: "None", "Windows_Server". + `_ for more details. Known values are: + "None", "Windows_Server". :paramtype license_type: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.LicenseType :keyword enable_csi_proxy: For more details on CSI proxy, see the `CSI proxy GitHub repo @@ -5453,23 +5447,23 @@ def __init__( class NetworkProfileForSnapshot(msrest.serialization.Model): """network profile for managed cluster snapshot, these properties are read only. - :ivar network_plugin: networkPlugin for managed cluster snapshot. Possible values include: - "azure", "kubenet", "none". Default value: "kubenet". + :ivar network_plugin: networkPlugin for managed cluster snapshot. Known values are: "azure", + "kubenet", "none". Default value: "kubenet". :vartype network_plugin: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.NetworkPlugin - :ivar network_plugin_mode: NetworkPluginMode for managed cluster snapshot. Possible values - include: "Overlay". + :ivar network_plugin_mode: NetworkPluginMode for managed cluster snapshot. Known values are: + "Overlay". :vartype network_plugin_mode: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.NetworkPluginMode - :ivar network_policy: networkPolicy for managed cluster snapshot. Possible values include: - "calico", "azure". + :ivar network_policy: networkPolicy for managed cluster snapshot. Known values are: "calico", + "azure". :vartype network_policy: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.NetworkPolicy - :ivar network_mode: networkMode for managed cluster snapshot. Possible values include: - "transparent", "bridge". + :ivar network_mode: networkMode for managed cluster snapshot. Known values are: "transparent", + "bridge". :vartype network_mode: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.NetworkMode - :ivar load_balancer_sku: loadBalancerSku for managed cluster snapshot. Possible values include: + :ivar load_balancer_sku: loadBalancerSku for managed cluster snapshot. Known values are: "standard", "basic". :vartype load_balancer_sku: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.LoadBalancerSku @@ -5486,32 +5480,32 @@ class NetworkProfileForSnapshot(msrest.serialization.Model): def __init__( self, *, - network_plugin: Optional[Union[str, "NetworkPlugin"]] = "kubenet", - network_plugin_mode: Optional[Union[str, "NetworkPluginMode"]] = None, - network_policy: Optional[Union[str, "NetworkPolicy"]] = None, - network_mode: Optional[Union[str, "NetworkMode"]] = None, - load_balancer_sku: Optional[Union[str, "LoadBalancerSku"]] = None, + network_plugin: Optional[Union[str, "_models.NetworkPlugin"]] = "kubenet", + network_plugin_mode: Optional[Union[str, "_models.NetworkPluginMode"]] = None, + network_policy: Optional[Union[str, "_models.NetworkPolicy"]] = None, + network_mode: Optional[Union[str, "_models.NetworkMode"]] = None, + load_balancer_sku: Optional[Union[str, "_models.LoadBalancerSku"]] = None, **kwargs ): """ - :keyword network_plugin: networkPlugin for managed cluster snapshot. Possible values include: - "azure", "kubenet", "none". Default value: "kubenet". + :keyword network_plugin: networkPlugin for managed cluster snapshot. Known values are: "azure", + "kubenet", "none". Default value: "kubenet". :paramtype network_plugin: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.NetworkPlugin - :keyword network_plugin_mode: NetworkPluginMode for managed cluster snapshot. Possible values - include: "Overlay". + :keyword network_plugin_mode: NetworkPluginMode for managed cluster snapshot. Known values are: + "Overlay". :paramtype network_plugin_mode: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.NetworkPluginMode - :keyword network_policy: networkPolicy for managed cluster snapshot. Possible values include: + :keyword network_policy: networkPolicy for managed cluster snapshot. Known values are: "calico", "azure". :paramtype network_policy: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.NetworkPolicy - :keyword network_mode: networkMode for managed cluster snapshot. Possible values include: + :keyword network_mode: networkMode for managed cluster snapshot. Known values are: "transparent", "bridge". :paramtype network_mode: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.NetworkMode - :keyword load_balancer_sku: loadBalancerSku for managed cluster snapshot. Possible values - include: "standard", "basic". + :keyword load_balancer_sku: loadBalancerSku for managed cluster snapshot. Known values are: + "standard", "basic". :paramtype load_balancer_sku: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.LoadBalancerSku """ @@ -5637,7 +5631,7 @@ class OSOptionProfile(msrest.serialization.Model): def __init__( self, *, - os_option_property_list: List["OSOptionProperty"], + os_option_property_list: List["_models.OSOptionProperty"], **kwargs ): """ @@ -5711,7 +5705,7 @@ def __init__( self, *, category: Optional[str] = None, - endpoints: Optional[List["EndpointDependency"]] = None, + endpoints: Optional[List["_models.EndpointDependency"]] = None, **kwargs ): """ @@ -5754,7 +5748,7 @@ class OutboundEnvironmentEndpointCollection(msrest.serialization.Model): def __init__( self, *, - value: List["OutboundEnvironmentEndpoint"], + value: List["_models.OutboundEnvironmentEndpoint"], **kwargs ): """ @@ -5770,8 +5764,8 @@ def __init__( class PowerState(msrest.serialization.Model): """Describes the Power State of the cluster. - :ivar code: Tells whether the cluster is Running or Stopped. Possible values include: - "Running", "Stopped". + :ivar code: Tells whether the cluster is Running or Stopped. Known values are: "Running", + "Stopped". :vartype code: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.Code """ @@ -5782,12 +5776,12 @@ class PowerState(msrest.serialization.Model): def __init__( self, *, - code: Optional[Union[str, "Code"]] = None, + code: Optional[Union[str, "_models.Code"]] = None, **kwargs ): """ - :keyword code: Tells whether the cluster is Running or Stopped. Possible values include: - "Running", "Stopped". + :keyword code: Tells whether the cluster is Running or Stopped. Known values are: "Running", + "Stopped". :paramtype code: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.Code """ super(PowerState, self).__init__(**kwargs) @@ -5830,7 +5824,7 @@ class PrivateEndpointConnection(msrest.serialization.Model): :vartype name: str :ivar type: The resource type. :vartype type: str - :ivar provisioning_state: The current provisioning state. Possible values include: "Succeeded", + :ivar provisioning_state: The current provisioning state. Known values are: "Succeeded", "Creating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.PrivateEndpointConnectionProvisioningState @@ -5862,8 +5856,8 @@ class PrivateEndpointConnection(msrest.serialization.Model): def __init__( self, *, - private_endpoint: Optional["PrivateEndpoint"] = None, - private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, + private_endpoint: Optional["_models.PrivateEndpoint"] = None, + private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionState"] = None, **kwargs ): """ @@ -5899,7 +5893,7 @@ class PrivateEndpointConnectionListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["PrivateEndpointConnection"]] = None, + value: Optional[List["_models.PrivateEndpointConnection"]] = None, **kwargs ): """ @@ -5990,7 +5984,7 @@ class PrivateLinkResourcesListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["PrivateLinkResource"]] = None, + value: Optional[List["_models.PrivateLinkResource"]] = None, **kwargs ): """ @@ -6005,7 +5999,7 @@ def __init__( class PrivateLinkServiceConnectionState(msrest.serialization.Model): """The state of a private link service connection. - :ivar status: The private link service connection status. Possible values include: "Pending", + :ivar status: The private link service connection status. Known values are: "Pending", "Approved", "Rejected", "Disconnected". :vartype status: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.ConnectionStatus @@ -6021,13 +6015,13 @@ class PrivateLinkServiceConnectionState(msrest.serialization.Model): def __init__( self, *, - status: Optional[Union[str, "ConnectionStatus"]] = None, + status: Optional[Union[str, "_models.ConnectionStatus"]] = None, description: Optional[str] = None, **kwargs ): """ - :keyword status: The private link service connection status. Possible values include: - "Pending", "Approved", "Rejected", "Disconnected". + :keyword status: The private link service connection status. Known values are: "Pending", + "Approved", "Rejected", "Disconnected". :paramtype status: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.ConnectionStatus :keyword description: The private link service connection description. @@ -6190,7 +6184,7 @@ class Snapshot(TrackedResource): :ivar creation_data: CreationData to be used to specify the source agent pool resource ID to create this snapshot. :vartype creation_data: ~azure.mgmt.containerservice.v2022_04_02_preview.models.CreationData - :ivar snapshot_type: The type of a snapshot. The default is NodePool. Possible values include: + :ivar snapshot_type: The type of a snapshot. The default is NodePool. Known values are: "NodePool", "ManagedCluster". Default value: "NodePool". :vartype snapshot_type: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.SnapshotType @@ -6198,12 +6192,12 @@ class Snapshot(TrackedResource): :vartype kubernetes_version: str :ivar node_image_version: The version of node image. :vartype node_image_version: str - :ivar os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.OSType :ivar os_sku: Specifies the OS SKU used by the agent pool. If not specified, the default is Ubuntu if OSType=Linux or Windows2019 if OSType=Windows. And the default Windows OSSKU will be - changed to Windows2022 after Windows2019 is deprecated. Possible values include: "Ubuntu", + changed to Windows2022 after Windows2019 is deprecated. Known values are: "Ubuntu", "CBLMariner", "Windows2019", "Windows2022". :vartype os_sku: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.OSSKU :ivar vm_size: The size of the VM. @@ -6248,8 +6242,8 @@ def __init__( *, location: str, tags: Optional[Dict[str, str]] = None, - creation_data: Optional["CreationData"] = None, - snapshot_type: Optional[Union[str, "SnapshotType"]] = "NodePool", + creation_data: Optional["_models.CreationData"] = None, + snapshot_type: Optional[Union[str, "_models.SnapshotType"]] = "NodePool", **kwargs ): """ @@ -6260,8 +6254,8 @@ def __init__( :keyword creation_data: CreationData to be used to specify the source agent pool resource ID to create this snapshot. :paramtype creation_data: ~azure.mgmt.containerservice.v2022_04_02_preview.models.CreationData - :keyword snapshot_type: The type of a snapshot. The default is NodePool. Possible values - include: "NodePool", "ManagedCluster". Default value: "NodePool". + :keyword snapshot_type: The type of a snapshot. The default is NodePool. Known values are: + "NodePool", "ManagedCluster". Default value: "NodePool". :paramtype snapshot_type: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.SnapshotType """ @@ -6299,7 +6293,7 @@ class SnapshotListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["Snapshot"]] = None, + value: Optional[List["_models.Snapshot"]] = None, **kwargs ): """ @@ -6530,7 +6524,7 @@ class SystemData(msrest.serialization.Model): :ivar created_by: The identity that created the resource. :vartype created_by: str - :ivar created_by_type: The type of identity that created the resource. Possible values include: + :ivar created_by_type: The type of identity that created the resource. Known values are: "User", "Application", "ManagedIdentity", "Key". :vartype created_by_type: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.CreatedByType @@ -6538,8 +6532,8 @@ class SystemData(msrest.serialization.Model): :vartype created_at: ~datetime.datetime :ivar last_modified_by: The identity that last modified the resource. :vartype last_modified_by: str - :ivar last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". + :ivar last_modified_by_type: The type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", "Key". :vartype last_modified_by_type: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.CreatedByType :ivar last_modified_at: The timestamp of resource last modification (UTC). @@ -6559,26 +6553,26 @@ def __init__( self, *, created_by: Optional[str] = None, - created_by_type: Optional[Union[str, "CreatedByType"]] = None, + created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, created_at: Optional[datetime.datetime] = None, last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[Union[str, "CreatedByType"]] = None, + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, last_modified_at: Optional[datetime.datetime] = None, **kwargs ): """ :keyword created_by: The identity that created the resource. :paramtype created_by: str - :keyword created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". + :keyword created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", "Key". :paramtype created_by_type: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.CreatedByType :keyword created_at: The timestamp of resource creation (UTC). :paramtype created_at: ~datetime.datetime :keyword last_modified_by: The identity that last modified the resource. :paramtype last_modified_by: str - :keyword last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". + :keyword last_modified_by_type: The type of identity that last modified the resource. Known + values are: "User", "Application", "ManagedIdentity", "Key". :paramtype last_modified_by_type: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.CreatedByType :keyword last_modified_at: The timestamp of resource last modification (UTC). @@ -6621,8 +6615,8 @@ def __init__( class TimeInWeek(msrest.serialization.Model): """Time in a week. - :ivar day: The day of the week. Possible values include: "Sunday", "Monday", "Tuesday", - "Wednesday", "Thursday", "Friday", "Saturday". + :ivar day: The day of the week. Known values are: "Sunday", "Monday", "Tuesday", "Wednesday", + "Thursday", "Friday", "Saturday". :vartype day: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.WeekDay :ivar hour_slots: Each integer hour represents a time range beginning at 0m after the hour ending at the next hour (non-inclusive). 0 corresponds to 00:00 UTC, 23 corresponds to 23:00 @@ -6638,12 +6632,12 @@ class TimeInWeek(msrest.serialization.Model): def __init__( self, *, - day: Optional[Union[str, "WeekDay"]] = None, + day: Optional[Union[str, "_models.WeekDay"]] = None, hour_slots: Optional[List[int]] = None, **kwargs ): """ - :keyword day: The day of the week. Possible values include: "Sunday", "Monday", "Tuesday", + :keyword day: The day of the week. Known values are: "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday". :paramtype day: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.WeekDay :keyword hour_slots: Each integer hour represents a time range beginning at 0m after the hour @@ -6746,8 +6740,8 @@ class TrustedAccessRoleBinding(Resource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.containerservice.v2022_04_02_preview.models.SystemData - :ivar provisioning_state: The current provisioning state of trusted access role binding. - Possible values include: "Succeeded", "Failed", "Updating", "Deleting". + :ivar provisioning_state: The current provisioning state of trusted access role binding. Known + values are: "Succeeded", "Failed", "Updating", "Deleting". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2022_04_02_preview.models.TrustedAccessRoleBindingProvisioningState :ivar source_resource_id: Required. The ARM resource ID of source resource that trusted access @@ -6823,7 +6817,7 @@ class TrustedAccessRoleBindingListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["TrustedAccessRoleBinding"]] = None, + value: Optional[List["_models.TrustedAccessRoleBinding"]] = None, **kwargs ): """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/models/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/models/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/__init__.py index 4a9011533682..fe53dc12e778 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/__init__.py @@ -18,6 +18,9 @@ from ._trusted_access_roles_operations import TrustedAccessRolesOperations from ._trusted_access_role_bindings_operations import TrustedAccessRoleBindingsOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'Operations', 'ManagedClustersOperations', @@ -31,3 +34,5 @@ 'TrustedAccessRolesOperations', 'TrustedAccessRoleBindingsOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_agent_pools_operations.py index 4183b2df75df..95fb7006fcbe 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_agent_pools_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -35,9 +35,12 @@ def build_list_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools") # pylint: disable=line-too-long path_format_arguments = { @@ -49,18 +52,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -72,9 +73,12 @@ def build_get_request( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -87,18 +91,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -109,14 +111,17 @@ def build_create_or_update_request_initial( resource_name: str, agent_pool_name: str, *, - json: JSONType = None, + json: Optional[_models.AgentPool] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -129,20 +134,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -158,9 +161,12 @@ def build_delete_request_initial( ignore_pod_disruption_budget: Optional[bool] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -173,20 +179,18 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if ignore_pod_disruption_budget is not None: - _query_parameters['ignore-pod-disruption-budget'] = _SERIALIZER.query("ignore_pod_disruption_budget", ignore_pod_disruption_budget, 'bool') + _params['ignore-pod-disruption-budget'] = _SERIALIZER.query("ignore_pod_disruption_budget", ignore_pod_disruption_budget, 'bool') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -198,9 +202,12 @@ def build_get_upgrade_profile_request( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default") # pylint: disable=line-too-long path_format_arguments = { @@ -213,18 +220,16 @@ def build_get_upgrade_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -235,9 +240,12 @@ def build_get_available_agent_pool_versions_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions") # pylint: disable=line-too-long path_format_arguments = { @@ -249,18 +257,16 @@ def build_get_available_agent_pool_versions_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -272,9 +278,12 @@ def build_upgrade_node_image_version_request_initial( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion") # pylint: disable=line-too-long path_format_arguments = { @@ -287,42 +296,38 @@ def build_upgrade_node_image_version_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class AgentPoolsOperations(object): - """AgentPoolsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class AgentPoolsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_04_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_04_02_preview.ContainerServiceClient`'s + :attr:`agent_pools` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -330,7 +335,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Iterable["_models.AgentPoolListResult"]: + ) -> Iterable[_models.AgentPoolListResult]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. @@ -345,13 +350,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_04_02_preview.models.AgentPoolListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -361,9 +369,11 @@ def prepare_request(next_link=None): resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -373,9 +383,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -415,7 +427,7 @@ def get( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPool": + ) -> _models.AgentPool: """Gets the specified managed cluster agent pool. Gets the specified managed cluster agent pool. @@ -431,13 +443,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.AgentPool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] request = build_get_request( @@ -447,11 +462,13 @@ def get( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -477,17 +494,20 @@ def _create_or_update_initial( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> "_models.AgentPool": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] + ) -> _models.AgentPool: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-04-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] _json = self._serialize.body(parameters, 'AgentPool') @@ -500,11 +520,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -535,9 +557,9 @@ def begin_create_or_update( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> LROPoller["_models.AgentPool"]: + ) -> LROPoller[_models.AgentPool]: """Creates or updates an agent pool in the specified managed cluster. Creates or updates an agent pool in the specified managed cluster. @@ -563,17 +585,20 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_04_02_preview.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, @@ -581,20 +606,27 @@ def begin_create_or_update( 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): - response = pipeline_response.http_response deserialized = self._deserialize('AgentPool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -615,13 +647,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements ignore_pod_disruption_budget: Optional[bool] = None, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -632,11 +667,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements api_version=api_version, ignore_pod_disruption_budget=ignore_pod_disruption_budget, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -687,22 +724,27 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, ignore_pod_disruption_budget=ignore_pod_disruption_budget, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -712,8 +754,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -733,7 +781,7 @@ def get_upgrade_profile( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPoolUpgradeProfile": + ) -> _models.AgentPoolUpgradeProfile: """Gets the upgrade profile for an agent pool. Gets the upgrade profile for an agent pool. @@ -749,13 +797,16 @@ def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.AgentPoolUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] request = build_get_upgrade_profile_request( @@ -765,11 +816,13 @@ def get_upgrade_profile( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -796,7 +849,7 @@ def get_available_agent_pool_versions( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.AgentPoolAvailableVersions": + ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported Kubernetes versions for the specified agent pool. See `supported Kubernetes versions @@ -812,13 +865,16 @@ def get_available_agent_pool_versions( :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.AgentPoolAvailableVersions :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolAvailableVersions"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] request = build_get_available_agent_pool_versions_request( @@ -827,11 +883,13 @@ def get_available_agent_pool_versions( resource_name=resource_name, api_version=api_version, template_url=self.get_available_agent_pool_versions.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -858,14 +916,17 @@ def _upgrade_node_image_version_initial( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> Optional["_models.AgentPool"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.AgentPool"]] + ) -> Optional[_models.AgentPool]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] request = build_upgrade_node_image_version_request_initial( @@ -875,11 +936,13 @@ def _upgrade_node_image_version_initial( agent_pool_name=agent_pool_name, api_version=api_version, template_url=self._upgrade_node_image_version_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -912,7 +975,7 @@ def begin_upgrade_node_image_version( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> LROPoller["_models.AgentPool"]: + ) -> LROPoller[_models.AgentPool]: """Upgrades the node image version of an agent pool to the latest. Upgrading the node image version of an agent pool applies the newest OS and runtime updates to @@ -938,21 +1001,26 @@ def begin_upgrade_node_image_version( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_04_02_preview.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._upgrade_node_image_version_initial( + raw_result = self._upgrade_node_image_version_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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) @@ -968,8 +1036,14 @@ def get_long_running_output(pipeline_response): return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_maintenance_configurations_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_maintenance_configurations_operations.py index 5a36719abd28..f2dfcd31912d 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_maintenance_configurations_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_maintenance_configurations_operations.py @@ -16,12 +16,12 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -33,9 +33,12 @@ def build_list_by_managed_cluster_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations") # pylint: disable=line-too-long path_format_arguments = { @@ -47,18 +50,16 @@ def build_list_by_managed_cluster_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -70,9 +71,12 @@ def build_get_request( config_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long path_format_arguments = { @@ -85,18 +89,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -107,14 +109,17 @@ def build_create_or_update_request( resource_name: str, config_name: str, *, - json: JSONType = None, + json: Optional[_models.MaintenanceConfiguration] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long path_format_arguments = { @@ -127,20 +132,18 @@ def build_create_or_update_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -154,9 +157,12 @@ def build_delete_request( config_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long path_format_arguments = { @@ -169,42 +175,38 @@ def build_delete_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class MaintenanceConfigurationsOperations(object): - """MaintenanceConfigurationsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class MaintenanceConfigurationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_04_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_04_02_preview.ContainerServiceClient`'s + :attr:`maintenance_configurations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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_by_managed_cluster( @@ -212,7 +214,7 @@ def list_by_managed_cluster( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Iterable["_models.MaintenanceConfigurationListResult"]: + ) -> Iterable[_models.MaintenanceConfigurationListResult]: """Gets a list of maintenance configurations in the specified managed cluster. Gets a list of maintenance configurations in the specified managed cluster. @@ -228,13 +230,16 @@ def list_by_managed_cluster( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_04_02_preview.models.MaintenanceConfigurationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfigurationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfigurationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -244,9 +249,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=self.list_by_managed_cluster.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -256,9 +263,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -298,7 +307,7 @@ def get( resource_name: str, config_name: str, **kwargs: Any - ) -> "_models.MaintenanceConfiguration": + ) -> _models.MaintenanceConfiguration: """Gets the specified maintenance configuration of a managed cluster. Gets the specified maintenance configuration of a managed cluster. @@ -314,13 +323,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.MaintenanceConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfiguration"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] request = build_get_request( @@ -330,11 +342,13 @@ def get( config_name=config_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -361,9 +375,9 @@ def create_or_update( resource_group_name: str, resource_name: str, config_name: str, - parameters: "_models.MaintenanceConfiguration", + parameters: _models.MaintenanceConfiguration, **kwargs: Any - ) -> "_models.MaintenanceConfiguration": + ) -> _models.MaintenanceConfiguration: """Creates or updates a maintenance configuration in the specified managed cluster. Creates or updates a maintenance configuration in the specified managed cluster. @@ -382,14 +396,17 @@ def create_or_update( :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.MaintenanceConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfiguration"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-04-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] _json = self._serialize.body(parameters, 'MaintenanceConfiguration') @@ -402,11 +419,13 @@ def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -450,13 +469,16 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -466,11 +488,13 @@ def delete( # pylint: disable=inconsistent-return-statements config_name=config_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_managed_cluster_snapshots_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_managed_cluster_snapshots_operations.py index 07b53c95b43b..9f8fe79c016c 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_managed_cluster_snapshots_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_managed_cluster_snapshots_operations.py @@ -16,12 +16,12 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -31,9 +31,12 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedclustersnapshots") # pylint: disable=line-too-long path_format_arguments = { @@ -43,18 +46,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -64,9 +65,12 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots") # pylint: disable=line-too-long path_format_arguments = { @@ -77,18 +81,16 @@ def build_list_by_resource_group_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -99,9 +101,12 @@ def build_get_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -113,18 +118,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -134,14 +137,17 @@ def build_create_or_update_request( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedClusterSnapshot] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -153,20 +159,18 @@ def build_create_or_update_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -178,14 +182,17 @@ def build_update_tags_request( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.TagsObject] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -197,20 +204,18 @@ def build_update_tags_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -223,9 +228,12 @@ def build_delete_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -237,48 +245,44 @@ def build_delete_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class ManagedClusterSnapshotsOperations(object): - """ManagedClusterSnapshotsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ManagedClusterSnapshotsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_04_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_04_02_preview.ContainerServiceClient`'s + :attr:`managed_cluster_snapshots` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> Iterable["_models.ManagedClusterSnapshotListResult"]: + ) -> Iterable[_models.ManagedClusterSnapshotListResult]: """Gets a list of managed cluster snapshots in the specified subscription. Gets a list of managed cluster snapshots in the specified subscription. @@ -290,13 +294,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedClusterSnapshotListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshotListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterSnapshotListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -304,9 +311,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -314,9 +323,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -354,7 +365,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.ManagedClusterSnapshotListResult"]: + ) -> Iterable[_models.ManagedClusterSnapshotListResult]: """Lists managed cluster snapshots in the specified subscription and resource group. Lists managed cluster snapshots in the specified subscription and resource group. @@ -368,13 +379,16 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedClusterSnapshotListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshotListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterSnapshotListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -383,9 +397,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -394,9 +410,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -435,7 +453,7 @@ def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedClusterSnapshot": + ) -> _models.ManagedClusterSnapshot: """Gets a managed cluster snapshot. Gets a managed cluster snapshot. @@ -449,13 +467,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedClusterSnapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterSnapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshot] request = build_get_request( @@ -464,11 +485,13 @@ def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -494,9 +517,9 @@ def create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterSnapshot", + parameters: _models.ManagedClusterSnapshot, **kwargs: Any - ) -> "_models.ManagedClusterSnapshot": + ) -> _models.ManagedClusterSnapshot: """Creates or updates a managed cluster snapshot. Creates or updates a managed cluster snapshot. @@ -513,14 +536,17 @@ def create_or_update( :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedClusterSnapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterSnapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-04-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshot] _json = self._serialize.body(parameters, 'ManagedClusterSnapshot') @@ -532,11 +558,13 @@ def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -566,9 +594,9 @@ def update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.ManagedClusterSnapshot": + ) -> _models.ManagedClusterSnapshot: """Updates tags on a managed cluster snapshot. Updates tags on a managed cluster snapshot. @@ -584,14 +612,17 @@ def update_tags( :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedClusterSnapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterSnapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshot] _json = self._serialize.body(parameters, 'TagsObject') @@ -603,11 +634,13 @@ def update_tags( content_type=content_type, json=_json, template_url=self.update_tags.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -648,13 +681,16 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -663,11 +699,13 @@ def delete( # pylint: disable=inconsistent-return-statements resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_managed_clusters_operations.py index ab5dc7873cb6..e8fc0359a047 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_managed_clusters_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -36,9 +36,12 @@ def build_get_os_options_request( resource_type: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default") # pylint: disable=line-too-long path_format_arguments = { @@ -49,20 +52,18 @@ def build_get_os_options_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if resource_type is not None: - _query_parameters['resource-type'] = _SERIALIZER.query("resource_type", resource_type, 'str') + _params['resource-type'] = _SERIALIZER.query("resource_type", resource_type, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -71,9 +72,12 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters") path_format_arguments = { @@ -83,18 +87,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -104,9 +106,12 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters") # pylint: disable=line-too-long path_format_arguments = { @@ -117,18 +122,16 @@ def build_list_by_resource_group_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -139,9 +142,12 @@ def build_get_upgrade_profile_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default") # pylint: disable=line-too-long path_format_arguments = { @@ -153,18 +159,16 @@ def build_get_upgrade_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -176,9 +180,12 @@ def build_get_access_profile_request( role_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -191,18 +198,16 @@ def build_get_access_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -215,9 +220,12 @@ def build_list_cluster_admin_credentials_request( server_fqdn: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -229,20 +237,18 @@ def build_list_cluster_admin_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if server_fqdn is not None: - _query_parameters['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -256,9 +262,12 @@ def build_list_cluster_user_credentials_request( format: Optional[Union[str, "_models.Format"]] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -270,22 +279,20 @@ def build_list_cluster_user_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if server_fqdn is not None: - _query_parameters['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') if format is not None: - _query_parameters['format'] = _SERIALIZER.query("format", format, 'str') + _params['format'] = _SERIALIZER.query("format", format, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -298,9 +305,12 @@ def build_list_cluster_monitoring_user_credentials_request( server_fqdn: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -312,20 +322,18 @@ def build_list_cluster_monitoring_user_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if server_fqdn is not None: - _query_parameters['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -336,9 +344,12 @@ def build_get_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -350,18 +361,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -371,14 +380,17 @@ def build_create_or_update_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedCluster] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -390,20 +402,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -415,14 +425,17 @@ def build_update_tags_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.TagsObject] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -434,20 +447,18 @@ def build_update_tags_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -462,9 +473,12 @@ def build_delete_request_initial( ignore_pod_disruption_budget: Optional[bool] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -476,20 +490,18 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if ignore_pod_disruption_budget is not None: - _query_parameters['ignore-pod-disruption-budget'] = _SERIALIZER.query("ignore_pod_disruption_budget", ignore_pod_disruption_budget, 'bool') + _params['ignore-pod-disruption-budget'] = _SERIALIZER.query("ignore_pod_disruption_budget", ignore_pod_disruption_budget, 'bool') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -499,14 +511,17 @@ def build_reset_service_principal_profile_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedClusterServicePrincipalProfile] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile") # pylint: disable=line-too-long path_format_arguments = { @@ -518,20 +533,18 @@ def build_reset_service_principal_profile_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -543,14 +556,17 @@ def build_reset_aad_profile_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedClusterAADProfile] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile") # pylint: disable=line-too-long path_format_arguments = { @@ -562,20 +578,18 @@ def build_reset_aad_profile_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -588,9 +602,12 @@ def build_rotate_cluster_certificates_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates") # pylint: disable=line-too-long path_format_arguments = { @@ -602,18 +619,16 @@ def build_rotate_cluster_certificates_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -624,9 +639,12 @@ def build_rotate_service_account_signing_keys_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateServiceAccountSigningKeys") # pylint: disable=line-too-long path_format_arguments = { @@ -638,18 +656,16 @@ def build_rotate_service_account_signing_keys_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -660,9 +676,12 @@ def build_stop_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop") # pylint: disable=line-too-long path_format_arguments = { @@ -674,18 +693,16 @@ def build_stop_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -696,9 +713,12 @@ def build_start_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start") # pylint: disable=line-too-long path_format_arguments = { @@ -710,18 +730,16 @@ def build_start_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -731,14 +749,17 @@ def build_run_command_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.RunCommandRequest] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand") # pylint: disable=line-too-long path_format_arguments = { @@ -750,20 +771,18 @@ def build_run_command_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -777,9 +796,12 @@ def build_get_command_result_request( command_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}") # pylint: disable=line-too-long path_format_arguments = { @@ -792,18 +814,16 @@ def build_get_command_result_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -814,9 +834,12 @@ def build_list_outbound_network_dependencies_endpoints_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints") # pylint: disable=line-too-long path_format_arguments = { @@ -828,42 +851,38 @@ def build_list_outbound_network_dependencies_endpoints_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class ManagedClustersOperations(object): # pylint: disable=too-many-public-methods - """ManagedClustersOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ManagedClustersOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_04_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_04_02_preview.ContainerServiceClient`'s + :attr:`managed_clusters` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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_os_options( @@ -871,7 +890,7 @@ def get_os_options( location: str, resource_type: Optional[str] = None, **kwargs: Any - ) -> "_models.OSOptionProfile": + ) -> _models.OSOptionProfile: """Gets supported OS options in the specified subscription. Gets supported OS options in the specified subscription. @@ -886,13 +905,16 @@ def get_os_options( :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.OSOptionProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OSOptionProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OSOptionProfile] request = build_get_os_options_request( @@ -901,11 +923,13 @@ def get_os_options( api_version=api_version, resource_type=resource_type, template_url=self.get_os_options.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -930,7 +954,7 @@ def get_os_options( def list( self, **kwargs: Any - ) -> Iterable["_models.ManagedClusterListResult"]: + ) -> Iterable[_models.ManagedClusterListResult]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. @@ -942,13 +966,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -956,9 +983,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -966,9 +995,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -1006,7 +1037,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.ManagedClusterListResult"]: + ) -> Iterable[_models.ManagedClusterListResult]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. @@ -1020,13 +1051,16 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -1035,9 +1069,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -1046,9 +1082,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -1087,7 +1125,7 @@ def get_upgrade_profile( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedClusterUpgradeProfile": + ) -> _models.ManagedClusterUpgradeProfile: """Gets the upgrade profile of a managed cluster. Gets the upgrade profile of a managed cluster. @@ -1101,13 +1139,16 @@ def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedClusterUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] request = build_get_upgrade_profile_request( @@ -1116,11 +1157,13 @@ def get_upgrade_profile( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1148,7 +1191,7 @@ def get_access_profile( resource_name: str, role_name: str, **kwargs: Any - ) -> "_models.ManagedClusterAccessProfile": + ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. **WARNING**\ : This API will be deprecated. Instead use `ListClusterUserCredentials @@ -1167,13 +1210,16 @@ def get_access_profile( :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedClusterAccessProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterAccessProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] request = build_get_access_profile_request( @@ -1183,11 +1229,13 @@ def get_access_profile( role_name=role_name, api_version=api_version, template_url=self.get_access_profile.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1215,7 +1263,7 @@ def list_cluster_admin_credentials( resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Lists the admin credentials of a managed cluster. Lists the admin credentials of a managed cluster. @@ -1231,13 +1279,16 @@ def list_cluster_admin_credentials( :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_admin_credentials_request( @@ -1247,11 +1298,13 @@ def list_cluster_admin_credentials( api_version=api_version, server_fqdn=server_fqdn, template_url=self.list_cluster_admin_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1280,7 +1333,7 @@ def list_cluster_user_credentials( server_fqdn: Optional[str] = None, format: Optional[Union[str, "_models.Format"]] = None, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Lists the user credentials of a managed cluster. Lists the user credentials of a managed cluster. @@ -1300,13 +1353,16 @@ def list_cluster_user_credentials( :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_user_credentials_request( @@ -1317,11 +1373,13 @@ def list_cluster_user_credentials( server_fqdn=server_fqdn, format=format, template_url=self.list_cluster_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1349,7 +1407,7 @@ def list_cluster_monitoring_user_credentials( resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Lists the cluster monitoring user credentials of a managed cluster. Lists the cluster monitoring user credentials of a managed cluster. @@ -1365,13 +1423,16 @@ def list_cluster_monitoring_user_credentials( :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_monitoring_user_credentials_request( @@ -1381,11 +1442,13 @@ def list_cluster_monitoring_user_credentials( api_version=api_version, server_fqdn=server_fqdn, template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1412,7 +1475,7 @@ def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedCluster": + ) -> _models.ManagedCluster: """Gets a managed cluster. Gets a managed cluster. @@ -1426,13 +1489,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedCluster :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] request = build_get_request( @@ -1441,11 +1507,13 @@ def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1470,17 +1538,20 @@ def _create_or_update_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'ManagedCluster') @@ -1492,11 +1563,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1526,9 +1599,9 @@ def begin_create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> LROPoller["_models.ManagedCluster"]: + ) -> LROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. Creates or updates a managed cluster. @@ -1553,37 +1626,47 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1600,17 +1683,20 @@ def _update_tags_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'TagsObject') @@ -1622,11 +1708,13 @@ def _update_tags_initial( content_type=content_type, json=_json, template_url=self._update_tags_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1652,9 +1740,9 @@ def begin_update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> LROPoller["_models.ManagedCluster"]: + ) -> LROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates tags on a managed cluster. @@ -1679,37 +1767,47 @@ def begin_update_tags( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_04_02_preview.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._update_tags_initial( + raw_result = self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1729,13 +1827,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements ignore_pod_disruption_budget: Optional[bool] = None, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -1745,11 +1846,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements api_version=api_version, ignore_pod_disruption_budget=ignore_pod_disruption_budget, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1797,21 +1900,26 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, ignore_pod_disruption_budget=ignore_pod_disruption_budget, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1821,8 +1929,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1839,17 +1953,20 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') @@ -1861,11 +1978,13 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re content_type=content_type, json=_json, template_url=self._reset_service_principal_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1887,7 +2006,7 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> LROPoller[None]: """Reset the Service Principal Profile of a managed cluster. @@ -1913,23 +2032,28 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._reset_service_principal_profile_initial( + raw_result = self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1939,8 +2063,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1957,17 +2087,20 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') @@ -1979,11 +2112,13 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement content_type=content_type, json=_json, template_url=self._reset_aad_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2005,7 +2140,7 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> LROPoller[None]: """Reset the AAD Profile of a managed cluster. @@ -2031,23 +2166,28 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._reset_aad_profile_initial( + raw_result = self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -2057,8 +2197,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2077,13 +2223,16 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_rotate_cluster_certificates_request_initial( @@ -2092,11 +2241,13 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return resource_name=resource_name, api_version=api_version, template_url=self._rotate_cluster_certificates_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2141,20 +2292,25 @@ def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-st :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._rotate_cluster_certificates_initial( + raw_result = self._rotate_cluster_certificates_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) @@ -2164,8 +2320,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2184,13 +2346,16 @@ def _rotate_service_account_signing_keys_initial( # pylint: disable=inconsisten resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_rotate_service_account_signing_keys_request_initial( @@ -2199,11 +2364,13 @@ def _rotate_service_account_signing_keys_initial( # pylint: disable=inconsisten resource_name=resource_name, api_version=api_version, template_url=self._rotate_service_account_signing_keys_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2247,20 +2414,25 @@ def begin_rotate_service_account_signing_keys( # pylint: disable=inconsistent-r :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._rotate_service_account_signing_keys_initial( + raw_result = self._rotate_service_account_signing_keys_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) @@ -2270,8 +2442,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2290,13 +2468,16 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_stop_request_initial( @@ -2305,11 +2486,13 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_name, api_version=api_version, template_url=self._stop_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2357,20 +2540,25 @@ def begin_stop( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._stop_initial( + raw_result = self._stop_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) @@ -2380,8 +2568,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2400,13 +2594,16 @@ def _start_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_start_request_initial( @@ -2415,11 +2612,13 @@ def _start_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_name, api_version=api_version, template_url=self._start_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2464,20 +2663,25 @@ def begin_start( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._start_initial( + raw_result = self._start_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) @@ -2487,8 +2691,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2505,17 +2715,20 @@ def _run_command_initial( self, resource_group_name: str, resource_name: str, - request_payload: "_models.RunCommandRequest", + request_payload: _models.RunCommandRequest, **kwargs: Any - ) -> Optional["_models.RunCommandResult"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RunCommandResult"]] + ) -> Optional[_models.RunCommandResult]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-04-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] _json = self._serialize.body(request_payload, 'RunCommandRequest') @@ -2527,11 +2740,13 @@ def _run_command_initial( content_type=content_type, json=_json, template_url=self._run_command_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2559,9 +2774,9 @@ def begin_run_command( self, resource_group_name: str, resource_name: str, - request_payload: "_models.RunCommandRequest", + request_payload: _models.RunCommandRequest, **kwargs: Any - ) -> LROPoller["_models.RunCommandResult"]: + ) -> LROPoller[_models.RunCommandResult]: """Submits a command to run against the Managed Cluster. AKS will create a pod to run the command. This is primarily useful for private clusters. For @@ -2589,37 +2804,47 @@ def begin_run_command( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_04_02_preview.models.RunCommandResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.RunCommandResult] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._run_command_initial( + raw_result = self._run_command_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, request_payload=request_payload, 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): - response = pipeline_response.http_response deserialized = self._deserialize('RunCommandResult', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2639,7 +2864,7 @@ def get_command_result( resource_name: str, command_id: str, **kwargs: Any - ) -> Optional["_models.RunCommandResult"]: + ) -> Optional[_models.RunCommandResult]: """Gets the results of a command which has been run on the Managed Cluster. Gets the results of a command which has been run on the Managed Cluster. @@ -2655,13 +2880,16 @@ def get_command_result( :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.RunCommandResult or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RunCommandResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] request = build_get_command_result_request( @@ -2671,11 +2899,13 @@ def get_command_result( command_id=command_id, api_version=api_version, template_url=self.get_command_result.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2704,7 +2934,7 @@ def list_outbound_network_dependencies_endpoints( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Iterable["_models.OutboundEnvironmentEndpointCollection"]: + ) -> Iterable[_models.OutboundEnvironmentEndpointCollection]: """Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. @@ -2722,13 +2952,16 @@ def list_outbound_network_dependencies_endpoints( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_04_02_preview.models.OutboundEnvironmentEndpointCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OutboundEnvironmentEndpointCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -2738,9 +2971,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=self.list_outbound_network_dependencies_endpoints.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -2750,9 +2985,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_operations.py index ae1847492832..51b3039b4de2 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_operations.py @@ -16,6 +16,7 @@ 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 @@ -29,55 +30,54 @@ def build_list_request( **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.ContainerService/operations") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class Operations(object): - """Operations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_04_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_04_02_preview.ContainerServiceClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> Iterable["_models.OperationListResult"]: + ) -> Iterable[_models.OperationListResult]: """Gets a list of operations. Gets a list of operations. @@ -88,31 +88,38 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_04_02_preview.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_private_endpoint_connections_operations.py index 12231c75e4e7..3eef39e2c0b5 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_private_endpoint_connections_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast from msrest import Serializer @@ -16,13 +16,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -34,9 +34,12 @@ def build_list_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections") # pylint: disable=line-too-long path_format_arguments = { @@ -48,18 +51,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -71,9 +72,12 @@ def build_get_request( private_endpoint_connection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -86,18 +90,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -108,14 +110,17 @@ def build_update_request( resource_name: str, private_endpoint_connection_name: str, *, - json: JSONType = None, + json: Optional[_models.PrivateEndpointConnection] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -128,20 +133,18 @@ def build_update_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -155,9 +158,12 @@ def build_delete_request_initial( private_endpoint_connection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -170,42 +176,38 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class PrivateEndpointConnectionsOperations(object): - """PrivateEndpointConnectionsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class PrivateEndpointConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_04_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_04_02_preview.ContainerServiceClient`'s + :attr:`private_endpoint_connections` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -213,7 +215,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnectionListResult": + ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. To learn more about private clusters, see: @@ -229,13 +231,16 @@ def list( ~azure.mgmt.containerservice.v2022_04_02_preview.models.PrivateEndpointConnectionListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] request = build_list_request( @@ -244,11 +249,13 @@ def list( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -276,7 +283,7 @@ def get( resource_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Gets the specified private endpoint connection. To learn more about private clusters, see: @@ -293,13 +300,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] request = build_get_request( @@ -309,11 +319,13 @@ def get( private_endpoint_connection_name=private_endpoint_connection_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -340,9 +352,9 @@ def update( resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - parameters: "_models.PrivateEndpointConnection", + parameters: _models.PrivateEndpointConnection, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. Updates a private endpoint connection. @@ -361,14 +373,17 @@ def update( :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] _json = self._serialize.body(parameters, 'PrivateEndpointConnection') @@ -381,11 +396,13 @@ def update( content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -413,13 +430,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -429,11 +449,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name=private_endpoint_connection_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -480,21 +502,26 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -504,8 +531,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_private_link_resources_operations.py index 921a20893467..574b6151ccff 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_private_link_resources_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_private_link_resources_operations.py @@ -15,6 +15,7 @@ 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 @@ -31,9 +32,12 @@ def build_list_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources") # pylint: disable=line-too-long path_format_arguments = { @@ -45,42 +49,38 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class PrivateLinkResourcesOperations(object): - """PrivateLinkResourcesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class PrivateLinkResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_04_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_04_02_preview.ContainerServiceClient`'s + :attr:`private_link_resources` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -88,7 +88,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.PrivateLinkResourcesListResult": + ) -> _models.PrivateLinkResourcesListResult: """Gets a list of private link resources in the specified managed cluster. To learn more about private clusters, see: @@ -103,13 +103,16 @@ def list( :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.PrivateLinkResourcesListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourcesListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] request = build_list_request( @@ -118,11 +121,13 @@ def list( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_resolve_private_link_service_id_operations.py index ceda32643301..5e4db19ac97b 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_resolve_private_link_service_id_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_resolve_private_link_service_id_operations.py @@ -15,12 +15,12 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -31,14 +31,17 @@ def build_post_request( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.PrivateLinkResource] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId") # pylint: disable=line-too-long path_format_arguments = { @@ -50,55 +53,51 @@ def build_post_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs ) -class ResolvePrivateLinkServiceIdOperations(object): - """ResolvePrivateLinkServiceIdOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ResolvePrivateLinkServiceIdOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_04_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_04_02_preview.ContainerServiceClient`'s + :attr:`resolve_private_link_service_id` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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 post( self, resource_group_name: str, resource_name: str, - parameters: "_models.PrivateLinkResource", + parameters: _models.PrivateLinkResource, **kwargs: Any - ) -> "_models.PrivateLinkResource": + ) -> _models.PrivateLinkResource: """Gets the private link service ID for the specified managed cluster. Gets the private link service ID for the specified managed cluster. @@ -114,14 +113,17 @@ def post( :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.PrivateLinkResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-04-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] _json = self._serialize.body(parameters, 'PrivateLinkResource') @@ -133,11 +135,13 @@ def post( content_type=content_type, json=_json, template_url=self.post.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_snapshots_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_snapshots_operations.py index 5b2ae3b1ada4..7a2ad6a46c77 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_snapshots_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_snapshots_operations.py @@ -16,12 +16,12 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -31,9 +31,12 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots") path_format_arguments = { @@ -43,18 +46,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -64,9 +65,12 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots") # pylint: disable=line-too-long path_format_arguments = { @@ -77,18 +81,16 @@ def build_list_by_resource_group_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -99,9 +101,12 @@ def build_get_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -113,18 +118,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -134,14 +137,17 @@ def build_create_or_update_request( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.Snapshot] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -153,20 +159,18 @@ def build_create_or_update_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -178,14 +182,17 @@ def build_update_tags_request( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.TagsObject] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -197,20 +204,18 @@ def build_update_tags_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -223,9 +228,12 @@ def build_delete_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -237,48 +245,44 @@ def build_delete_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class SnapshotsOperations(object): - """SnapshotsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class SnapshotsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_04_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_04_02_preview.ContainerServiceClient`'s + :attr:`snapshots` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> Iterable["_models.SnapshotListResult"]: + ) -> Iterable[_models.SnapshotListResult]: """Gets a list of snapshots in the specified subscription. Gets a list of snapshots in the specified subscription. @@ -289,13 +293,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_04_02_preview.models.SnapshotListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -303,9 +310,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -313,9 +322,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -353,7 +364,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.SnapshotListResult"]: + ) -> Iterable[_models.SnapshotListResult]: """Lists snapshots in the specified subscription and resource group. Lists snapshots in the specified subscription and resource group. @@ -366,13 +377,16 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_04_02_preview.models.SnapshotListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -381,9 +395,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -392,9 +408,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -433,7 +451,7 @@ def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.Snapshot": + ) -> _models.Snapshot: """Gets a snapshot. Gets a snapshot. @@ -447,13 +465,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.Snapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] request = build_get_request( @@ -462,11 +483,13 @@ def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -492,9 +515,9 @@ def create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.Snapshot", + parameters: _models.Snapshot, **kwargs: Any - ) -> "_models.Snapshot": + ) -> _models.Snapshot: """Creates or updates a snapshot. Creates or updates a snapshot. @@ -510,14 +533,17 @@ def create_or_update( :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.Snapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-04-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] _json = self._serialize.body(parameters, 'Snapshot') @@ -529,11 +555,13 @@ def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -563,9 +591,9 @@ def update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.Snapshot": + ) -> _models.Snapshot: """Updates tags on a snapshot. Updates tags on a snapshot. @@ -581,14 +609,17 @@ def update_tags( :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.Snapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] _json = self._serialize.body(parameters, 'TagsObject') @@ -600,11 +631,13 @@ def update_tags( content_type=content_type, json=_json, template_url=self.update_tags.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -645,13 +678,16 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -660,11 +696,13 @@ def delete( # pylint: disable=inconsistent-return-statements resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_trusted_access_role_bindings_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_trusted_access_role_bindings_operations.py index 62ffc2dbddc4..b80d4a1670d2 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_trusted_access_role_bindings_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_trusted_access_role_bindings_operations.py @@ -16,12 +16,12 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -33,9 +33,12 @@ def build_list_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings") # pylint: disable=line-too-long path_format_arguments = { @@ -47,18 +50,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -70,9 +71,12 @@ def build_get_request( trusted_access_role_binding_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}") # pylint: disable=line-too-long path_format_arguments = { @@ -85,18 +89,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -107,14 +109,17 @@ def build_create_or_update_request( resource_name: str, trusted_access_role_binding_name: str, *, - json: JSONType = None, + json: Optional[_models.TrustedAccessRoleBinding] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}") # pylint: disable=line-too-long path_format_arguments = { @@ -127,20 +132,18 @@ def build_create_or_update_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -154,9 +157,12 @@ def build_delete_request( trusted_access_role_binding_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}") # pylint: disable=line-too-long path_format_arguments = { @@ -169,42 +175,38 @@ def build_delete_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class TrustedAccessRoleBindingsOperations(object): - """TrustedAccessRoleBindingsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class TrustedAccessRoleBindingsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_04_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_04_02_preview.ContainerServiceClient`'s + :attr:`trusted_access_role_bindings` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -212,7 +214,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Iterable["_models.TrustedAccessRoleBindingListResult"]: + ) -> Iterable[_models.TrustedAccessRoleBindingListResult]: """List trusted access role bindings. List trusted access role bindings. @@ -228,13 +230,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_04_02_preview.models.TrustedAccessRoleBindingListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.TrustedAccessRoleBindingListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.TrustedAccessRoleBindingListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -244,9 +249,11 @@ def prepare_request(next_link=None): resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -256,9 +263,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -298,7 +307,7 @@ def get( resource_name: str, trusted_access_role_binding_name: str, **kwargs: Any - ) -> "_models.TrustedAccessRoleBinding": + ) -> _models.TrustedAccessRoleBinding: """Get a trusted access role binding. Get a trusted access role binding. @@ -314,13 +323,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.TrustedAccessRoleBinding :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.TrustedAccessRoleBinding"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.TrustedAccessRoleBinding] request = build_get_request( @@ -330,11 +342,13 @@ def get( trusted_access_role_binding_name=trusted_access_role_binding_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -361,9 +375,9 @@ def create_or_update( resource_group_name: str, resource_name: str, trusted_access_role_binding_name: str, - trusted_access_role_binding: "_models.TrustedAccessRoleBinding", + trusted_access_role_binding: _models.TrustedAccessRoleBinding, **kwargs: Any - ) -> "_models.TrustedAccessRoleBinding": + ) -> _models.TrustedAccessRoleBinding: """Create or update a trusted access role binding. Create or update a trusted access role binding. @@ -382,14 +396,17 @@ def create_or_update( :rtype: ~azure.mgmt.containerservice.v2022_04_02_preview.models.TrustedAccessRoleBinding :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.TrustedAccessRoleBinding"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-04-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.TrustedAccessRoleBinding] _json = self._serialize.body(trusted_access_role_binding, 'TrustedAccessRoleBinding') @@ -402,11 +419,13 @@ def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -450,13 +469,16 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -466,11 +488,13 @@ def delete( # pylint: disable=inconsistent-return-statements trusted_access_role_binding_name=trusted_access_role_binding_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_trusted_access_roles_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_trusted_access_roles_operations.py index a4813ed26fe8..72a85e2acf37 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_trusted_access_roles_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_04_02_preview/operations/_trusted_access_roles_operations.py @@ -16,6 +16,7 @@ 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 @@ -31,9 +32,12 @@ def build_list_request( location: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/trustedAccessRoles") # pylint: disable=line-too-long path_format_arguments = { @@ -44,49 +48,45 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class TrustedAccessRolesOperations(object): - """TrustedAccessRolesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class TrustedAccessRolesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_04_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_04_02_preview.ContainerServiceClient`'s + :attr:`trusted_access_roles` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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, location: str, **kwargs: Any - ) -> Iterable["_models.TrustedAccessRoleListResult"]: + ) -> Iterable[_models.TrustedAccessRoleListResult]: """List supported trusted access roles. List supported trusted access roles. @@ -100,13 +100,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_04_02_preview.models.TrustedAccessRoleListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-04-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-04-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.TrustedAccessRoleListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.TrustedAccessRoleListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -115,9 +118,11 @@ def prepare_request(next_link=None): location=location, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -126,9 +131,11 @@ def prepare_request(next_link=None): location=location, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/__init__.py index 53c675bd95e2..37a5f9e02e6f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._container_service_client import ContainerServiceClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['ContainerServiceClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/_container_service_client.py index 581f5960f434..6042fa347730 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/_container_service_client.py @@ -84,17 +84,39 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.managed_clusters = ManagedClustersOperations(self._client, self._config, self._serialize, self._deserialize) - self.maintenance_configurations = MaintenanceConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) - self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) - self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations(self._client, self._config, self._serialize, self._deserialize) - self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) - self.managed_cluster_snapshots = ManagedClusterSnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) - self.trusted_access_roles = TrustedAccessRolesOperations(self._client, self._config, self._serialize, self._deserialize) - self.trusted_access_role_bindings = TrustedAccessRoleBindingsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_clusters = ManagedClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.maintenance_configurations = MaintenanceConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.agent_pools = AgentPoolsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.snapshots = SnapshotsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_cluster_snapshots = ManagedClusterSnapshotsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.trusted_access_roles = TrustedAccessRolesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.trusted_access_role_bindings = TrustedAccessRoleBindingsOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/__init__.py index 53c675bd95e2..37a5f9e02e6f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._container_service_client import ContainerServiceClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['ContainerServiceClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/_container_service_client.py index 2ac002c4abef..d40a94fd59b4 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/_container_service_client.py @@ -84,17 +84,39 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.managed_clusters = ManagedClustersOperations(self._client, self._config, self._serialize, self._deserialize) - self.maintenance_configurations = MaintenanceConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) - self.agent_pools = AgentPoolsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) - self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations(self._client, self._config, self._serialize, self._deserialize) - self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) - self.managed_cluster_snapshots = ManagedClusterSnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) - self.trusted_access_roles = TrustedAccessRolesOperations(self._client, self._config, self._serialize, self._deserialize) - self.trusted_access_role_bindings = TrustedAccessRoleBindingsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_clusters = ManagedClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.maintenance_configurations = MaintenanceConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.agent_pools = AgentPoolsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.snapshots = SnapshotsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_cluster_snapshots = ManagedClusterSnapshotsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.trusted_access_roles = TrustedAccessRolesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.trusted_access_role_bindings = TrustedAccessRoleBindingsOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/__init__.py index 4a9011533682..fe53dc12e778 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/__init__.py @@ -18,6 +18,9 @@ from ._trusted_access_roles_operations import TrustedAccessRolesOperations from ._trusted_access_role_bindings_operations import TrustedAccessRoleBindingsOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'Operations', 'ManagedClustersOperations', @@ -31,3 +34,5 @@ 'TrustedAccessRolesOperations', 'TrustedAccessRoleBindingsOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_agent_pools_operations.py index 58eb5e0c8a3a..882395492aff 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_agent_pools_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. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ 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 @@ -26,26 +27,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class AgentPoolsOperations: - """AgentPoolsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_05_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_05_02_preview.aio.ContainerServiceClient`'s + :attr:`agent_pools` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -53,7 +52,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> AsyncIterable["_models.AgentPoolListResult"]: + ) -> AsyncIterable[_models.AgentPoolListResult]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. @@ -68,13 +67,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_05_02_preview.models.AgentPoolListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -84,9 +86,11 @@ def prepare_request(next_link=None): resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -96,9 +100,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -138,7 +144,7 @@ async def get( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPool": + ) -> _models.AgentPool: """Gets the specified managed cluster agent pool. Gets the specified managed cluster agent pool. @@ -154,13 +160,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.AgentPool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] request = build_get_request( @@ -170,11 +179,13 @@ async def get( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -200,17 +211,20 @@ async def _create_or_update_initial( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> "_models.AgentPool": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] + ) -> _models.AgentPool: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-05-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] _json = self._serialize.body(parameters, 'AgentPool') @@ -223,11 +237,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -258,9 +274,9 @@ async def begin_create_or_update( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> AsyncLROPoller["_models.AgentPool"]: + ) -> AsyncLROPoller[_models.AgentPool]: """Creates or updates an agent pool in the specified managed cluster. Creates or updates an agent pool in the specified managed cluster. @@ -287,17 +303,20 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_05_02_preview.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, @@ -305,20 +324,27 @@ async def begin_create_or_update( 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): - response = pipeline_response.http_response deserialized = self._deserialize('AgentPool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -339,13 +365,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements ignore_pod_disruption_budget: Optional[bool] = None, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -356,11 +385,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements api_version=api_version, ignore_pod_disruption_budget=ignore_pod_disruption_budget, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -411,22 +442,27 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, ignore_pod_disruption_budget=ignore_pod_disruption_budget, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -436,8 +472,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -457,7 +499,7 @@ async def get_upgrade_profile( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPoolUpgradeProfile": + ) -> _models.AgentPoolUpgradeProfile: """Gets the upgrade profile for an agent pool. Gets the upgrade profile for an agent pool. @@ -473,13 +515,16 @@ async def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.AgentPoolUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] request = build_get_upgrade_profile_request( @@ -489,11 +534,13 @@ async def get_upgrade_profile( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -520,7 +567,7 @@ async def get_available_agent_pool_versions( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.AgentPoolAvailableVersions": + ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported Kubernetes versions for the specified agent pool. See `supported Kubernetes versions @@ -536,13 +583,16 @@ async def get_available_agent_pool_versions( :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.AgentPoolAvailableVersions :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolAvailableVersions"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] request = build_get_available_agent_pool_versions_request( @@ -551,11 +601,13 @@ async def get_available_agent_pool_versions( resource_name=resource_name, api_version=api_version, template_url=self.get_available_agent_pool_versions.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -582,14 +634,17 @@ async def _upgrade_node_image_version_initial( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> Optional["_models.AgentPool"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.AgentPool"]] + ) -> Optional[_models.AgentPool]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] request = build_upgrade_node_image_version_request_initial( @@ -599,11 +654,13 @@ async def _upgrade_node_image_version_initial( agent_pool_name=agent_pool_name, api_version=api_version, template_url=self._upgrade_node_image_version_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -636,7 +693,7 @@ async def begin_upgrade_node_image_version( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> AsyncLROPoller["_models.AgentPool"]: + ) -> AsyncLROPoller[_models.AgentPool]: """Upgrades the node image version of an agent pool to the latest. Upgrading the node image version of an agent pool applies the newest OS and runtime updates to @@ -663,21 +720,26 @@ async def begin_upgrade_node_image_version( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_05_02_preview.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._upgrade_node_image_version_initial( + raw_result = await self._upgrade_node_image_version_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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) @@ -693,8 +755,14 @@ def get_long_running_output(pipeline_response): return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_maintenance_configurations_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_maintenance_configurations_operations.py index c01ab9b8ac5c..a3efb1a31733 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_maintenance_configurations_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_maintenance_configurations_operations.py @@ -15,6 +15,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -24,26 +25,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class MaintenanceConfigurationsOperations: - """MaintenanceConfigurationsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_05_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_05_02_preview.aio.ContainerServiceClient`'s + :attr:`maintenance_configurations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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_by_managed_cluster( @@ -51,7 +50,7 @@ def list_by_managed_cluster( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> AsyncIterable["_models.MaintenanceConfigurationListResult"]: + ) -> AsyncIterable[_models.MaintenanceConfigurationListResult]: """Gets a list of maintenance configurations in the specified managed cluster. Gets a list of maintenance configurations in the specified managed cluster. @@ -67,13 +66,16 @@ def list_by_managed_cluster( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_05_02_preview.models.MaintenanceConfigurationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfigurationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfigurationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -83,9 +85,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=self.list_by_managed_cluster.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -95,9 +99,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -137,7 +143,7 @@ async def get( resource_name: str, config_name: str, **kwargs: Any - ) -> "_models.MaintenanceConfiguration": + ) -> _models.MaintenanceConfiguration: """Gets the specified maintenance configuration of a managed cluster. Gets the specified maintenance configuration of a managed cluster. @@ -153,13 +159,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.MaintenanceConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfiguration"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] request = build_get_request( @@ -169,11 +178,13 @@ async def get( config_name=config_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -200,9 +211,9 @@ async def create_or_update( resource_group_name: str, resource_name: str, config_name: str, - parameters: "_models.MaintenanceConfiguration", + parameters: _models.MaintenanceConfiguration, **kwargs: Any - ) -> "_models.MaintenanceConfiguration": + ) -> _models.MaintenanceConfiguration: """Creates or updates a maintenance configuration in the specified managed cluster. Creates or updates a maintenance configuration in the specified managed cluster. @@ -221,14 +232,17 @@ async def create_or_update( :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.MaintenanceConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfiguration"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] _json = self._serialize.body(parameters, 'MaintenanceConfiguration') @@ -241,11 +255,13 @@ async def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -289,13 +305,16 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -305,11 +324,13 @@ async def delete( # pylint: disable=inconsistent-return-statements config_name=config_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_managed_cluster_snapshots_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_managed_cluster_snapshots_operations.py index a9908b926083..0bef20e9ed83 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_managed_cluster_snapshots_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_managed_cluster_snapshots_operations.py @@ -15,6 +15,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -24,32 +25,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ManagedClusterSnapshotsOperations: - """ManagedClusterSnapshotsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_05_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_05_02_preview.aio.ContainerServiceClient`'s + :attr:`managed_cluster_snapshots` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.ManagedClusterSnapshotListResult"]: + ) -> AsyncIterable[_models.ManagedClusterSnapshotListResult]: """Gets a list of managed cluster snapshots in the specified subscription. Gets a list of managed cluster snapshots in the specified subscription. @@ -61,13 +60,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterSnapshotListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshotListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterSnapshotListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -75,9 +77,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -85,9 +89,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -125,7 +131,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ManagedClusterSnapshotListResult"]: + ) -> AsyncIterable[_models.ManagedClusterSnapshotListResult]: """Lists managed cluster snapshots in the specified subscription and resource group. Lists managed cluster snapshots in the specified subscription and resource group. @@ -139,13 +145,16 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterSnapshotListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshotListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterSnapshotListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -154,9 +163,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -165,9 +176,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -206,7 +219,7 @@ async def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedClusterSnapshot": + ) -> _models.ManagedClusterSnapshot: """Gets a managed cluster snapshot. Gets a managed cluster snapshot. @@ -220,13 +233,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterSnapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterSnapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshot] request = build_get_request( @@ -235,11 +251,13 @@ async def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -265,9 +283,9 @@ async def create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterSnapshot", + parameters: _models.ManagedClusterSnapshot, **kwargs: Any - ) -> "_models.ManagedClusterSnapshot": + ) -> _models.ManagedClusterSnapshot: """Creates or updates a managed cluster snapshot. Creates or updates a managed cluster snapshot. @@ -284,14 +302,17 @@ async def create_or_update( :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterSnapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterSnapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshot] _json = self._serialize.body(parameters, 'ManagedClusterSnapshot') @@ -303,11 +324,13 @@ async def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -337,9 +360,9 @@ async def update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.ManagedClusterSnapshot": + ) -> _models.ManagedClusterSnapshot: """Updates tags on a managed cluster snapshot. Updates tags on a managed cluster snapshot. @@ -355,14 +378,17 @@ async def update_tags( :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterSnapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterSnapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-05-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshot] _json = self._serialize.body(parameters, 'TagsObject') @@ -374,11 +400,13 @@ async def update_tags( content_type=content_type, json=_json, template_url=self.update_tags.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -419,13 +447,16 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -434,11 +465,13 @@ async def delete( # pylint: disable=inconsistent-return-statements resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_managed_clusters_operations.py index bad1c828b60c..d0d9752bcfc5 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_managed_clusters_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. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ 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 @@ -26,26 +27,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ManagedClustersOperations: # pylint: disable=too-many-public-methods - """ManagedClustersOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_05_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_05_02_preview.aio.ContainerServiceClient`'s + :attr:`managed_clusters` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace_async async def get_os_options( @@ -53,7 +52,7 @@ async def get_os_options( location: str, resource_type: Optional[str] = None, **kwargs: Any - ) -> "_models.OSOptionProfile": + ) -> _models.OSOptionProfile: """Gets supported OS options in the specified subscription. Gets supported OS options in the specified subscription. @@ -68,13 +67,16 @@ async def get_os_options( :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.OSOptionProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OSOptionProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OSOptionProfile] request = build_get_os_options_request( @@ -83,11 +85,13 @@ async def get_os_options( api_version=api_version, resource_type=resource_type, template_url=self.get_os_options.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -112,7 +116,7 @@ async def get_os_options( def list( self, **kwargs: Any - ) -> AsyncIterable["_models.ManagedClusterListResult"]: + ) -> AsyncIterable[_models.ManagedClusterListResult]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. @@ -124,13 +128,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -138,9 +145,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -148,9 +157,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -188,7 +199,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ManagedClusterListResult"]: + ) -> AsyncIterable[_models.ManagedClusterListResult]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. @@ -202,13 +213,16 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -217,9 +231,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -228,9 +244,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -269,7 +287,7 @@ async def get_upgrade_profile( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedClusterUpgradeProfile": + ) -> _models.ManagedClusterUpgradeProfile: """Gets the upgrade profile of a managed cluster. Gets the upgrade profile of a managed cluster. @@ -283,13 +301,16 @@ async def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] request = build_get_upgrade_profile_request( @@ -298,11 +319,13 @@ async def get_upgrade_profile( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -330,7 +353,7 @@ async def get_access_profile( resource_name: str, role_name: str, **kwargs: Any - ) -> "_models.ManagedClusterAccessProfile": + ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. **WARNING**\ : This API will be deprecated. Instead use `ListClusterUserCredentials @@ -349,13 +372,16 @@ async def get_access_profile( :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterAccessProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterAccessProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] request = build_get_access_profile_request( @@ -365,11 +391,13 @@ async def get_access_profile( role_name=role_name, api_version=api_version, template_url=self.get_access_profile.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -397,7 +425,7 @@ async def list_cluster_admin_credentials( resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Lists the admin credentials of a managed cluster. Lists the admin credentials of a managed cluster. @@ -413,13 +441,16 @@ async def list_cluster_admin_credentials( :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_admin_credentials_request( @@ -429,11 +460,13 @@ async def list_cluster_admin_credentials( api_version=api_version, server_fqdn=server_fqdn, template_url=self.list_cluster_admin_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -462,7 +495,7 @@ async def list_cluster_user_credentials( server_fqdn: Optional[str] = None, format: Optional[Union[str, "_models.Format"]] = None, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Lists the user credentials of a managed cluster. Lists the user credentials of a managed cluster. @@ -482,13 +515,16 @@ async def list_cluster_user_credentials( :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_user_credentials_request( @@ -499,11 +535,13 @@ async def list_cluster_user_credentials( server_fqdn=server_fqdn, format=format, template_url=self.list_cluster_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -531,7 +569,7 @@ async def list_cluster_monitoring_user_credentials( resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Lists the cluster monitoring user credentials of a managed cluster. Lists the cluster monitoring user credentials of a managed cluster. @@ -547,13 +585,16 @@ async def list_cluster_monitoring_user_credentials( :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_monitoring_user_credentials_request( @@ -563,11 +604,13 @@ async def list_cluster_monitoring_user_credentials( api_version=api_version, server_fqdn=server_fqdn, template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -594,7 +637,7 @@ async def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedCluster": + ) -> _models.ManagedCluster: """Gets a managed cluster. Gets a managed cluster. @@ -608,13 +651,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedCluster :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] request = build_get_request( @@ -623,11 +669,13 @@ async def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -652,17 +700,20 @@ async def _create_or_update_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'ManagedCluster') @@ -674,11 +725,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -708,9 +761,9 @@ async def begin_create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> AsyncLROPoller["_models.ManagedCluster"]: + ) -> AsyncLROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. Creates or updates a managed cluster. @@ -735,37 +788,47 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -782,17 +845,20 @@ async def _update_tags_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'TagsObject') @@ -804,11 +870,13 @@ async def _update_tags_initial( content_type=content_type, json=_json, template_url=self._update_tags_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -834,9 +902,9 @@ async def begin_update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> AsyncLROPoller["_models.ManagedCluster"]: + ) -> AsyncLROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates tags on a managed cluster. @@ -861,37 +929,47 @@ async def begin_update_tags( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._update_tags_initial( + raw_result = await self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -911,13 +989,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements ignore_pod_disruption_budget: Optional[bool] = None, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -927,11 +1008,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements api_version=api_version, ignore_pod_disruption_budget=ignore_pod_disruption_budget, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -979,21 +1062,26 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, ignore_pod_disruption_budget=ignore_pod_disruption_budget, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1003,8 +1091,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1021,17 +1115,20 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-05-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') @@ -1043,11 +1140,13 @@ async def _reset_service_principal_profile_initial( # pylint: disable=inconsist content_type=content_type, json=_json, template_url=self._reset_service_principal_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1069,7 +1168,7 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> AsyncLROPoller[None]: """Reset the Service Principal Profile of a managed cluster. @@ -1095,23 +1194,28 @@ async def begin_reset_service_principal_profile( # pylint: disable=inconsistent :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._reset_service_principal_profile_initial( + raw_result = await self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1121,8 +1225,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1139,17 +1249,20 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-05-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') @@ -1161,11 +1274,13 @@ async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-sta content_type=content_type, json=_json, template_url=self._reset_aad_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1187,7 +1302,7 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> AsyncLROPoller[None]: """Reset the AAD Profile of a managed cluster. @@ -1213,23 +1328,28 @@ async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statem :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._reset_aad_profile_initial( + raw_result = await self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1239,8 +1359,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1259,13 +1385,16 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_rotate_cluster_certificates_request_initial( @@ -1274,11 +1403,13 @@ async def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent- resource_name=resource_name, api_version=api_version, template_url=self._rotate_cluster_certificates_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1323,20 +1454,25 @@ async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-ret :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._rotate_cluster_certificates_initial( + raw_result = await self._rotate_cluster_certificates_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) @@ -1346,8 +1482,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1366,13 +1508,16 @@ async def _rotate_service_account_signing_keys_initial( # pylint: disable=incon resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_rotate_service_account_signing_keys_request_initial( @@ -1381,11 +1526,13 @@ async def _rotate_service_account_signing_keys_initial( # pylint: disable=incon resource_name=resource_name, api_version=api_version, template_url=self._rotate_service_account_signing_keys_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1429,20 +1576,25 @@ async def begin_rotate_service_account_signing_keys( # pylint: disable=inconsis :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._rotate_service_account_signing_keys_initial( + raw_result = await self._rotate_service_account_signing_keys_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) @@ -1452,8 +1604,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1472,13 +1630,16 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_stop_request_initial( @@ -1487,11 +1648,13 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_name, api_version=api_version, template_url=self._stop_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1539,20 +1702,25 @@ async def begin_stop( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._stop_initial( + raw_result = await self._stop_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) @@ -1562,8 +1730,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1582,13 +1756,16 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_start_request_initial( @@ -1597,11 +1774,13 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_name, api_version=api_version, template_url=self._start_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1646,20 +1825,25 @@ async def begin_start( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._start_initial( + raw_result = await self._start_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) @@ -1669,8 +1853,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1687,17 +1877,20 @@ async def _run_command_initial( self, resource_group_name: str, resource_name: str, - request_payload: "_models.RunCommandRequest", + request_payload: _models.RunCommandRequest, **kwargs: Any - ) -> Optional["_models.RunCommandResult"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RunCommandResult"]] + ) -> Optional[_models.RunCommandResult]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] _json = self._serialize.body(request_payload, 'RunCommandRequest') @@ -1709,11 +1902,13 @@ async def _run_command_initial( content_type=content_type, json=_json, template_url=self._run_command_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1741,9 +1936,9 @@ async def begin_run_command( self, resource_group_name: str, resource_name: str, - request_payload: "_models.RunCommandRequest", + request_payload: _models.RunCommandRequest, **kwargs: Any - ) -> AsyncLROPoller["_models.RunCommandResult"]: + ) -> AsyncLROPoller[_models.RunCommandResult]: """Submits a command to run against the Managed Cluster. AKS will create a pod to run the command. This is primarily useful for private clusters. For @@ -1771,37 +1966,47 @@ async def begin_run_command( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_05_02_preview.models.RunCommandResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.RunCommandResult] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._run_command_initial( + raw_result = await self._run_command_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, request_payload=request_payload, 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): - response = pipeline_response.http_response deserialized = self._deserialize('RunCommandResult', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1821,7 +2026,7 @@ async def get_command_result( resource_name: str, command_id: str, **kwargs: Any - ) -> Optional["_models.RunCommandResult"]: + ) -> Optional[_models.RunCommandResult]: """Gets the results of a command which has been run on the Managed Cluster. Gets the results of a command which has been run on the Managed Cluster. @@ -1837,13 +2042,16 @@ async def get_command_result( :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.RunCommandResult or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RunCommandResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] request = build_get_command_result_request( @@ -1853,11 +2061,13 @@ async def get_command_result( command_id=command_id, api_version=api_version, template_url=self.get_command_result.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1886,7 +2096,7 @@ def list_outbound_network_dependencies_endpoints( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> AsyncIterable["_models.OutboundEnvironmentEndpointCollection"]: + ) -> AsyncIterable[_models.OutboundEnvironmentEndpointCollection]: """Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. @@ -1904,13 +2114,16 @@ def list_outbound_network_dependencies_endpoints( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_05_02_preview.models.OutboundEnvironmentEndpointCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OutboundEnvironmentEndpointCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -1920,9 +2133,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=self.list_outbound_network_dependencies_endpoints.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -1932,9 +2147,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_operations.py index 553d7a53341a..ccb4542cde92 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_operations.py @@ -14,6 +14,7 @@ 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 @@ -23,32 +24,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class Operations: - """Operations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_05_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_05_02_preview.aio.ContainerServiceClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.OperationListResult"]: + ) -> AsyncIterable[_models.OperationListResult]: """Gets a list of operations. Gets a list of operations. @@ -59,31 +58,38 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_05_02_preview.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_private_endpoint_connections_operations.py index a611ebdb3ea3..551cff70c37b 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_private_endpoint_connections_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -14,6 +14,7 @@ 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 @@ -24,26 +25,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class PrivateEndpointConnectionsOperations: - """PrivateEndpointConnectionsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_05_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_05_02_preview.aio.ContainerServiceClient`'s + :attr:`private_endpoint_connections` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -51,7 +50,7 @@ async def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnectionListResult": + ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. To learn more about private clusters, see: @@ -67,13 +66,16 @@ async def list( ~azure.mgmt.containerservice.v2022_05_02_preview.models.PrivateEndpointConnectionListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] request = build_list_request( @@ -82,11 +84,13 @@ async def list( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -114,7 +118,7 @@ async def get( resource_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Gets the specified private endpoint connection. To learn more about private clusters, see: @@ -131,13 +135,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] request = build_get_request( @@ -147,11 +154,13 @@ async def get( private_endpoint_connection_name=private_endpoint_connection_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -178,9 +187,9 @@ async def update( resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - parameters: "_models.PrivateEndpointConnection", + parameters: _models.PrivateEndpointConnection, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. Updates a private endpoint connection. @@ -199,14 +208,17 @@ async def update( :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-05-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] _json = self._serialize.body(parameters, 'PrivateEndpointConnection') @@ -219,11 +231,13 @@ async def update( content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -251,13 +265,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -267,11 +284,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name=private_endpoint_connection_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -318,21 +337,26 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -342,8 +366,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_private_link_resources_operations.py index 0f7454c29970..2e06d0dfd1d4 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_private_link_resources_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_private_link_resources_operations.py @@ -13,6 +13,7 @@ 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 @@ -22,26 +23,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class PrivateLinkResourcesOperations: - """PrivateLinkResourcesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_05_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_05_02_preview.aio.ContainerServiceClient`'s + :attr:`private_link_resources` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -49,7 +48,7 @@ async def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.PrivateLinkResourcesListResult": + ) -> _models.PrivateLinkResourcesListResult: """Gets a list of private link resources in the specified managed cluster. To learn more about private clusters, see: @@ -64,13 +63,16 @@ async def list( :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.PrivateLinkResourcesListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourcesListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] request = build_list_request( @@ -79,11 +81,13 @@ async def list( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_resolve_private_link_service_id_operations.py index a3e93408a5e6..1e3e8f323664 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_resolve_private_link_service_id_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_resolve_private_link_service_id_operations.py @@ -13,6 +13,7 @@ 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 @@ -22,35 +23,33 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ResolvePrivateLinkServiceIdOperations: - """ResolvePrivateLinkServiceIdOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_05_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_05_02_preview.aio.ContainerServiceClient`'s + :attr:`resolve_private_link_service_id` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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 post( self, resource_group_name: str, resource_name: str, - parameters: "_models.PrivateLinkResource", + parameters: _models.PrivateLinkResource, **kwargs: Any - ) -> "_models.PrivateLinkResource": + ) -> _models.PrivateLinkResource: """Gets the private link service ID for the specified managed cluster. Gets the private link service ID for the specified managed cluster. @@ -66,14 +65,17 @@ async def post( :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.PrivateLinkResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-05-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] _json = self._serialize.body(parameters, 'PrivateLinkResource') @@ -85,11 +87,13 @@ async def post( content_type=content_type, json=_json, template_url=self.post.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_snapshots_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_snapshots_operations.py index c438ef50f4ec..9d1d02cad74c 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_snapshots_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_snapshots_operations.py @@ -15,6 +15,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -24,32 +25,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class SnapshotsOperations: - """SnapshotsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_05_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_05_02_preview.aio.ContainerServiceClient`'s + :attr:`snapshots` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.SnapshotListResult"]: + ) -> AsyncIterable[_models.SnapshotListResult]: """Gets a list of snapshots in the specified subscription. Gets a list of snapshots in the specified subscription. @@ -60,13 +59,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_05_02_preview.models.SnapshotListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -74,9 +76,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -84,9 +88,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -124,7 +130,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.SnapshotListResult"]: + ) -> AsyncIterable[_models.SnapshotListResult]: """Lists snapshots in the specified subscription and resource group. Lists snapshots in the specified subscription and resource group. @@ -137,13 +143,16 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_05_02_preview.models.SnapshotListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -152,9 +161,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -163,9 +174,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -204,7 +217,7 @@ async def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.Snapshot": + ) -> _models.Snapshot: """Gets a snapshot. Gets a snapshot. @@ -218,13 +231,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.Snapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] request = build_get_request( @@ -233,11 +249,13 @@ async def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -263,9 +281,9 @@ async def create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.Snapshot", + parameters: _models.Snapshot, **kwargs: Any - ) -> "_models.Snapshot": + ) -> _models.Snapshot: """Creates or updates a snapshot. Creates or updates a snapshot. @@ -281,14 +299,17 @@ async def create_or_update( :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.Snapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] _json = self._serialize.body(parameters, 'Snapshot') @@ -300,11 +321,13 @@ async def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -334,9 +357,9 @@ async def update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.Snapshot": + ) -> _models.Snapshot: """Updates tags on a snapshot. Updates tags on a snapshot. @@ -352,14 +375,17 @@ async def update_tags( :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.Snapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-05-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] _json = self._serialize.body(parameters, 'TagsObject') @@ -371,11 +397,13 @@ async def update_tags( content_type=content_type, json=_json, template_url=self.update_tags.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -416,13 +444,16 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -431,11 +462,13 @@ async def delete( # pylint: disable=inconsistent-return-statements resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_trusted_access_role_bindings_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_trusted_access_role_bindings_operations.py index dc8aaaf8d0cc..6b5d6919ede1 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_trusted_access_role_bindings_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_trusted_access_role_bindings_operations.py @@ -15,6 +15,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -24,26 +25,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class TrustedAccessRoleBindingsOperations: - """TrustedAccessRoleBindingsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_05_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_05_02_preview.aio.ContainerServiceClient`'s + :attr:`trusted_access_role_bindings` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -51,7 +50,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> AsyncIterable["_models.TrustedAccessRoleBindingListResult"]: + ) -> AsyncIterable[_models.TrustedAccessRoleBindingListResult]: """List trusted access role bindings. List trusted access role bindings. @@ -67,13 +66,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_05_02_preview.models.TrustedAccessRoleBindingListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.TrustedAccessRoleBindingListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.TrustedAccessRoleBindingListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -83,9 +85,11 @@ def prepare_request(next_link=None): resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -95,9 +99,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -137,7 +143,7 @@ async def get( resource_name: str, trusted_access_role_binding_name: str, **kwargs: Any - ) -> "_models.TrustedAccessRoleBinding": + ) -> _models.TrustedAccessRoleBinding: """Get a trusted access role binding. Get a trusted access role binding. @@ -153,13 +159,16 @@ async def get( :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.TrustedAccessRoleBinding :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.TrustedAccessRoleBinding"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.TrustedAccessRoleBinding] request = build_get_request( @@ -169,11 +178,13 @@ async def get( trusted_access_role_binding_name=trusted_access_role_binding_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -200,9 +211,9 @@ async def create_or_update( resource_group_name: str, resource_name: str, trusted_access_role_binding_name: str, - trusted_access_role_binding: "_models.TrustedAccessRoleBinding", + trusted_access_role_binding: _models.TrustedAccessRoleBinding, **kwargs: Any - ) -> "_models.TrustedAccessRoleBinding": + ) -> _models.TrustedAccessRoleBinding: """Create or update a trusted access role binding. Create or update a trusted access role binding. @@ -221,14 +232,17 @@ async def create_or_update( :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.TrustedAccessRoleBinding :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.TrustedAccessRoleBinding"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.TrustedAccessRoleBinding] _json = self._serialize.body(trusted_access_role_binding, 'TrustedAccessRoleBinding') @@ -241,11 +255,13 @@ async def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -289,13 +305,16 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -305,11 +324,13 @@ async def delete( # pylint: disable=inconsistent-return-statements trusted_access_role_binding_name=trusted_access_role_binding_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_trusted_access_roles_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_trusted_access_roles_operations.py index 559b5abc91fd..0bf35970aa9e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_trusted_access_roles_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/aio/operations/_trusted_access_roles_operations.py @@ -14,6 +14,7 @@ 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 @@ -23,33 +24,31 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class TrustedAccessRolesOperations: - """TrustedAccessRolesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_05_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_05_02_preview.aio.ContainerServiceClient`'s + :attr:`trusted_access_roles` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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, location: str, **kwargs: Any - ) -> AsyncIterable["_models.TrustedAccessRoleListResult"]: + ) -> AsyncIterable[_models.TrustedAccessRoleListResult]: """List supported trusted access roles. List supported trusted access roles. @@ -63,13 +62,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_05_02_preview.models.TrustedAccessRoleListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.TrustedAccessRoleListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.TrustedAccessRoleListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -78,9 +80,11 @@ def prepare_request(next_link=None): location=location, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -89,9 +93,11 @@ def prepare_request(next_link=None): location=location, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/models/__init__.py index 2db8310cb9f4..a59d889f0f34 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/models/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/models/__init__.py @@ -158,7 +158,9 @@ WeekDay, WorkloadRuntime, ) - +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'AgentPool', 'AgentPoolAvailableVersions', @@ -309,3 +311,5 @@ 'WeekDay', 'WorkloadRuntime', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/models/_container_service_client_enums.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/models/_container_service_client_enums.py index 3e95e5b65409..e7281f8d63cf 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/models/_container_service_client_enums.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/models/_container_service_client_enums.py @@ -7,11 +7,10 @@ # -------------------------------------------------------------------------- from enum import Enum -from six import with_metaclass from azure.core import CaseInsensitiveEnumMeta -class AgentPoolMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class AgentPoolMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: https://docs.microsoft.com/azure/aks/use-system-pools @@ -24,7 +23,7 @@ class AgentPoolMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: User agent pools are primarily for hosting your application pods. USER = "User" -class AgentPoolType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class AgentPoolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of Agent Pool. """ @@ -33,7 +32,7 @@ class AgentPoolType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Use of this is strongly discouraged. AVAILABILITY_SET = "AvailabilitySet" -class Code(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class Code(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Tells whether the cluster is Running or Stopped """ @@ -42,7 +41,7 @@ class Code(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: The cluster is stopped. STOPPED = "Stopped" -class ConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The private link service connection status. """ @@ -51,7 +50,7 @@ class ConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): REJECTED = "Rejected" DISCONNECTED = "Disconnected" -class ContainerServiceStorageProfileTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Specifies what kind of storage to use. If omitted, the default will be chosen on your behalf based on the choice of orchestrator. """ @@ -59,7 +58,7 @@ class ContainerServiceStorageProfileTypes(with_metaclass(CaseInsensitiveEnumMeta STORAGE_ACCOUNT = "StorageAccount" MANAGED_DISKS = "ManagedDisks" -class ContainerServiceVMSizeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Size of agent VMs. Note: This is no longer maintained. """ @@ -238,7 +237,7 @@ class ContainerServiceVMSizeTypes(with_metaclass(CaseInsensitiveEnumMeta, str, E STANDARD_NV24 = "Standard_NV24" STANDARD_NV6 = "Standard_NV6" -class Count(with_metaclass(CaseInsensitiveEnumMeta, int, Enum)): +class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): """Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, and 5. The default value is 1. """ @@ -247,7 +246,7 @@ class Count(with_metaclass(CaseInsensitiveEnumMeta, int, Enum)): THREE = 3 FIVE = 5 -class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of identity that created the resource. """ @@ -256,7 +255,7 @@ class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class Expander(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class Expander(str, Enum, metaclass=CaseInsensitiveEnumMeta): """If not specified, the default is 'random'. See `expanders `_ for more information. @@ -279,13 +278,13 @@ class Expander(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Used when you don't have a particular need for the node groups to scale differently. RANDOM = "random" -class ExtendedLocationTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ExtendedLocationTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of extendedLocation. """ EDGE_ZONE = "EdgeZone" -class Format(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class Format(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Return azure auth-provider kubeconfig. This format is deprecated in 1.22 and will be fully #: removed in 1.25. @@ -293,7 +292,7 @@ class Format(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Return exec format kubeconfig. This format requires kubelogin binary in the path. EXEC_ENUM = "exec" -class GPUInstanceProfile(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class GPUInstanceProfile(str, Enum, metaclass=CaseInsensitiveEnumMeta): """GPUInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU. """ @@ -303,14 +302,14 @@ class GPUInstanceProfile(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MIG4_G = "MIG4g" MIG7_G = "MIG7g" -class IpFamily(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class IpFamily(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The IP version to use for cluster networking and IP assignment. """ I_PV4 = "IPv4" I_PV6 = "IPv6" -class KeyVaultNetworkAccessTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class KeyVaultNetworkAccessTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Network access of key vault. The possible values are ``Public`` and ``Private``. ``Public`` means the key vault allows public access from all networks. ``Private`` means the key vault disables public access and enables private link. The default value is ``Public``. @@ -319,7 +318,7 @@ class KeyVaultNetworkAccessTypes(with_metaclass(CaseInsensitiveEnumMeta, str, En PUBLIC = "Public" PRIVATE = "Private" -class KubeletDiskType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class KubeletDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. """ @@ -329,7 +328,7 @@ class KubeletDiskType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Kubelet will use the temporary disk for its data. TEMPORARY = "Temporary" -class LicenseType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class LicenseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The license type to use for Windows VMs. See `Azure Hybrid User Benefits `_ for more details. """ @@ -339,7 +338,7 @@ class LicenseType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Enables Azure Hybrid User Benefits for Windows VMs. WINDOWS_SERVER = "Windows_Server" -class LoadBalancerSku(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class LoadBalancerSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the differences between load balancer SKUs. @@ -352,7 +351,7 @@ class LoadBalancerSku(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Use a basic Load Balancer with limited functionality. BASIC = "basic" -class ManagedClusterPodIdentityProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ManagedClusterPodIdentityProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The current provisioning state of the pod identity. """ @@ -361,13 +360,13 @@ class ManagedClusterPodIdentityProvisioningState(with_metaclass(CaseInsensitiveE DELETING = "Deleting" FAILED = "Failed" -class ManagedClusterSKUName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ManagedClusterSKUName(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The name of a managed cluster SKU. """ BASIC = "Basic" -class ManagedClusterSKUTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ManagedClusterSKUTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): """If not specified, the default is 'Free'. See `uptime SLA `_ for more details. """ @@ -378,7 +377,7 @@ class ManagedClusterSKUTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: No guaranteed SLA, no additional charges. Free tier clusters have an SLO of 99.5%. FREE = "Free" -class NetworkMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """This cannot be specified if networkPlugin is anything other than 'azure'. """ @@ -389,7 +388,7 @@ class NetworkMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: This is no longer supported. BRIDGE = "bridge" -class NetworkPlugin(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkPlugin(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Network plugin used for building the Kubernetes network. """ @@ -405,7 +404,7 @@ class NetworkPlugin(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: networking functionality. NONE = "none" -class NetworkPluginMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkPluginMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The mode the network plugin should use. """ @@ -413,7 +412,7 @@ class NetworkPluginMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Kubenet reference plugins host-local and bridge. OVERLAY = "Overlay" -class NetworkPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Network policy used for building the Kubernetes network. """ @@ -426,7 +425,7 @@ class NetworkPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: for more information. AZURE = "azure" -class OSDiskType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OSDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS @@ -442,7 +441,7 @@ class OSDiskType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: provides lower read/write latency, along with faster node scaling and cluster upgrades. EPHEMERAL = "Ephemeral" -class OSSKU(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OSSKU(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Specifies the OS SKU used by the agent pool. If not specified, the default is Ubuntu if OSType=Linux or Windows2019 if OSType=Windows. And the default Windows OSSKU will be changed to Windows2022 after Windows2019 is deprecated. @@ -453,7 +452,7 @@ class OSSKU(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): WINDOWS2019 = "Windows2019" WINDOWS2022 = "Windows2022" -class OSType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The operating system type. The default is Linux. """ @@ -462,7 +461,7 @@ class OSType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Use Windows. WINDOWS = "Windows" -class OutboundType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class OutboundType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type `_. """ @@ -482,7 +481,7 @@ class OutboundType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: advanced scenario and requires proper network configuration. USER_ASSIGNED_NAT_GATEWAY = "userAssignedNATGateway" -class PrivateEndpointConnectionProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class PrivateEndpointConnectionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The current provisioning state. """ @@ -491,14 +490,14 @@ class PrivateEndpointConnectionProvisioningState(with_metaclass(CaseInsensitiveE DELETING = "Deleting" FAILED = "Failed" -class PublicNetworkAccess(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class PublicNetworkAccess(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Allow or deny public network access for AKS """ ENABLED = "Enabled" DISABLED = "Disabled" -class ResourceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """For more information see `use managed identities in AKS `_. """ @@ -514,7 +513,7 @@ class ResourceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Do not use a managed identity for the Managed Cluster, service principal will be used instead. NONE = "None" -class ScaleDownMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ScaleDownMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Describes how VMs are added to or removed from Agent Pools. See `billing states `_. """ @@ -525,7 +524,7 @@ class ScaleDownMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: during scale down. DEALLOCATE = "Deallocate" -class ScaleSetEvictionPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The eviction policy specifies what to do with the VM when it is evicted. The default is Delete. For more information about eviction see `spot VMs `_ @@ -538,7 +537,7 @@ class ScaleSetEvictionPolicy(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)) #: cause issues with cluster scaling or upgrading. DEALLOCATE = "Deallocate" -class ScaleSetPriority(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ScaleSetPriority(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The Virtual Machine Scale Set priority. """ @@ -548,7 +547,7 @@ class ScaleSetPriority(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Regular VMs will be used. REGULAR = "Regular" -class SnapshotType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SnapshotType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of a snapshot. The default is NodePool. """ @@ -557,7 +556,7 @@ class SnapshotType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: The snapshot is a snapshot of a managed cluster. MANAGED_CLUSTER = "ManagedCluster" -class TrustedAccessRoleBindingProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class TrustedAccessRoleBindingProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The current provisioning state of trusted access role binding. """ @@ -566,7 +565,7 @@ class TrustedAccessRoleBindingProvisioningState(with_metaclass(CaseInsensitiveEn UPDATING = "Updating" DELETING = "Deleting" -class UpgradeChannel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class UpgradeChannel(str, Enum, metaclass=CaseInsensitiveEnumMeta): """For more information see `setting the AKS cluster auto-upgrade channel `_. """ @@ -596,7 +595,7 @@ class UpgradeChannel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Disables auto-upgrades and keeps the cluster at its current version of Kubernetes. NONE = "none" -class WeekDay(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class WeekDay(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The weekday enum. """ @@ -608,7 +607,7 @@ class WeekDay(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): FRIDAY = "Friday" SATURDAY = "Saturday" -class WorkloadRuntime(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class WorkloadRuntime(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Determines the type of workload a node can run. """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/models/_models_py3.py index c35dcf5c4751..c0eec4bf7f68 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/models/_models_py3.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/models/_models_py3.py @@ -7,11 +7,13 @@ # -------------------------------------------------------------------------- import datetime -from typing import Dict, List, Optional, Union +from typing import Dict, List, Optional, TYPE_CHECKING, Union import msrest.serialization -from ._container_service_client_enums import * +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + import __init__ as _models class SubResource(msrest.serialization.Model): @@ -79,16 +81,16 @@ class AgentPool(SubResource): :ivar os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS - `_. Possible values - include: "Managed", "Ephemeral". + `_. Known values are: + "Managed", "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Possible values include: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.KubeletDiskType - :ivar workload_runtime: Determines the type of workload a node can run. Possible values - include: "OCIContainer", "WasmWasi". + :ivar workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer", "WasmWasi". :vartype workload_runtime: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.WorkloadRuntime :ivar message_of_the_day: A base64-encoded string which will be written to /etc/motd after @@ -107,12 +109,12 @@ class AgentPool(SubResource): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.OSType :ivar os_sku: Specifies the OS SKU used by the agent pool. If not specified, the default is Ubuntu if OSType=Linux or Windows2019 if OSType=Windows. And the default Windows OSSKU will be - changed to Windows2022 after Windows2019 is deprecated. Possible values include: "Ubuntu", + changed to Windows2022 after Windows2019 is deprecated. Known values are: "Ubuntu", "CBLMariner", "Windows2019", "Windows2022". :vartype os_sku: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. @@ -122,17 +124,16 @@ class AgentPool(SubResource): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it - defaults to Delete. Possible values include: "Delete", "Deallocate". + defaults to Delete. Known values are: "Delete", "Deallocate". :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.ScaleDownMode - :ivar type_properties_type: The type of Agent Pool. Possible values include: + :ivar type_properties_type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :vartype type_properties_type: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Possible values include: "System", - "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". :vartype mode: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.AgentPoolMode :ivar orchestrator_version: Both patch version and are supported. When is specified, the latest supported patch version is chosen @@ -178,12 +179,12 @@ class AgentPool(SubResource): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Possible values include: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Possible values include: "Delete", - "Deallocate". Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which @@ -215,7 +216,7 @@ class AgentPool(SubResource): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.GPUInstanceProfile :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool @@ -297,42 +298,42 @@ def __init__( count: Optional[int] = None, vm_size: Optional[str] = None, os_disk_size_gb: Optional[int] = None, - os_disk_type: Optional[Union[str, "OSDiskType"]] = None, - kubelet_disk_type: Optional[Union[str, "KubeletDiskType"]] = None, - workload_runtime: Optional[Union[str, "WorkloadRuntime"]] = None, + os_disk_type: Optional[Union[str, "_models.OSDiskType"]] = None, + kubelet_disk_type: Optional[Union[str, "_models.KubeletDiskType"]] = None, + workload_runtime: Optional[Union[str, "_models.WorkloadRuntime"]] = None, message_of_the_day: Optional[str] = None, vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", - os_sku: Optional[Union[str, "OSSKU"]] = None, + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - scale_down_mode: Optional[Union[str, "ScaleDownMode"]] = None, - type_properties_type: Optional[Union[str, "AgentPoolType"]] = None, - mode: Optional[Union[str, "AgentPoolMode"]] = None, + scale_down_mode: Optional[Union[str, "_models.ScaleDownMode"]] = None, + type_properties_type: Optional[Union[str, "_models.AgentPoolType"]] = None, + mode: Optional[Union[str, "_models.AgentPoolMode"]] = None, orchestrator_version: Optional[str] = None, - upgrade_settings: Optional["AgentPoolUpgradeSettings"] = None, - power_state: Optional["PowerState"] = None, + upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, + power_state: Optional["_models.PowerState"] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, enable_custom_ca_trust: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", spot_max_price: Optional[float] = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, proximity_placement_group_id: Optional[str] = None, - kubelet_config: Optional["KubeletConfig"] = None, - linux_os_config: Optional["LinuxOSConfig"] = None, + kubelet_config: Optional["_models.KubeletConfig"] = None, + linux_os_config: Optional["_models.LinuxOSConfig"] = None, enable_encryption_at_host: Optional[bool] = None, enable_ultra_ssd: Optional[bool] = None, enable_fips: Optional[bool] = None, - gpu_instance_profile: Optional[Union[str, "GPUInstanceProfile"]] = None, - creation_data: Optional["CreationData"] = None, + gpu_instance_profile: Optional[Union[str, "_models.GPUInstanceProfile"]] = None, + creation_data: Optional["_models.CreationData"] = None, capacity_reservation_group_id: Optional[str] = None, host_group_id: Optional[str] = None, **kwargs @@ -353,16 +354,16 @@ def __init__( :keyword os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS - `_. Possible values - include: "Managed", "Ephemeral". + `_. Known values are: + "Managed", "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Possible values include: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.KubeletDiskType - :keyword workload_runtime: Determines the type of workload a node can run. Possible values - include: "OCIContainer", "WasmWasi". + :keyword workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer", "WasmWasi". :paramtype workload_runtime: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.WorkloadRuntime :keyword message_of_the_day: A base64-encoded string which will be written to /etc/motd after @@ -381,12 +382,12 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.OSType :keyword os_sku: Specifies the OS SKU used by the agent pool. If not specified, the default is Ubuntu if OSType=Linux or Windows2019 if OSType=Windows. And the default Windows OSSKU will be - changed to Windows2022 after Windows2019 is deprecated. Possible values include: "Ubuntu", + changed to Windows2022 after Windows2019 is deprecated. Known values are: "Ubuntu", "CBLMariner", "Windows2019", "Windows2022". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. @@ -396,17 +397,16 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, - it defaults to Delete. Possible values include: "Delete", "Deallocate". + it defaults to Delete. Known values are: "Delete", "Deallocate". :paramtype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.ScaleDownMode - :keyword type_properties_type: The type of Agent Pool. Possible values include: + :keyword type_properties_type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type_properties_type: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Possible values include: "System", - "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.AgentPoolMode :keyword orchestrator_version: Both patch version and are supported. When is specified, the latest supported patch version is chosen @@ -444,12 +444,12 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Possible values include: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Possible values include: "Delete", - "Deallocate". Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which @@ -483,7 +483,7 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.GPUInstanceProfile @@ -578,7 +578,7 @@ class AgentPoolAvailableVersions(msrest.serialization.Model): def __init__( self, *, - agent_pool_versions: Optional[List["AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem"]] = None, + agent_pool_versions: Optional[List["_models.AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem"]] = None, **kwargs ): """ @@ -655,7 +655,7 @@ class AgentPoolListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["AgentPool"]] = None, + value: Optional[List["_models.AgentPool"]] = None, **kwargs ): """ @@ -682,8 +682,8 @@ class AgentPoolUpgradeProfile(msrest.serialization.Model): :vartype type: str :ivar kubernetes_version: Required. The Kubernetes version (major.minor.patch). :vartype kubernetes_version: str - :ivar os_type: Required. The operating system type. The default is Linux. Possible values - include: "Linux", "Windows". Default value: "Linux". + :ivar os_type: Required. The operating system type. The default is Linux. Known values are: + "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -714,16 +714,16 @@ def __init__( self, *, kubernetes_version: str, - os_type: Union[str, "OSType"] = "Linux", - upgrades: Optional[List["AgentPoolUpgradeProfilePropertiesUpgradesItem"]] = None, + os_type: Union[str, "_models.OSType"] = "Linux", + upgrades: Optional[List["_models.AgentPoolUpgradeProfilePropertiesUpgradesItem"]] = None, latest_node_image_version: Optional[str] = None, **kwargs ): """ :keyword kubernetes_version: Required. The Kubernetes version (major.minor.patch). :paramtype kubernetes_version: str - :keyword os_type: Required. The operating system type. The default is Linux. Possible values - include: "Linux", "Windows". Default value: "Linux". + :keyword os_type: Required. The operating system type. The default is Linux. Known values are: + "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: @@ -820,7 +820,7 @@ class AzureKeyVaultKms(msrest.serialization.Model): :ivar key_vault_network_access: Network access of key vault. The possible values are ``Public`` and ``Private``. ``Public`` means the key vault allows public access from all networks. ``Private`` means the key vault disables public access and enables private link. The default - value is ``Public``. Possible values include: "Public", "Private". Default value: "Public". + value is ``Public``. Known values are: "Public", "Private". Default value: "Public". :vartype key_vault_network_access: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.KeyVaultNetworkAccessTypes :ivar key_vault_resource_id: Resource ID of key vault. When keyVaultNetworkAccess is @@ -841,7 +841,7 @@ def __init__( *, enabled: Optional[bool] = None, key_id: Optional[str] = None, - key_vault_network_access: Optional[Union[str, "KeyVaultNetworkAccessTypes"]] = "Public", + key_vault_network_access: Optional[Union[str, "_models.KeyVaultNetworkAccessTypes"]] = "Public", key_vault_resource_id: Optional[str] = None, **kwargs ): @@ -858,8 +858,7 @@ def __init__( :keyword key_vault_network_access: Network access of key vault. The possible values are ``Public`` and ``Private``. ``Public`` means the key vault allows public access from all networks. ``Private`` means the key vault disables public access and enables private link. The - default value is ``Public``. Possible values include: "Public", "Private". Default value: - "Public". + default value is ``Public``. Known values are: "Public", "Private". Default value: "Public". :paramtype key_vault_network_access: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.KeyVaultNetworkAccessTypes :keyword key_vault_resource_id: Resource ID of key vault. When keyVaultNetworkAccess is @@ -903,7 +902,7 @@ def __init__( code: Optional[str] = None, message: Optional[str] = None, target: Optional[str] = None, - details: Optional[List["CloudErrorBody"]] = None, + details: Optional[List["_models.CloudErrorBody"]] = None, **kwargs ): """ @@ -948,7 +947,7 @@ class ContainerServiceDiagnosticsProfile(msrest.serialization.Model): def __init__( self, *, - vm_diagnostics: "ContainerServiceVMDiagnostics", + vm_diagnostics: "_models.ContainerServiceVMDiagnostics", **kwargs ): """ @@ -986,7 +985,7 @@ def __init__( self, *, admin_username: str, - ssh: "ContainerServiceSshConfiguration", + ssh: "_models.ContainerServiceSshConfiguration", **kwargs ): """ @@ -1009,17 +1008,17 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar count: Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, - and 5. The default value is 1. Possible values include: 1, 3, 5. Default value: "1". + and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". :vartype count: int or ~azure.mgmt.containerservice.v2022_05_02_preview.models.Count :ivar dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. :vartype dns_prefix: str - :ivar vm_size: Required. Size of agent VMs. Possible values include: "Standard_A1", - "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", - "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", - "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", - "Standard_A8m_v2", "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", - "Standard_B8ms", "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", - "Standard_D12", "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", + :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", + "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", + "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", + "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", "Standard_B8ms", + "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", "Standard_D12", + "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", "Standard_D13_v2_Promo", "Standard_D14", "Standard_D14_v2", "Standard_D14_v2_Promo", "Standard_D15_v2", "Standard_D16_v3", "Standard_D16s_v3", "Standard_D1_v2", "Standard_D2", "Standard_D2_v2", "Standard_D2_v2_Promo", "Standard_D2_v3", "Standard_D2s_v3", "Standard_D3", @@ -1064,7 +1063,7 @@ class ContainerServiceMasterProfile(msrest.serialization.Model): :vartype first_consecutive_static_ip: str :ivar storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Possible values include: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". :vartype storage_profile: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.ContainerServiceStorageProfileTypes :ivar fqdn: FQDN for the master pool. @@ -1093,27 +1092,27 @@ def __init__( self, *, dns_prefix: str, - vm_size: Union[str, "ContainerServiceVMSizeTypes"], - count: Optional[Union[int, "Count"]] = 1, + vm_size: Union[str, "_models.ContainerServiceVMSizeTypes"], + count: Optional[Union[int, "_models.Count"]] = 1, os_disk_size_gb: Optional[int] = None, vnet_subnet_id: Optional[str] = None, first_consecutive_static_ip: Optional[str] = "10.240.255.5", - storage_profile: Optional[Union[str, "ContainerServiceStorageProfileTypes"]] = None, + storage_profile: Optional[Union[str, "_models.ContainerServiceStorageProfileTypes"]] = None, **kwargs ): """ :keyword count: Number of masters (VMs) in the container service cluster. Allowed values are 1, - 3, and 5. The default value is 1. Possible values include: 1, 3, 5. Default value: "1". + 3, and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". :paramtype count: int or ~azure.mgmt.containerservice.v2022_05_02_preview.models.Count :keyword dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. :paramtype dns_prefix: str - :keyword vm_size: Required. Size of agent VMs. Possible values include: "Standard_A1", - "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", - "Standard_A2m_v2", "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", - "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", - "Standard_A8m_v2", "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", - "Standard_B8ms", "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", - "Standard_D12", "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", + :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", + "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", + "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", + "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", "Standard_B8ms", + "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", "Standard_D12", + "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", "Standard_D13_v2_Promo", "Standard_D14", "Standard_D14_v2", "Standard_D14_v2_Promo", "Standard_D15_v2", "Standard_D16_v3", "Standard_D16s_v3", "Standard_D1_v2", "Standard_D2", "Standard_D2_v2", "Standard_D2_v2_Promo", "Standard_D2_v3", "Standard_D2s_v3", "Standard_D3", @@ -1158,7 +1157,7 @@ def __init__( :paramtype first_consecutive_static_ip: str :keyword storage_profile: Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the - orchestrator choice. Possible values include: "StorageAccount", "ManagedDisks". + orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". :paramtype storage_profile: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.ContainerServiceStorageProfileTypes """ @@ -1176,20 +1175,20 @@ def __init__( class ContainerServiceNetworkProfile(msrest.serialization.Model): """Profile of network configuration. - :ivar network_plugin: Network plugin used for building the Kubernetes network. Possible values - include: "azure", "kubenet", "none". Default value: "kubenet". + :ivar network_plugin: Network plugin used for building the Kubernetes network. Known values + are: "azure", "kubenet", "none". Default value: "kubenet". :vartype network_plugin: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.NetworkPlugin - :ivar network_plugin_mode: Network plugin mode used for building the Kubernetes network. - Possible values include: "Overlay". + :ivar network_plugin_mode: Network plugin mode used for building the Kubernetes network. Known + values are: "Overlay". :vartype network_plugin_mode: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.NetworkPluginMode - :ivar network_policy: Network policy used for building the Kubernetes network. Possible values - include: "calico", "azure". + :ivar network_policy: Network policy used for building the Kubernetes network. Known values + are: "calico", "azure". :vartype network_policy: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.NetworkPolicy :ivar network_mode: This cannot be specified if networkPlugin is anything other than 'azure'. - Possible values include: "transparent", "bridge". + Known values are: "transparent", "bridge". :vartype network_mode: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.NetworkMode :ivar pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. @@ -1205,14 +1204,14 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): :vartype docker_bridge_cidr: str :ivar outbound_type: This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type - `_. Possible values include: - "loadBalancer", "userDefinedRouting", "managedNATGateway", "userAssignedNATGateway". Default - value: "loadBalancer". + `_. Known values are: "loadBalancer", + "userDefinedRouting", "managedNATGateway", "userAssignedNATGateway". Default value: + "loadBalancer". :vartype outbound_type: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.OutboundType :ivar load_balancer_sku: The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the - differences between load balancer SKUs. Possible values include: "standard", "basic". + differences between load balancer SKUs. Known values are: "standard", "basic". :vartype load_balancer_sku: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.LoadBalancerSku :ivar load_balancer_profile: Profile of the cluster load balancer. @@ -1263,38 +1262,38 @@ class ContainerServiceNetworkProfile(msrest.serialization.Model): def __init__( self, *, - network_plugin: Optional[Union[str, "NetworkPlugin"]] = "kubenet", - network_plugin_mode: Optional[Union[str, "NetworkPluginMode"]] = None, - network_policy: Optional[Union[str, "NetworkPolicy"]] = None, - network_mode: Optional[Union[str, "NetworkMode"]] = None, + network_plugin: Optional[Union[str, "_models.NetworkPlugin"]] = "kubenet", + network_plugin_mode: Optional[Union[str, "_models.NetworkPluginMode"]] = None, + network_policy: Optional[Union[str, "_models.NetworkPolicy"]] = None, + network_mode: Optional[Union[str, "_models.NetworkMode"]] = None, pod_cidr: Optional[str] = "10.244.0.0/16", service_cidr: Optional[str] = "10.0.0.0/16", dns_service_ip: Optional[str] = "10.0.0.10", docker_bridge_cidr: Optional[str] = "172.17.0.1/16", - outbound_type: Optional[Union[str, "OutboundType"]] = "loadBalancer", - load_balancer_sku: Optional[Union[str, "LoadBalancerSku"]] = None, - load_balancer_profile: Optional["ManagedClusterLoadBalancerProfile"] = None, - nat_gateway_profile: Optional["ManagedClusterNATGatewayProfile"] = None, + outbound_type: Optional[Union[str, "_models.OutboundType"]] = "loadBalancer", + load_balancer_sku: Optional[Union[str, "_models.LoadBalancerSku"]] = None, + load_balancer_profile: Optional["_models.ManagedClusterLoadBalancerProfile"] = None, + nat_gateway_profile: Optional["_models.ManagedClusterNATGatewayProfile"] = None, pod_cidrs: Optional[List[str]] = None, service_cidrs: Optional[List[str]] = None, - ip_families: Optional[List[Union[str, "IpFamily"]]] = None, + ip_families: Optional[List[Union[str, "_models.IpFamily"]]] = None, **kwargs ): """ - :keyword network_plugin: Network plugin used for building the Kubernetes network. Possible - values include: "azure", "kubenet", "none". Default value: "kubenet". + :keyword network_plugin: Network plugin used for building the Kubernetes network. Known values + are: "azure", "kubenet", "none". Default value: "kubenet". :paramtype network_plugin: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.NetworkPlugin :keyword network_plugin_mode: Network plugin mode used for building the Kubernetes network. - Possible values include: "Overlay". + Known values are: "Overlay". :paramtype network_plugin_mode: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.NetworkPluginMode - :keyword network_policy: Network policy used for building the Kubernetes network. Possible - values include: "calico", "azure". + :keyword network_policy: Network policy used for building the Kubernetes network. Known values + are: "calico", "azure". :paramtype network_policy: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.NetworkPolicy :keyword network_mode: This cannot be specified if networkPlugin is anything other than - 'azure'. Possible values include: "transparent", "bridge". + 'azure'. Known values are: "transparent", "bridge". :paramtype network_mode: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.NetworkMode :keyword pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. @@ -1310,14 +1309,14 @@ def __init__( :paramtype docker_bridge_cidr: str :keyword outbound_type: This can only be set at cluster creation time and cannot be changed later. For more information see `egress outbound type - `_. Possible values include: - "loadBalancer", "userDefinedRouting", "managedNATGateway", "userAssignedNATGateway". Default - value: "loadBalancer". + `_. Known values are: "loadBalancer", + "userDefinedRouting", "managedNATGateway", "userAssignedNATGateway". Default value: + "loadBalancer". :paramtype outbound_type: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.OutboundType :keyword load_balancer_sku: The default is 'standard'. See `Azure Load Balancer SKUs `_ for more information about the - differences between load balancer SKUs. Possible values include: "standard", "basic". + differences between load balancer SKUs. Known values are: "standard", "basic". :paramtype load_balancer_sku: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.LoadBalancerSku :keyword load_balancer_profile: Profile of the cluster load balancer. @@ -1379,7 +1378,7 @@ class ContainerServiceSshConfiguration(msrest.serialization.Model): def __init__( self, *, - public_keys: List["ContainerServiceSshPublicKey"], + public_keys: List["_models.ContainerServiceSshPublicKey"], **kwargs ): """ @@ -1569,7 +1568,7 @@ def __init__( self, *, domain_name: Optional[str] = None, - endpoint_details: Optional[List["EndpointDetail"]] = None, + endpoint_details: Optional[List["_models.EndpointDetail"]] = None, **kwargs ): """ @@ -1635,7 +1634,7 @@ class ExtendedLocation(msrest.serialization.Model): :ivar name: The name of the extended location. :vartype name: str - :ivar type: The type of the extended location. Possible values include: "EdgeZone". + :ivar type: The type of the extended location. Known values are: "EdgeZone". :vartype type: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.ExtendedLocationTypes """ @@ -1649,13 +1648,13 @@ def __init__( self, *, name: Optional[str] = None, - type: Optional[Union[str, "ExtendedLocationTypes"]] = None, + type: Optional[Union[str, "_models.ExtendedLocationTypes"]] = None, **kwargs ): """ :keyword name: The name of the extended location. :paramtype name: str - :keyword type: The type of the extended location. Possible values include: "EdgeZone". + :keyword type: The type of the extended location. Known values are: "EdgeZone". :paramtype type: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.ExtendedLocationTypes """ @@ -1815,7 +1814,7 @@ class LinuxOSConfig(msrest.serialization.Model): def __init__( self, *, - sysctls: Optional["SysctlConfig"] = None, + sysctls: Optional["_models.SysctlConfig"] = None, transparent_huge_page_enabled: Optional[str] = None, transparent_huge_page_defrag: Optional[str] = None, swap_file_size_mb: Optional[int] = None, @@ -1884,8 +1883,8 @@ class MaintenanceConfiguration(SubResource): def __init__( self, *, - time_in_week: Optional[List["TimeInWeek"]] = None, - not_allowed_time: Optional[List["TimeSpan"]] = None, + time_in_week: Optional[List["_models.TimeInWeek"]] = None, + not_allowed_time: Optional[List["_models.TimeSpan"]] = None, **kwargs ): """ @@ -1927,7 +1926,7 @@ class MaintenanceConfigurationListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["MaintenanceConfiguration"]] = None, + value: Optional[List["_models.MaintenanceConfiguration"]] = None, **kwargs ): """ @@ -2180,8 +2179,8 @@ class ManagedCluster(TrackedResource): :ivar ingress_profile: Ingress profile for the managed cluster. :vartype ingress_profile: ~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterIngressProfile - :ivar public_network_access: Allow or deny public network access for AKS. Possible values - include: "Enabled", "Disabled". + :ivar public_network_access: Allow or deny public network access for AKS. Known values are: + "Enabled", "Disabled". :vartype public_network_access: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.PublicNetworkAccess :ivar workload_auto_scaler_profile: Workload Auto-scaler profile for the container service @@ -2259,39 +2258,39 @@ def __init__( *, location: str, tags: Optional[Dict[str, str]] = None, - sku: Optional["ManagedClusterSKU"] = None, - extended_location: Optional["ExtendedLocation"] = None, - identity: Optional["ManagedClusterIdentity"] = None, - creation_data: Optional["CreationData"] = None, + sku: Optional["_models.ManagedClusterSKU"] = None, + extended_location: Optional["_models.ExtendedLocation"] = None, + identity: Optional["_models.ManagedClusterIdentity"] = None, + creation_data: Optional["_models.CreationData"] = None, kubernetes_version: Optional[str] = None, dns_prefix: Optional[str] = None, fqdn_subdomain: Optional[str] = None, - agent_pool_profiles: Optional[List["ManagedClusterAgentPoolProfile"]] = None, - linux_profile: Optional["ContainerServiceLinuxProfile"] = None, - windows_profile: Optional["ManagedClusterWindowsProfile"] = None, - service_principal_profile: Optional["ManagedClusterServicePrincipalProfile"] = None, - addon_profiles: Optional[Dict[str, "ManagedClusterAddonProfile"]] = None, - pod_identity_profile: Optional["ManagedClusterPodIdentityProfile"] = None, - oidc_issuer_profile: Optional["ManagedClusterOIDCIssuerProfile"] = None, + agent_pool_profiles: Optional[List["_models.ManagedClusterAgentPoolProfile"]] = None, + linux_profile: Optional["_models.ContainerServiceLinuxProfile"] = None, + windows_profile: Optional["_models.ManagedClusterWindowsProfile"] = None, + service_principal_profile: Optional["_models.ManagedClusterServicePrincipalProfile"] = None, + addon_profiles: Optional[Dict[str, "_models.ManagedClusterAddonProfile"]] = None, + pod_identity_profile: Optional["_models.ManagedClusterPodIdentityProfile"] = None, + oidc_issuer_profile: Optional["_models.ManagedClusterOIDCIssuerProfile"] = None, node_resource_group: Optional[str] = None, enable_rbac: Optional[bool] = None, enable_pod_security_policy: Optional[bool] = None, enable_namespace_resources: Optional[bool] = None, - network_profile: Optional["ContainerServiceNetworkProfile"] = None, - aad_profile: Optional["ManagedClusterAADProfile"] = None, - auto_upgrade_profile: Optional["ManagedClusterAutoUpgradeProfile"] = None, - auto_scaler_profile: Optional["ManagedClusterPropertiesAutoScalerProfile"] = None, - api_server_access_profile: Optional["ManagedClusterAPIServerAccessProfile"] = None, + network_profile: Optional["_models.ContainerServiceNetworkProfile"] = None, + aad_profile: Optional["_models.ManagedClusterAADProfile"] = None, + auto_upgrade_profile: Optional["_models.ManagedClusterAutoUpgradeProfile"] = None, + auto_scaler_profile: Optional["_models.ManagedClusterPropertiesAutoScalerProfile"] = None, + api_server_access_profile: Optional["_models.ManagedClusterAPIServerAccessProfile"] = None, disk_encryption_set_id: Optional[str] = None, - identity_profile: Optional[Dict[str, "UserAssignedIdentity"]] = None, - private_link_resources: Optional[List["PrivateLinkResource"]] = None, + identity_profile: Optional[Dict[str, "_models.UserAssignedIdentity"]] = None, + private_link_resources: Optional[List["_models.PrivateLinkResource"]] = None, disable_local_accounts: Optional[bool] = None, - http_proxy_config: Optional["ManagedClusterHTTPProxyConfig"] = None, - security_profile: Optional["ManagedClusterSecurityProfile"] = None, - storage_profile: Optional["ManagedClusterStorageProfile"] = None, - ingress_profile: Optional["ManagedClusterIngressProfile"] = None, - public_network_access: Optional[Union[str, "PublicNetworkAccess"]] = None, - workload_auto_scaler_profile: Optional["ManagedClusterWorkloadAutoScalerProfile"] = None, + http_proxy_config: Optional["_models.ManagedClusterHTTPProxyConfig"] = None, + security_profile: Optional["_models.ManagedClusterSecurityProfile"] = None, + storage_profile: Optional["_models.ManagedClusterStorageProfile"] = None, + ingress_profile: Optional["_models.ManagedClusterIngressProfile"] = None, + public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None, + workload_auto_scaler_profile: Optional["_models.ManagedClusterWorkloadAutoScalerProfile"] = None, **kwargs ): """ @@ -2398,8 +2397,8 @@ def __init__( :keyword ingress_profile: Ingress profile for the managed cluster. :paramtype ingress_profile: ~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterIngressProfile - :keyword public_network_access: Allow or deny public network access for AKS. Possible values - include: "Enabled", "Disabled". + :keyword public_network_access: Allow or deny public network access for AKS. Known values are: + "Enabled", "Disabled". :paramtype public_network_access: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.PublicNetworkAccess :keyword workload_auto_scaler_profile: Workload Auto-scaler profile for the container service @@ -2726,16 +2725,16 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS - `_. Possible values - include: "Managed", "Ephemeral". + `_. Known values are: + "Managed", "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Possible values include: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.KubeletDiskType - :ivar workload_runtime: Determines the type of workload a node can run. Possible values - include: "OCIContainer", "WasmWasi". + :ivar workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer", "WasmWasi". :vartype workload_runtime: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.WorkloadRuntime :ivar message_of_the_day: A base64-encoded string which will be written to /etc/motd after @@ -2754,12 +2753,12 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.OSType :ivar os_sku: Specifies the OS SKU used by the agent pool. If not specified, the default is Ubuntu if OSType=Linux or Windows2019 if OSType=Windows. And the default Windows OSSKU will be - changed to Windows2022 after Windows2019 is deprecated. Possible values include: "Ubuntu", + changed to Windows2022 after Windows2019 is deprecated. Known values are: "Ubuntu", "CBLMariner", "Windows2019", "Windows2022". :vartype os_sku: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. @@ -2769,16 +2768,15 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it - defaults to Delete. Possible values include: "Delete", "Deallocate". + defaults to Delete. Known values are: "Delete", "Deallocate". :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.ScaleDownMode - :ivar type: The type of Agent Pool. Possible values include: "VirtualMachineScaleSets", + :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Possible values include: "System", - "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". :vartype mode: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.AgentPoolMode :ivar orchestrator_version: Both patch version and are supported. When is specified, the latest supported patch version is chosen @@ -2824,12 +2822,12 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Possible values include: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Possible values include: "Delete", - "Deallocate". Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which @@ -2861,7 +2859,7 @@ class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.GPUInstanceProfile :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool @@ -2937,42 +2935,42 @@ def __init__( count: Optional[int] = None, vm_size: Optional[str] = None, os_disk_size_gb: Optional[int] = None, - os_disk_type: Optional[Union[str, "OSDiskType"]] = None, - kubelet_disk_type: Optional[Union[str, "KubeletDiskType"]] = None, - workload_runtime: Optional[Union[str, "WorkloadRuntime"]] = None, + os_disk_type: Optional[Union[str, "_models.OSDiskType"]] = None, + kubelet_disk_type: Optional[Union[str, "_models.KubeletDiskType"]] = None, + workload_runtime: Optional[Union[str, "_models.WorkloadRuntime"]] = None, message_of_the_day: Optional[str] = None, vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", - os_sku: Optional[Union[str, "OSSKU"]] = None, + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - scale_down_mode: Optional[Union[str, "ScaleDownMode"]] = None, - type: Optional[Union[str, "AgentPoolType"]] = None, - mode: Optional[Union[str, "AgentPoolMode"]] = None, + scale_down_mode: Optional[Union[str, "_models.ScaleDownMode"]] = None, + type: Optional[Union[str, "_models.AgentPoolType"]] = None, + mode: Optional[Union[str, "_models.AgentPoolMode"]] = None, orchestrator_version: Optional[str] = None, - upgrade_settings: Optional["AgentPoolUpgradeSettings"] = None, - power_state: Optional["PowerState"] = None, + upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, + power_state: Optional["_models.PowerState"] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, enable_custom_ca_trust: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", spot_max_price: Optional[float] = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, proximity_placement_group_id: Optional[str] = None, - kubelet_config: Optional["KubeletConfig"] = None, - linux_os_config: Optional["LinuxOSConfig"] = None, + kubelet_config: Optional["_models.KubeletConfig"] = None, + linux_os_config: Optional["_models.LinuxOSConfig"] = None, enable_encryption_at_host: Optional[bool] = None, enable_ultra_ssd: Optional[bool] = None, enable_fips: Optional[bool] = None, - gpu_instance_profile: Optional[Union[str, "GPUInstanceProfile"]] = None, - creation_data: Optional["CreationData"] = None, + gpu_instance_profile: Optional[Union[str, "_models.GPUInstanceProfile"]] = None, + creation_data: Optional["_models.CreationData"] = None, capacity_reservation_group_id: Optional[str] = None, host_group_id: Optional[str] = None, **kwargs @@ -2993,16 +2991,16 @@ def __init__( :keyword os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS - `_. Possible values - include: "Managed", "Ephemeral". + `_. Known values are: + "Managed", "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Possible values include: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.KubeletDiskType - :keyword workload_runtime: Determines the type of workload a node can run. Possible values - include: "OCIContainer", "WasmWasi". + :keyword workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer", "WasmWasi". :paramtype workload_runtime: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.WorkloadRuntime :keyword message_of_the_day: A base64-encoded string which will be written to /etc/motd after @@ -3021,12 +3019,12 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.OSType :keyword os_sku: Specifies the OS SKU used by the agent pool. If not specified, the default is Ubuntu if OSType=Linux or Windows2019 if OSType=Windows. And the default Windows OSSKU will be - changed to Windows2022 after Windows2019 is deprecated. Possible values include: "Ubuntu", + changed to Windows2022 after Windows2019 is deprecated. Known values are: "Ubuntu", "CBLMariner", "Windows2019", "Windows2022". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. @@ -3036,16 +3034,15 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, - it defaults to Delete. Possible values include: "Delete", "Deallocate". + it defaults to Delete. Known values are: "Delete", "Deallocate". :paramtype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.ScaleDownMode - :keyword type: The type of Agent Pool. Possible values include: "VirtualMachineScaleSets", + :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Possible values include: "System", - "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.AgentPoolMode :keyword orchestrator_version: Both patch version and are supported. When is specified, the latest supported patch version is chosen @@ -3083,12 +3080,12 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Possible values include: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Possible values include: "Delete", - "Deallocate". Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which @@ -3122,7 +3119,7 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.GPUInstanceProfile @@ -3207,16 +3204,16 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS - `_. Possible values - include: "Managed", "Ephemeral". + `_. Known values are: + "Managed", "Ephemeral". :vartype os_disk_type: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.OSDiskType :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data - root, and Kubelet ephemeral storage. Possible values include: "OS", "Temporary". + root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". :vartype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.KubeletDiskType - :ivar workload_runtime: Determines the type of workload a node can run. Possible values - include: "OCIContainer", "WasmWasi". + :ivar workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer", "WasmWasi". :vartype workload_runtime: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.WorkloadRuntime :ivar message_of_the_day: A base64-encoded string which will be written to /etc/motd after @@ -3235,12 +3232,12 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :vartype pod_subnet_id: str :ivar max_pods: The maximum number of pods that can run on a node. :vartype max_pods: int - :ivar os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.OSType :ivar os_sku: Specifies the OS SKU used by the agent pool. If not specified, the default is Ubuntu if OSType=Linux or Windows2019 if OSType=Windows. And the default Windows OSSKU will be - changed to Windows2022 after Windows2019 is deprecated. Possible values include: "Ubuntu", + changed to Windows2022 after Windows2019 is deprecated. Known values are: "Ubuntu", "CBLMariner", "Windows2019", "Windows2022". :vartype os_sku: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.OSSKU :ivar max_count: The maximum number of nodes for auto-scaling. @@ -3250,16 +3247,15 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): :ivar enable_auto_scaling: Whether to enable auto-scaler. :vartype enable_auto_scaling: bool :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it - defaults to Delete. Possible values include: "Delete", "Deallocate". + defaults to Delete. Known values are: "Delete", "Deallocate". :vartype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.ScaleDownMode - :ivar type: The type of Agent Pool. Possible values include: "VirtualMachineScaleSets", + :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :vartype type: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.AgentPoolType :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Possible values include: "System", - "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". :vartype mode: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.AgentPoolMode :ivar orchestrator_version: Both patch version and are supported. When is specified, the latest supported patch version is chosen @@ -3305,12 +3301,12 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :vartype node_public_ip_prefix_id: str :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default - is 'Regular'. Possible values include: "Spot", "Regular". Default value: "Regular". + is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". :vartype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.ScaleSetPriority :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Possible values include: "Delete", - "Deallocate". Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". :vartype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.ScaleSetEvictionPolicy :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which @@ -3342,7 +3338,7 @@ class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): for more details. :vartype enable_fips: bool :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile - for supported GPU VM SKU. Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :vartype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.GPUInstanceProfile :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool @@ -3423,42 +3419,42 @@ def __init__( count: Optional[int] = None, vm_size: Optional[str] = None, os_disk_size_gb: Optional[int] = None, - os_disk_type: Optional[Union[str, "OSDiskType"]] = None, - kubelet_disk_type: Optional[Union[str, "KubeletDiskType"]] = None, - workload_runtime: Optional[Union[str, "WorkloadRuntime"]] = None, + os_disk_type: Optional[Union[str, "_models.OSDiskType"]] = None, + kubelet_disk_type: Optional[Union[str, "_models.KubeletDiskType"]] = None, + workload_runtime: Optional[Union[str, "_models.WorkloadRuntime"]] = None, message_of_the_day: Optional[str] = None, vnet_subnet_id: Optional[str] = None, pod_subnet_id: Optional[str] = None, max_pods: Optional[int] = None, - os_type: Optional[Union[str, "OSType"]] = "Linux", - os_sku: Optional[Union[str, "OSSKU"]] = None, + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_sku: Optional[Union[str, "_models.OSSKU"]] = None, max_count: Optional[int] = None, min_count: Optional[int] = None, enable_auto_scaling: Optional[bool] = None, - scale_down_mode: Optional[Union[str, "ScaleDownMode"]] = None, - type: Optional[Union[str, "AgentPoolType"]] = None, - mode: Optional[Union[str, "AgentPoolMode"]] = None, + scale_down_mode: Optional[Union[str, "_models.ScaleDownMode"]] = None, + type: Optional[Union[str, "_models.AgentPoolType"]] = None, + mode: Optional[Union[str, "_models.AgentPoolMode"]] = None, orchestrator_version: Optional[str] = None, - upgrade_settings: Optional["AgentPoolUpgradeSettings"] = None, - power_state: Optional["PowerState"] = None, + upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, + power_state: Optional["_models.PowerState"] = None, availability_zones: Optional[List[str]] = None, enable_node_public_ip: Optional[bool] = None, enable_custom_ca_trust: Optional[bool] = None, node_public_ip_prefix_id: Optional[str] = None, - scale_set_priority: Optional[Union[str, "ScaleSetPriority"]] = "Regular", - scale_set_eviction_policy: Optional[Union[str, "ScaleSetEvictionPolicy"]] = "Delete", + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", spot_max_price: Optional[float] = -1, tags: Optional[Dict[str, str]] = None, node_labels: Optional[Dict[str, str]] = None, node_taints: Optional[List[str]] = None, proximity_placement_group_id: Optional[str] = None, - kubelet_config: Optional["KubeletConfig"] = None, - linux_os_config: Optional["LinuxOSConfig"] = None, + kubelet_config: Optional["_models.KubeletConfig"] = None, + linux_os_config: Optional["_models.LinuxOSConfig"] = None, enable_encryption_at_host: Optional[bool] = None, enable_ultra_ssd: Optional[bool] = None, enable_fips: Optional[bool] = None, - gpu_instance_profile: Optional[Union[str, "GPUInstanceProfile"]] = None, - creation_data: Optional["CreationData"] = None, + gpu_instance_profile: Optional[Union[str, "_models.GPUInstanceProfile"]] = None, + creation_data: Optional["_models.CreationData"] = None, capacity_reservation_group_id: Optional[str] = None, host_group_id: Optional[str] = None, **kwargs @@ -3479,16 +3475,16 @@ def __init__( :keyword os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more information see `Ephemeral OS - `_. Possible values - include: "Managed", "Ephemeral". + `_. Known values are: + "Managed", "Ephemeral". :paramtype os_disk_type: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.OSDiskType :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime - data root, and Kubelet ephemeral storage. Possible values include: "OS", "Temporary". + data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". :paramtype kubelet_disk_type: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.KubeletDiskType - :keyword workload_runtime: Determines the type of workload a node can run. Possible values - include: "OCIContainer", "WasmWasi". + :keyword workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer", "WasmWasi". :paramtype workload_runtime: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.WorkloadRuntime :keyword message_of_the_day: A base64-encoded string which will be written to /etc/motd after @@ -3507,12 +3503,12 @@ def __init__( :paramtype pod_subnet_id: str :keyword max_pods: The maximum number of pods that can run on a node. :paramtype max_pods: int - :keyword os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.OSType :keyword os_sku: Specifies the OS SKU used by the agent pool. If not specified, the default is Ubuntu if OSType=Linux or Windows2019 if OSType=Windows. And the default Windows OSSKU will be - changed to Windows2022 after Windows2019 is deprecated. Possible values include: "Ubuntu", + changed to Windows2022 after Windows2019 is deprecated. Known values are: "Ubuntu", "CBLMariner", "Windows2019", "Windows2022". :paramtype os_sku: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.OSSKU :keyword max_count: The maximum number of nodes for auto-scaling. @@ -3522,16 +3518,15 @@ def __init__( :keyword enable_auto_scaling: Whether to enable auto-scaler. :paramtype enable_auto_scaling: bool :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, - it defaults to Delete. Possible values include: "Delete", "Deallocate". + it defaults to Delete. Known values are: "Delete", "Deallocate". :paramtype scale_down_mode: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.ScaleDownMode - :keyword type: The type of Agent Pool. Possible values include: "VirtualMachineScaleSets", + :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", "AvailabilitySet". :paramtype type: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.AgentPoolType :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, see: - https://docs.microsoft.com/azure/aks/use-system-pools. Possible values include: "System", - "User". + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". :paramtype mode: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.AgentPoolMode :keyword orchestrator_version: Both patch version and are supported. When is specified, the latest supported patch version is chosen @@ -3569,12 +3564,12 @@ def __init__( /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. :paramtype node_public_ip_prefix_id: str :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the - default is 'Regular'. Possible values include: "Spot", "Regular". Default value: "Regular". + default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". :paramtype scale_set_priority: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.ScaleSetPriority :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is - 'Spot'. If not specified, the default is 'Delete'. Possible values include: "Delete", - "Deallocate". Default value: "Delete". + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". :paramtype scale_set_eviction_policy: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.ScaleSetEvictionPolicy :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which @@ -3608,7 +3603,7 @@ def __init__( for more details. :paramtype enable_fips: bool :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance - profile for supported GPU VM SKU. Possible values include: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". :paramtype gpu_instance_profile: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.GPUInstanceProfile @@ -3719,8 +3714,8 @@ class ManagedClusterAutoUpgradeProfile(msrest.serialization.Model): """Auto upgrade profile for a managed cluster. :ivar upgrade_channel: For more information see `setting the AKS cluster auto-upgrade channel - `_. Possible - values include: "rapid", "stable", "patch", "node-image", "none". + `_. Known values + are: "rapid", "stable", "patch", "node-image", "none". :vartype upgrade_channel: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.UpgradeChannel """ @@ -3732,13 +3727,13 @@ class ManagedClusterAutoUpgradeProfile(msrest.serialization.Model): def __init__( self, *, - upgrade_channel: Optional[Union[str, "UpgradeChannel"]] = None, + upgrade_channel: Optional[Union[str, "_models.UpgradeChannel"]] = None, **kwargs ): """ :keyword upgrade_channel: For more information see `setting the AKS cluster auto-upgrade channel `_. - Possible values include: "rapid", "stable", "patch", "node-image", "none". + Known values are: "rapid", "stable", "patch", "node-image", "none". :paramtype upgrade_channel: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.UpgradeChannel """ @@ -3815,7 +3810,7 @@ class ManagedClusterIdentity(msrest.serialization.Model): components. :vartype tenant_id: str :ivar type: For more information see `use managed identities in AKS - `_. Possible values include: + `_. Known values are: "SystemAssigned", "UserAssigned", "None". :vartype type: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.ResourceIdentityType @@ -3840,13 +3835,13 @@ class ManagedClusterIdentity(msrest.serialization.Model): def __init__( self, *, - type: Optional[Union[str, "ResourceIdentityType"]] = None, - user_assigned_identities: Optional[Dict[str, "ManagedServiceIdentityUserAssignedIdentitiesValue"]] = None, + type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, + user_assigned_identities: Optional[Dict[str, "_models.ManagedServiceIdentityUserAssignedIdentitiesValue"]] = None, **kwargs ): """ :keyword type: For more information see `use managed identities in AKS - `_. Possible values include: + `_. Known values are: "SystemAssigned", "UserAssigned", "None". :paramtype type: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.ResourceIdentityType @@ -3877,7 +3872,7 @@ class ManagedClusterIngressProfile(msrest.serialization.Model): def __init__( self, *, - web_app_routing: Optional["ManagedClusterIngressProfileWebAppRouting"] = None, + web_app_routing: Optional["_models.ManagedClusterIngressProfileWebAppRouting"] = None, **kwargs ): """ @@ -3946,7 +3941,7 @@ class ManagedClusterListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["ManagedCluster"]] = None, + value: Optional[List["_models.ManagedCluster"]] = None, **kwargs ): """ @@ -4004,10 +3999,10 @@ class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): def __init__( self, *, - managed_outbound_i_ps: Optional["ManagedClusterLoadBalancerProfileManagedOutboundIPs"] = None, - outbound_ip_prefixes: Optional["ManagedClusterLoadBalancerProfileOutboundIPPrefixes"] = None, - outbound_i_ps: Optional["ManagedClusterLoadBalancerProfileOutboundIPs"] = None, - effective_outbound_i_ps: Optional[List["ResourceReference"]] = None, + managed_outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileManagedOutboundIPs"] = None, + outbound_ip_prefixes: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPPrefixes"] = None, + outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPs"] = None, + effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, allocated_outbound_ports: Optional[int] = 0, idle_timeout_in_minutes: Optional[int] = 30, enable_multiple_standard_load_balancers: Optional[bool] = None, @@ -4109,7 +4104,7 @@ class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.M def __init__( self, *, - public_ip_prefixes: Optional[List["ResourceReference"]] = None, + public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, **kwargs ): """ @@ -4136,7 +4131,7 @@ class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): def __init__( self, *, - public_i_ps: Optional[List["ResourceReference"]] = None, + public_i_ps: Optional[List["_models.ResourceReference"]] = None, **kwargs ): """ @@ -4207,8 +4202,8 @@ class ManagedClusterNATGatewayProfile(msrest.serialization.Model): def __init__( self, *, - managed_outbound_ip_profile: Optional["ManagedClusterManagedOutboundIPProfile"] = None, - effective_outbound_i_ps: Optional[List["ResourceReference"]] = None, + managed_outbound_ip_profile: Optional["_models.ManagedClusterManagedOutboundIPProfile"] = None, + effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, idle_timeout_in_minutes: Optional[int] = 4, **kwargs ): @@ -4281,8 +4276,8 @@ class ManagedClusterPodIdentity(msrest.serialization.Model): :vartype binding_selector: str :ivar identity: Required. The user assigned identity details. :vartype identity: ~azure.mgmt.containerservice.v2022_05_02_preview.models.UserAssignedIdentity - :ivar provisioning_state: The current provisioning state of the pod identity. Possible values - include: "Assigned", "Updating", "Deleting", "Failed". + :ivar provisioning_state: The current provisioning state of the pod identity. Known values are: + "Assigned", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterPodIdentityProvisioningState :ivar provisioning_info: @@ -4312,7 +4307,7 @@ def __init__( *, name: str, namespace: str, - identity: "UserAssignedIdentity", + identity: "_models.UserAssignedIdentity", binding_selector: Optional[str] = None, **kwargs ): @@ -4414,8 +4409,8 @@ def __init__( *, enabled: Optional[bool] = None, allow_network_plugin_kubenet: Optional[bool] = None, - user_assigned_identities: Optional[List["ManagedClusterPodIdentity"]] = None, - user_assigned_identity_exceptions: Optional[List["ManagedClusterPodIdentityException"]] = None, + user_assigned_identities: Optional[List["_models.ManagedClusterPodIdentity"]] = None, + user_assigned_identity_exceptions: Optional[List["_models.ManagedClusterPodIdentityException"]] = None, **kwargs ): """ @@ -4456,7 +4451,7 @@ class ManagedClusterPodIdentityProvisioningError(msrest.serialization.Model): def __init__( self, *, - error: Optional["ManagedClusterPodIdentityProvisioningErrorBody"] = None, + error: Optional["_models.ManagedClusterPodIdentityProvisioningErrorBody"] = None, **kwargs ): """ @@ -4498,7 +4493,7 @@ def __init__( code: Optional[str] = None, message: Optional[str] = None, target: Optional[str] = None, - details: Optional[List["ManagedClusterPodIdentityProvisioningErrorBody"]] = None, + details: Optional[List["_models.ManagedClusterPodIdentityProvisioningErrorBody"]] = None, **kwargs ): """ @@ -4537,7 +4532,7 @@ class ManagedClusterPodIdentityProvisioningInfo(msrest.serialization.Model): def __init__( self, *, - error: Optional["ManagedClusterPodIdentityProvisioningError"] = None, + error: Optional["_models.ManagedClusterPodIdentityProvisioningError"] = None, **kwargs ): """ @@ -4558,8 +4553,8 @@ class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): :vartype kubernetes_version: str :ivar name: The Agent Pool name. :vartype name: str - :ivar os_type: Required. The operating system type. The default is Linux. Possible values - include: "Linux", "Windows". Default value: "Linux". + :ivar os_type: Required. The operating system type. The default is Linux. Known values are: + "Linux", "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.OSType :ivar upgrades: List of orchestrator types and versions available for upgrade. :vartype upgrades: @@ -4582,9 +4577,9 @@ def __init__( self, *, kubernetes_version: str, - os_type: Union[str, "OSType"] = "Linux", + os_type: Union[str, "_models.OSType"] = "Linux", name: Optional[str] = None, - upgrades: Optional[List["ManagedClusterPoolUpgradeProfileUpgradesItem"]] = None, + upgrades: Optional[List["_models.ManagedClusterPoolUpgradeProfileUpgradesItem"]] = None, **kwargs ): """ @@ -4592,8 +4587,8 @@ def __init__( :paramtype kubernetes_version: str :keyword name: The Agent Pool name. :paramtype name: str - :keyword os_type: Required. The operating system type. The default is Linux. Possible values - include: "Linux", "Windows". Default value: "Linux". + :keyword os_type: Required. The operating system type. The default is Linux. Known values are: + "Linux", "Windows". Default value: "Linux". :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.OSType :keyword upgrades: List of orchestrator types and versions available for upgrade. :paramtype upgrades: @@ -4645,8 +4640,7 @@ class ManagedClusterPropertiesAutoScalerProfile(msrest.serialization.Model): :vartype balance_similar_node_groups: str :ivar expander: If not specified, the default is 'random'. See `expanders `_ - for more information. Possible values include: "least-waste", "most-pods", "priority", - "random". + for more information. Known values are: "least-waste", "most-pods", "priority", "random". :vartype expander: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.Expander :ivar max_empty_bulk_delete: The default is 10. :vartype max_empty_bulk_delete: str @@ -4713,7 +4707,7 @@ def __init__( self, *, balance_similar_node_groups: Optional[str] = None, - expander: Optional[Union[str, "Expander"]] = None, + expander: Optional[Union[str, "_models.Expander"]] = None, max_empty_bulk_delete: Optional[str] = None, max_graceful_termination_sec: Optional[str] = None, max_node_provision_time: Optional[str] = None, @@ -4736,8 +4730,7 @@ def __init__( :paramtype balance_similar_node_groups: str :keyword expander: If not specified, the default is 'random'. See `expanders `_ - for more information. Possible values include: "least-waste", "most-pods", "priority", - "random". + for more information. Known values are: "least-waste", "most-pods", "priority", "random". :paramtype expander: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.Expander :keyword max_empty_bulk_delete: The default is 10. :paramtype max_empty_bulk_delete: str @@ -4831,7 +4824,7 @@ def __init__( self, *, kubernetes_version: Optional[str] = None, - sku: Optional["ManagedClusterSKU"] = None, + sku: Optional["_models.ManagedClusterSKU"] = None, enable_rbac: Optional[bool] = None, **kwargs ): @@ -4877,9 +4870,9 @@ class ManagedClusterSecurityProfile(msrest.serialization.Model): def __init__( self, *, - defender: Optional["ManagedClusterSecurityProfileDefender"] = None, - azure_key_vault_kms: Optional["AzureKeyVaultKms"] = None, - workload_identity: Optional["ManagedClusterSecurityProfileWorkloadIdentity"] = None, + defender: Optional["_models.ManagedClusterSecurityProfileDefender"] = None, + azure_key_vault_kms: Optional["_models.AzureKeyVaultKms"] = None, + workload_identity: Optional["_models.ManagedClusterSecurityProfileWorkloadIdentity"] = None, **kwargs ): """ @@ -4925,7 +4918,7 @@ def __init__( self, *, log_analytics_workspace_resource_id: Optional[str] = None, - security_monitoring: Optional["ManagedClusterSecurityProfileDefenderSecurityMonitoring"] = None, + security_monitoring: Optional["_models.ManagedClusterSecurityProfileDefenderSecurityMonitoring"] = None, **kwargs ): """ @@ -5035,12 +5028,12 @@ def __init__( class ManagedClusterSKU(msrest.serialization.Model): """The SKU of a Managed Cluster. - :ivar name: The name of a managed cluster SKU. Possible values include: "Basic". + :ivar name: The name of a managed cluster SKU. Known values are: "Basic". :vartype name: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterSKUName :ivar tier: If not specified, the default is 'Free'. See `uptime SLA - `_ for more details. Possible values include: - "Paid", "Free". + `_ for more details. Known values are: "Paid", + "Free". :vartype tier: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterSKUTier """ @@ -5053,17 +5046,17 @@ class ManagedClusterSKU(msrest.serialization.Model): def __init__( self, *, - name: Optional[Union[str, "ManagedClusterSKUName"]] = None, - tier: Optional[Union[str, "ManagedClusterSKUTier"]] = None, + name: Optional[Union[str, "_models.ManagedClusterSKUName"]] = None, + tier: Optional[Union[str, "_models.ManagedClusterSKUTier"]] = None, **kwargs ): """ - :keyword name: The name of a managed cluster SKU. Possible values include: "Basic". + :keyword name: The name of a managed cluster SKU. Known values are: "Basic". :paramtype name: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterSKUName :keyword tier: If not specified, the default is 'Free'. See `uptime SLA - `_ for more details. Possible values include: - "Paid", "Free". + `_ for more details. Known values are: "Paid", + "Free". :paramtype tier: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterSKUTier """ @@ -5097,7 +5090,7 @@ class ManagedClusterSnapshot(TrackedResource): :ivar creation_data: CreationData to be used to specify the source resource ID to create this snapshot. :vartype creation_data: ~azure.mgmt.containerservice.v2022_05_02_preview.models.CreationData - :ivar snapshot_type: The type of a snapshot. The default is NodePool. Possible values include: + :ivar snapshot_type: The type of a snapshot. The default is NodePool. Known values are: "NodePool", "ManagedCluster". Default value: "NodePool". :vartype snapshot_type: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.SnapshotType @@ -5133,8 +5126,8 @@ def __init__( *, location: str, tags: Optional[Dict[str, str]] = None, - creation_data: Optional["CreationData"] = None, - snapshot_type: Optional[Union[str, "SnapshotType"]] = "NodePool", + creation_data: Optional["_models.CreationData"] = None, + snapshot_type: Optional[Union[str, "_models.SnapshotType"]] = "NodePool", **kwargs ): """ @@ -5145,8 +5138,8 @@ def __init__( :keyword creation_data: CreationData to be used to specify the source resource ID to create this snapshot. :paramtype creation_data: ~azure.mgmt.containerservice.v2022_05_02_preview.models.CreationData - :keyword snapshot_type: The type of a snapshot. The default is NodePool. Possible values - include: "NodePool", "ManagedCluster". Default value: "NodePool". + :keyword snapshot_type: The type of a snapshot. The default is NodePool. Known values are: + "NodePool", "ManagedCluster". Default value: "NodePool". :paramtype snapshot_type: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.SnapshotType """ @@ -5180,7 +5173,7 @@ class ManagedClusterSnapshotListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["ManagedClusterSnapshot"]] = None, + value: Optional[List["_models.ManagedClusterSnapshot"]] = None, **kwargs ): """ @@ -5220,10 +5213,10 @@ class ManagedClusterStorageProfile(msrest.serialization.Model): def __init__( self, *, - disk_csi_driver: Optional["ManagedClusterStorageProfileDiskCSIDriver"] = None, - file_csi_driver: Optional["ManagedClusterStorageProfileFileCSIDriver"] = None, - snapshot_controller: Optional["ManagedClusterStorageProfileSnapshotController"] = None, - blob_csi_driver: Optional["ManagedClusterStorageProfileBlobCSIDriver"] = None, + disk_csi_driver: Optional["_models.ManagedClusterStorageProfileDiskCSIDriver"] = None, + file_csi_driver: Optional["_models.ManagedClusterStorageProfileFileCSIDriver"] = None, + snapshot_controller: Optional["_models.ManagedClusterStorageProfileSnapshotController"] = None, + blob_csi_driver: Optional["_models.ManagedClusterStorageProfileBlobCSIDriver"] = None, **kwargs ): """ @@ -5395,8 +5388,8 @@ class ManagedClusterUpgradeProfile(msrest.serialization.Model): def __init__( self, *, - control_plane_profile: "ManagedClusterPoolUpgradeProfile", - agent_pool_profiles: List["ManagedClusterPoolUpgradeProfile"], + control_plane_profile: "_models.ManagedClusterPoolUpgradeProfile", + agent_pool_profiles: List["_models.ManagedClusterPoolUpgradeProfile"], **kwargs ): """ @@ -5438,8 +5431,8 @@ class ManagedClusterWindowsProfile(msrest.serialization.Model): "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!". :vartype admin_password: str :ivar license_type: The license type to use for Windows VMs. See `Azure Hybrid User Benefits - `_ for more details. Possible values - include: "None", "Windows_Server". + `_ for more details. Known values are: + "None", "Windows_Server". :vartype license_type: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.LicenseType :ivar enable_csi_proxy: For more details on CSI proxy, see the `CSI proxy GitHub repo @@ -5467,9 +5460,9 @@ def __init__( *, admin_username: str, admin_password: Optional[str] = None, - license_type: Optional[Union[str, "LicenseType"]] = None, + license_type: Optional[Union[str, "_models.LicenseType"]] = None, enable_csi_proxy: Optional[bool] = None, - gmsa_profile: Optional["WindowsGmsaProfile"] = None, + gmsa_profile: Optional["_models.WindowsGmsaProfile"] = None, **kwargs ): """ @@ -5490,8 +5483,8 @@ def __init__( "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!". :paramtype admin_password: str :keyword license_type: The license type to use for Windows VMs. See `Azure Hybrid User Benefits - `_ for more details. Possible values - include: "None", "Windows_Server". + `_ for more details. Known values are: + "None", "Windows_Server". :paramtype license_type: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.LicenseType :keyword enable_csi_proxy: For more details on CSI proxy, see the `CSI proxy GitHub repo @@ -5525,7 +5518,7 @@ class ManagedClusterWorkloadAutoScalerProfile(msrest.serialization.Model): def __init__( self, *, - keda: Optional["ManagedClusterWorkloadAutoScalerProfileKeda"] = None, + keda: Optional["_models.ManagedClusterWorkloadAutoScalerProfileKeda"] = None, **kwargs ): """ @@ -5604,23 +5597,23 @@ def __init__( class NetworkProfileForSnapshot(msrest.serialization.Model): """network profile for managed cluster snapshot, these properties are read only. - :ivar network_plugin: networkPlugin for managed cluster snapshot. Possible values include: - "azure", "kubenet", "none". Default value: "kubenet". + :ivar network_plugin: networkPlugin for managed cluster snapshot. Known values are: "azure", + "kubenet", "none". Default value: "kubenet". :vartype network_plugin: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.NetworkPlugin - :ivar network_plugin_mode: NetworkPluginMode for managed cluster snapshot. Possible values - include: "Overlay". + :ivar network_plugin_mode: NetworkPluginMode for managed cluster snapshot. Known values are: + "Overlay". :vartype network_plugin_mode: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.NetworkPluginMode - :ivar network_policy: networkPolicy for managed cluster snapshot. Possible values include: - "calico", "azure". + :ivar network_policy: networkPolicy for managed cluster snapshot. Known values are: "calico", + "azure". :vartype network_policy: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.NetworkPolicy - :ivar network_mode: networkMode for managed cluster snapshot. Possible values include: - "transparent", "bridge". + :ivar network_mode: networkMode for managed cluster snapshot. Known values are: "transparent", + "bridge". :vartype network_mode: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.NetworkMode - :ivar load_balancer_sku: loadBalancerSku for managed cluster snapshot. Possible values include: + :ivar load_balancer_sku: loadBalancerSku for managed cluster snapshot. Known values are: "standard", "basic". :vartype load_balancer_sku: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.LoadBalancerSku @@ -5637,32 +5630,32 @@ class NetworkProfileForSnapshot(msrest.serialization.Model): def __init__( self, *, - network_plugin: Optional[Union[str, "NetworkPlugin"]] = "kubenet", - network_plugin_mode: Optional[Union[str, "NetworkPluginMode"]] = None, - network_policy: Optional[Union[str, "NetworkPolicy"]] = None, - network_mode: Optional[Union[str, "NetworkMode"]] = None, - load_balancer_sku: Optional[Union[str, "LoadBalancerSku"]] = None, + network_plugin: Optional[Union[str, "_models.NetworkPlugin"]] = "kubenet", + network_plugin_mode: Optional[Union[str, "_models.NetworkPluginMode"]] = None, + network_policy: Optional[Union[str, "_models.NetworkPolicy"]] = None, + network_mode: Optional[Union[str, "_models.NetworkMode"]] = None, + load_balancer_sku: Optional[Union[str, "_models.LoadBalancerSku"]] = None, **kwargs ): """ - :keyword network_plugin: networkPlugin for managed cluster snapshot. Possible values include: - "azure", "kubenet", "none". Default value: "kubenet". + :keyword network_plugin: networkPlugin for managed cluster snapshot. Known values are: "azure", + "kubenet", "none". Default value: "kubenet". :paramtype network_plugin: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.NetworkPlugin - :keyword network_plugin_mode: NetworkPluginMode for managed cluster snapshot. Possible values - include: "Overlay". + :keyword network_plugin_mode: NetworkPluginMode for managed cluster snapshot. Known values are: + "Overlay". :paramtype network_plugin_mode: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.NetworkPluginMode - :keyword network_policy: networkPolicy for managed cluster snapshot. Possible values include: + :keyword network_policy: networkPolicy for managed cluster snapshot. Known values are: "calico", "azure". :paramtype network_policy: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.NetworkPolicy - :keyword network_mode: networkMode for managed cluster snapshot. Possible values include: + :keyword network_mode: networkMode for managed cluster snapshot. Known values are: "transparent", "bridge". :paramtype network_mode: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.NetworkMode - :keyword load_balancer_sku: loadBalancerSku for managed cluster snapshot. Possible values - include: "standard", "basic". + :keyword load_balancer_sku: loadBalancerSku for managed cluster snapshot. Known values are: + "standard", "basic". :paramtype load_balancer_sku: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.LoadBalancerSku """ @@ -5788,7 +5781,7 @@ class OSOptionProfile(msrest.serialization.Model): def __init__( self, *, - os_option_property_list: List["OSOptionProperty"], + os_option_property_list: List["_models.OSOptionProperty"], **kwargs ): """ @@ -5862,7 +5855,7 @@ def __init__( self, *, category: Optional[str] = None, - endpoints: Optional[List["EndpointDependency"]] = None, + endpoints: Optional[List["_models.EndpointDependency"]] = None, **kwargs ): """ @@ -5905,7 +5898,7 @@ class OutboundEnvironmentEndpointCollection(msrest.serialization.Model): def __init__( self, *, - value: List["OutboundEnvironmentEndpoint"], + value: List["_models.OutboundEnvironmentEndpoint"], **kwargs ): """ @@ -5921,8 +5914,8 @@ def __init__( class PowerState(msrest.serialization.Model): """Describes the Power State of the cluster. - :ivar code: Tells whether the cluster is Running or Stopped. Possible values include: - "Running", "Stopped". + :ivar code: Tells whether the cluster is Running or Stopped. Known values are: "Running", + "Stopped". :vartype code: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.Code """ @@ -5933,12 +5926,12 @@ class PowerState(msrest.serialization.Model): def __init__( self, *, - code: Optional[Union[str, "Code"]] = None, + code: Optional[Union[str, "_models.Code"]] = None, **kwargs ): """ - :keyword code: Tells whether the cluster is Running or Stopped. Possible values include: - "Running", "Stopped". + :keyword code: Tells whether the cluster is Running or Stopped. Known values are: "Running", + "Stopped". :paramtype code: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.Code """ super(PowerState, self).__init__(**kwargs) @@ -5981,7 +5974,7 @@ class PrivateEndpointConnection(msrest.serialization.Model): :vartype name: str :ivar type: The resource type. :vartype type: str - :ivar provisioning_state: The current provisioning state. Possible values include: "Succeeded", + :ivar provisioning_state: The current provisioning state. Known values are: "Succeeded", "Creating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.PrivateEndpointConnectionProvisioningState @@ -6013,8 +6006,8 @@ class PrivateEndpointConnection(msrest.serialization.Model): def __init__( self, *, - private_endpoint: Optional["PrivateEndpoint"] = None, - private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, + private_endpoint: Optional["_models.PrivateEndpoint"] = None, + private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionState"] = None, **kwargs ): """ @@ -6050,7 +6043,7 @@ class PrivateEndpointConnectionListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["PrivateEndpointConnection"]] = None, + value: Optional[List["_models.PrivateEndpointConnection"]] = None, **kwargs ): """ @@ -6141,7 +6134,7 @@ class PrivateLinkResourcesListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["PrivateLinkResource"]] = None, + value: Optional[List["_models.PrivateLinkResource"]] = None, **kwargs ): """ @@ -6156,7 +6149,7 @@ def __init__( class PrivateLinkServiceConnectionState(msrest.serialization.Model): """The state of a private link service connection. - :ivar status: The private link service connection status. Possible values include: "Pending", + :ivar status: The private link service connection status. Known values are: "Pending", "Approved", "Rejected", "Disconnected". :vartype status: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.ConnectionStatus @@ -6172,13 +6165,13 @@ class PrivateLinkServiceConnectionState(msrest.serialization.Model): def __init__( self, *, - status: Optional[Union[str, "ConnectionStatus"]] = None, + status: Optional[Union[str, "_models.ConnectionStatus"]] = None, description: Optional[str] = None, **kwargs ): """ - :keyword status: The private link service connection status. Possible values include: - "Pending", "Approved", "Rejected", "Disconnected". + :keyword status: The private link service connection status. Known values are: "Pending", + "Approved", "Rejected", "Disconnected". :paramtype status: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.ConnectionStatus :keyword description: The private link service connection description. @@ -6341,7 +6334,7 @@ class Snapshot(TrackedResource): :ivar creation_data: CreationData to be used to specify the source agent pool resource ID to create this snapshot. :vartype creation_data: ~azure.mgmt.containerservice.v2022_05_02_preview.models.CreationData - :ivar snapshot_type: The type of a snapshot. The default is NodePool. Possible values include: + :ivar snapshot_type: The type of a snapshot. The default is NodePool. Known values are: "NodePool", "ManagedCluster". Default value: "NodePool". :vartype snapshot_type: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.SnapshotType @@ -6349,12 +6342,12 @@ class Snapshot(TrackedResource): :vartype kubernetes_version: str :ivar node_image_version: The version of node image. :vartype node_image_version: str - :ivar os_type: The operating system type. The default is Linux. Possible values include: - "Linux", "Windows". Default value: "Linux". + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". :vartype os_type: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.OSType :ivar os_sku: Specifies the OS SKU used by the agent pool. If not specified, the default is Ubuntu if OSType=Linux or Windows2019 if OSType=Windows. And the default Windows OSSKU will be - changed to Windows2022 after Windows2019 is deprecated. Possible values include: "Ubuntu", + changed to Windows2022 after Windows2019 is deprecated. Known values are: "Ubuntu", "CBLMariner", "Windows2019", "Windows2022". :vartype os_sku: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.OSSKU :ivar vm_size: The size of the VM. @@ -6399,8 +6392,8 @@ def __init__( *, location: str, tags: Optional[Dict[str, str]] = None, - creation_data: Optional["CreationData"] = None, - snapshot_type: Optional[Union[str, "SnapshotType"]] = "NodePool", + creation_data: Optional["_models.CreationData"] = None, + snapshot_type: Optional[Union[str, "_models.SnapshotType"]] = "NodePool", **kwargs ): """ @@ -6411,8 +6404,8 @@ def __init__( :keyword creation_data: CreationData to be used to specify the source agent pool resource ID to create this snapshot. :paramtype creation_data: ~azure.mgmt.containerservice.v2022_05_02_preview.models.CreationData - :keyword snapshot_type: The type of a snapshot. The default is NodePool. Possible values - include: "NodePool", "ManagedCluster". Default value: "NodePool". + :keyword snapshot_type: The type of a snapshot. The default is NodePool. Known values are: + "NodePool", "ManagedCluster". Default value: "NodePool". :paramtype snapshot_type: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.SnapshotType """ @@ -6450,7 +6443,7 @@ class SnapshotListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["Snapshot"]] = None, + value: Optional[List["_models.Snapshot"]] = None, **kwargs ): """ @@ -6681,7 +6674,7 @@ class SystemData(msrest.serialization.Model): :ivar created_by: The identity that created the resource. :vartype created_by: str - :ivar created_by_type: The type of identity that created the resource. Possible values include: + :ivar created_by_type: The type of identity that created the resource. Known values are: "User", "Application", "ManagedIdentity", "Key". :vartype created_by_type: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.CreatedByType @@ -6689,8 +6682,8 @@ class SystemData(msrest.serialization.Model): :vartype created_at: ~datetime.datetime :ivar last_modified_by: The identity that last modified the resource. :vartype last_modified_by: str - :ivar last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". + :ivar last_modified_by_type: The type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", "Key". :vartype last_modified_by_type: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.CreatedByType :ivar last_modified_at: The timestamp of resource last modification (UTC). @@ -6710,26 +6703,26 @@ def __init__( self, *, created_by: Optional[str] = None, - created_by_type: Optional[Union[str, "CreatedByType"]] = None, + created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, created_at: Optional[datetime.datetime] = None, last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[Union[str, "CreatedByType"]] = None, + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, last_modified_at: Optional[datetime.datetime] = None, **kwargs ): """ :keyword created_by: The identity that created the resource. :paramtype created_by: str - :keyword created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". + :keyword created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", "Key". :paramtype created_by_type: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.CreatedByType :keyword created_at: The timestamp of resource creation (UTC). :paramtype created_at: ~datetime.datetime :keyword last_modified_by: The identity that last modified the resource. :paramtype last_modified_by: str - :keyword last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". + :keyword last_modified_by_type: The type of identity that last modified the resource. Known + values are: "User", "Application", "ManagedIdentity", "Key". :paramtype last_modified_by_type: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.CreatedByType :keyword last_modified_at: The timestamp of resource last modification (UTC). @@ -6772,8 +6765,8 @@ def __init__( class TimeInWeek(msrest.serialization.Model): """Time in a week. - :ivar day: The day of the week. Possible values include: "Sunday", "Monday", "Tuesday", - "Wednesday", "Thursday", "Friday", "Saturday". + :ivar day: The day of the week. Known values are: "Sunday", "Monday", "Tuesday", "Wednesday", + "Thursday", "Friday", "Saturday". :vartype day: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.WeekDay :ivar hour_slots: Each integer hour represents a time range beginning at 0m after the hour ending at the next hour (non-inclusive). 0 corresponds to 00:00 UTC, 23 corresponds to 23:00 @@ -6789,12 +6782,12 @@ class TimeInWeek(msrest.serialization.Model): def __init__( self, *, - day: Optional[Union[str, "WeekDay"]] = None, + day: Optional[Union[str, "_models.WeekDay"]] = None, hour_slots: Optional[List[int]] = None, **kwargs ): """ - :keyword day: The day of the week. Possible values include: "Sunday", "Monday", "Tuesday", + :keyword day: The day of the week. Known values are: "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday". :paramtype day: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.WeekDay :keyword hour_slots: Each integer hour represents a time range beginning at 0m after the hour @@ -6897,8 +6890,8 @@ class TrustedAccessRoleBinding(Resource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.containerservice.v2022_05_02_preview.models.SystemData - :ivar provisioning_state: The current provisioning state of trusted access role binding. - Possible values include: "Succeeded", "Failed", "Updating", "Deleting". + :ivar provisioning_state: The current provisioning state of trusted access role binding. Known + values are: "Succeeded", "Failed", "Updating", "Deleting". :vartype provisioning_state: str or ~azure.mgmt.containerservice.v2022_05_02_preview.models.TrustedAccessRoleBindingProvisioningState :ivar source_resource_id: Required. The ARM resource ID of source resource that trusted access @@ -6974,7 +6967,7 @@ class TrustedAccessRoleBindingListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["TrustedAccessRoleBinding"]] = None, + value: Optional[List["_models.TrustedAccessRoleBinding"]] = None, **kwargs ): """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/models/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/models/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/__init__.py index 4a9011533682..fe53dc12e778 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/__init__.py @@ -18,6 +18,9 @@ from ._trusted_access_roles_operations import TrustedAccessRolesOperations from ._trusted_access_role_bindings_operations import TrustedAccessRoleBindingsOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'Operations', 'ManagedClustersOperations', @@ -31,3 +34,5 @@ 'TrustedAccessRolesOperations', 'TrustedAccessRoleBindingsOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_agent_pools_operations.py index 93bcb82883a8..010aab4a6335 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_agent_pools_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_agent_pools_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -35,9 +35,12 @@ def build_list_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools") # pylint: disable=line-too-long path_format_arguments = { @@ -49,18 +52,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -72,9 +73,12 @@ def build_get_request( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -87,18 +91,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -109,14 +111,17 @@ def build_create_or_update_request_initial( resource_name: str, agent_pool_name: str, *, - json: JSONType = None, + json: Optional[_models.AgentPool] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -129,20 +134,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -158,9 +161,12 @@ def build_delete_request_initial( ignore_pod_disruption_budget: Optional[bool] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long path_format_arguments = { @@ -173,20 +179,18 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if ignore_pod_disruption_budget is not None: - _query_parameters['ignore-pod-disruption-budget'] = _SERIALIZER.query("ignore_pod_disruption_budget", ignore_pod_disruption_budget, 'bool') + _params['ignore-pod-disruption-budget'] = _SERIALIZER.query("ignore_pod_disruption_budget", ignore_pod_disruption_budget, 'bool') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -198,9 +202,12 @@ def build_get_upgrade_profile_request( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default") # pylint: disable=line-too-long path_format_arguments = { @@ -213,18 +220,16 @@ def build_get_upgrade_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -235,9 +240,12 @@ def build_get_available_agent_pool_versions_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions") # pylint: disable=line-too-long path_format_arguments = { @@ -249,18 +257,16 @@ def build_get_available_agent_pool_versions_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -272,9 +278,12 @@ def build_upgrade_node_image_version_request_initial( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion") # pylint: disable=line-too-long path_format_arguments = { @@ -287,42 +296,38 @@ def build_upgrade_node_image_version_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class AgentPoolsOperations(object): - """AgentPoolsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class AgentPoolsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_05_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_05_02_preview.ContainerServiceClient`'s + :attr:`agent_pools` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -330,7 +335,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Iterable["_models.AgentPoolListResult"]: + ) -> Iterable[_models.AgentPoolListResult]: """Gets a list of agent pools in the specified managed cluster. Gets a list of agent pools in the specified managed cluster. @@ -345,13 +350,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_05_02_preview.models.AgentPoolListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -361,9 +369,11 @@ def prepare_request(next_link=None): resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -373,9 +383,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -415,7 +427,7 @@ def get( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPool": + ) -> _models.AgentPool: """Gets the specified managed cluster agent pool. Gets the specified managed cluster agent pool. @@ -431,13 +443,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.AgentPool :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] request = build_get_request( @@ -447,11 +462,13 @@ def get( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -477,17 +494,20 @@ def _create_or_update_initial( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> "_models.AgentPool": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] + ) -> _models.AgentPool: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-05-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] _json = self._serialize.body(parameters, 'AgentPool') @@ -500,11 +520,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -535,9 +557,9 @@ def begin_create_or_update( resource_group_name: str, resource_name: str, agent_pool_name: str, - parameters: "_models.AgentPool", + parameters: _models.AgentPool, **kwargs: Any - ) -> LROPoller["_models.AgentPool"]: + ) -> LROPoller[_models.AgentPool]: """Creates or updates an agent pool in the specified managed cluster. Creates or updates an agent pool in the specified managed cluster. @@ -563,17 +585,20 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_05_02_preview.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, @@ -581,20 +606,27 @@ def begin_create_or_update( 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): - response = pipeline_response.http_response deserialized = self._deserialize('AgentPool', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -615,13 +647,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements ignore_pod_disruption_budget: Optional[bool] = None, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -632,11 +667,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements api_version=api_version, ignore_pod_disruption_budget=ignore_pod_disruption_budget, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -687,22 +724,27 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, agent_pool_name=agent_pool_name, ignore_pod_disruption_budget=ignore_pod_disruption_budget, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -712,8 +754,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -733,7 +781,7 @@ def get_upgrade_profile( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> "_models.AgentPoolUpgradeProfile": + ) -> _models.AgentPoolUpgradeProfile: """Gets the upgrade profile for an agent pool. Gets the upgrade profile for an agent pool. @@ -749,13 +797,16 @@ def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.AgentPoolUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] request = build_get_upgrade_profile_request( @@ -765,11 +816,13 @@ def get_upgrade_profile( agent_pool_name=agent_pool_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -796,7 +849,7 @@ def get_available_agent_pool_versions( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.AgentPoolAvailableVersions": + ) -> _models.AgentPoolAvailableVersions: """Gets a list of supported Kubernetes versions for the specified agent pool. See `supported Kubernetes versions @@ -812,13 +865,16 @@ def get_available_agent_pool_versions( :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.AgentPoolAvailableVersions :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPoolAvailableVersions"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] request = build_get_available_agent_pool_versions_request( @@ -827,11 +883,13 @@ def get_available_agent_pool_versions( resource_name=resource_name, api_version=api_version, template_url=self.get_available_agent_pool_versions.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -858,14 +916,17 @@ def _upgrade_node_image_version_initial( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> Optional["_models.AgentPool"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.AgentPool"]] + ) -> Optional[_models.AgentPool]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] request = build_upgrade_node_image_version_request_initial( @@ -875,11 +936,13 @@ def _upgrade_node_image_version_initial( agent_pool_name=agent_pool_name, api_version=api_version, template_url=self._upgrade_node_image_version_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -912,7 +975,7 @@ def begin_upgrade_node_image_version( resource_name: str, agent_pool_name: str, **kwargs: Any - ) -> LROPoller["_models.AgentPool"]: + ) -> LROPoller[_models.AgentPool]: """Upgrades the node image version of an agent pool to the latest. Upgrading the node image version of an agent pool applies the newest OS and runtime updates to @@ -938,21 +1001,26 @@ def begin_upgrade_node_image_version( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_05_02_preview.models.AgentPool] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AgentPool"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._upgrade_node_image_version_initial( + raw_result = self._upgrade_node_image_version_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, 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) @@ -968,8 +1036,14 @@ def get_long_running_output(pipeline_response): return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_maintenance_configurations_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_maintenance_configurations_operations.py index 31ddec90744f..bf84feb2dba5 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_maintenance_configurations_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_maintenance_configurations_operations.py @@ -16,12 +16,12 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -33,9 +33,12 @@ def build_list_by_managed_cluster_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations") # pylint: disable=line-too-long path_format_arguments = { @@ -47,18 +50,16 @@ def build_list_by_managed_cluster_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -70,9 +71,12 @@ def build_get_request( config_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long path_format_arguments = { @@ -85,18 +89,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -107,14 +109,17 @@ def build_create_or_update_request( resource_name: str, config_name: str, *, - json: JSONType = None, + json: Optional[_models.MaintenanceConfiguration] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long path_format_arguments = { @@ -127,20 +132,18 @@ def build_create_or_update_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -154,9 +157,12 @@ def build_delete_request( config_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # pylint: disable=line-too-long path_format_arguments = { @@ -169,42 +175,38 @@ def build_delete_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class MaintenanceConfigurationsOperations(object): - """MaintenanceConfigurationsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class MaintenanceConfigurationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_05_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_05_02_preview.ContainerServiceClient`'s + :attr:`maintenance_configurations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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_by_managed_cluster( @@ -212,7 +214,7 @@ def list_by_managed_cluster( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Iterable["_models.MaintenanceConfigurationListResult"]: + ) -> Iterable[_models.MaintenanceConfigurationListResult]: """Gets a list of maintenance configurations in the specified managed cluster. Gets a list of maintenance configurations in the specified managed cluster. @@ -228,13 +230,16 @@ def list_by_managed_cluster( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_05_02_preview.models.MaintenanceConfigurationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfigurationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfigurationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -244,9 +249,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=self.list_by_managed_cluster.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -256,9 +263,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -298,7 +307,7 @@ def get( resource_name: str, config_name: str, **kwargs: Any - ) -> "_models.MaintenanceConfiguration": + ) -> _models.MaintenanceConfiguration: """Gets the specified maintenance configuration of a managed cluster. Gets the specified maintenance configuration of a managed cluster. @@ -314,13 +323,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.MaintenanceConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfiguration"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] request = build_get_request( @@ -330,11 +342,13 @@ def get( config_name=config_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -361,9 +375,9 @@ def create_or_update( resource_group_name: str, resource_name: str, config_name: str, - parameters: "_models.MaintenanceConfiguration", + parameters: _models.MaintenanceConfiguration, **kwargs: Any - ) -> "_models.MaintenanceConfiguration": + ) -> _models.MaintenanceConfiguration: """Creates or updates a maintenance configuration in the specified managed cluster. Creates or updates a maintenance configuration in the specified managed cluster. @@ -382,14 +396,17 @@ def create_or_update( :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.MaintenanceConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MaintenanceConfiguration"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-05-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] _json = self._serialize.body(parameters, 'MaintenanceConfiguration') @@ -402,11 +419,13 @@ def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -450,13 +469,16 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -466,11 +488,13 @@ def delete( # pylint: disable=inconsistent-return-statements config_name=config_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_managed_cluster_snapshots_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_managed_cluster_snapshots_operations.py index d59e2206bde8..493e77e9c580 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_managed_cluster_snapshots_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_managed_cluster_snapshots_operations.py @@ -16,12 +16,12 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -31,9 +31,12 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedclustersnapshots") # pylint: disable=line-too-long path_format_arguments = { @@ -43,18 +46,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -64,9 +65,12 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots") # pylint: disable=line-too-long path_format_arguments = { @@ -77,18 +81,16 @@ def build_list_by_resource_group_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -99,9 +101,12 @@ def build_get_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -113,18 +118,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -134,14 +137,17 @@ def build_create_or_update_request( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedClusterSnapshot] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -153,20 +159,18 @@ def build_create_or_update_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -178,14 +182,17 @@ def build_update_tags_request( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.TagsObject] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -197,20 +204,18 @@ def build_update_tags_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -223,9 +228,12 @@ def build_delete_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -237,48 +245,44 @@ def build_delete_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class ManagedClusterSnapshotsOperations(object): - """ManagedClusterSnapshotsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ManagedClusterSnapshotsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_05_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_05_02_preview.ContainerServiceClient`'s + :attr:`managed_cluster_snapshots` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> Iterable["_models.ManagedClusterSnapshotListResult"]: + ) -> Iterable[_models.ManagedClusterSnapshotListResult]: """Gets a list of managed cluster snapshots in the specified subscription. Gets a list of managed cluster snapshots in the specified subscription. @@ -290,13 +294,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterSnapshotListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshotListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterSnapshotListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -304,9 +311,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -314,9 +323,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -354,7 +365,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.ManagedClusterSnapshotListResult"]: + ) -> Iterable[_models.ManagedClusterSnapshotListResult]: """Lists managed cluster snapshots in the specified subscription and resource group. Lists managed cluster snapshots in the specified subscription and resource group. @@ -368,13 +379,16 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterSnapshotListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshotListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterSnapshotListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -383,9 +397,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -394,9 +410,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -435,7 +453,7 @@ def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedClusterSnapshot": + ) -> _models.ManagedClusterSnapshot: """Gets a managed cluster snapshot. Gets a managed cluster snapshot. @@ -449,13 +467,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterSnapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterSnapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshot] request = build_get_request( @@ -464,11 +485,13 @@ def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -494,9 +517,9 @@ def create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterSnapshot", + parameters: _models.ManagedClusterSnapshot, **kwargs: Any - ) -> "_models.ManagedClusterSnapshot": + ) -> _models.ManagedClusterSnapshot: """Creates or updates a managed cluster snapshot. Creates or updates a managed cluster snapshot. @@ -513,14 +536,17 @@ def create_or_update( :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterSnapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterSnapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-05-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshot] _json = self._serialize.body(parameters, 'ManagedClusterSnapshot') @@ -532,11 +558,13 @@ def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -566,9 +594,9 @@ def update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.ManagedClusterSnapshot": + ) -> _models.ManagedClusterSnapshot: """Updates tags on a managed cluster snapshot. Updates tags on a managed cluster snapshot. @@ -584,14 +612,17 @@ def update_tags( :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterSnapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterSnapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshot] _json = self._serialize.body(parameters, 'TagsObject') @@ -603,11 +634,13 @@ def update_tags( content_type=content_type, json=_json, template_url=self.update_tags.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -648,13 +681,16 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -663,11 +699,13 @@ def delete( # pylint: disable=inconsistent-return-statements resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_managed_clusters_operations.py index ddec9e7256a4..c4cd9a5bc9c3 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_managed_clusters_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_managed_clusters_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -36,9 +36,12 @@ def build_get_os_options_request( resource_type: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default") # pylint: disable=line-too-long path_format_arguments = { @@ -49,20 +52,18 @@ def build_get_os_options_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if resource_type is not None: - _query_parameters['resource-type'] = _SERIALIZER.query("resource_type", resource_type, 'str') + _params['resource-type'] = _SERIALIZER.query("resource_type", resource_type, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -71,9 +72,12 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters") path_format_arguments = { @@ -83,18 +87,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -104,9 +106,12 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters") # pylint: disable=line-too-long path_format_arguments = { @@ -117,18 +122,16 @@ def build_list_by_resource_group_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -139,9 +142,12 @@ def build_get_upgrade_profile_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default") # pylint: disable=line-too-long path_format_arguments = { @@ -153,18 +159,16 @@ def build_get_upgrade_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -176,9 +180,12 @@ def build_get_access_profile_request( role_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -191,18 +198,16 @@ def build_get_access_profile_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -215,9 +220,12 @@ def build_list_cluster_admin_credentials_request( server_fqdn: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -229,20 +237,18 @@ def build_list_cluster_admin_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if server_fqdn is not None: - _query_parameters['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -256,9 +262,12 @@ def build_list_cluster_user_credentials_request( format: Optional[Union[str, "_models.Format"]] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -270,22 +279,20 @@ def build_list_cluster_user_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if server_fqdn is not None: - _query_parameters['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') if format is not None: - _query_parameters['format'] = _SERIALIZER.query("format", format, 'str') + _params['format'] = _SERIALIZER.query("format", format, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -298,9 +305,12 @@ def build_list_cluster_monitoring_user_credentials_request( server_fqdn: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential") # pylint: disable=line-too-long path_format_arguments = { @@ -312,20 +322,18 @@ def build_list_cluster_monitoring_user_credentials_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if server_fqdn is not None: - _query_parameters['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -336,9 +344,12 @@ def build_get_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -350,18 +361,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -371,14 +380,17 @@ def build_create_or_update_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedCluster] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -390,20 +402,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -415,14 +425,17 @@ def build_update_tags_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.TagsObject] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -434,20 +447,18 @@ def build_update_tags_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -462,9 +473,12 @@ def build_delete_request_initial( ignore_pod_disruption_budget: Optional[bool] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -476,20 +490,18 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if ignore_pod_disruption_budget is not None: - _query_parameters['ignore-pod-disruption-budget'] = _SERIALIZER.query("ignore_pod_disruption_budget", ignore_pod_disruption_budget, 'bool') + _params['ignore-pod-disruption-budget'] = _SERIALIZER.query("ignore_pod_disruption_budget", ignore_pod_disruption_budget, 'bool') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -499,14 +511,17 @@ def build_reset_service_principal_profile_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedClusterServicePrincipalProfile] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile") # pylint: disable=line-too-long path_format_arguments = { @@ -518,20 +533,18 @@ def build_reset_service_principal_profile_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -543,14 +556,17 @@ def build_reset_aad_profile_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.ManagedClusterAADProfile] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile") # pylint: disable=line-too-long path_format_arguments = { @@ -562,20 +578,18 @@ def build_reset_aad_profile_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -588,9 +602,12 @@ def build_rotate_cluster_certificates_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates") # pylint: disable=line-too-long path_format_arguments = { @@ -602,18 +619,16 @@ def build_rotate_cluster_certificates_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -624,9 +639,12 @@ def build_rotate_service_account_signing_keys_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateServiceAccountSigningKeys") # pylint: disable=line-too-long path_format_arguments = { @@ -638,18 +656,16 @@ def build_rotate_service_account_signing_keys_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -660,9 +676,12 @@ def build_stop_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop") # pylint: disable=line-too-long path_format_arguments = { @@ -674,18 +693,16 @@ def build_stop_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -696,9 +713,12 @@ def build_start_request_initial( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start") # pylint: disable=line-too-long path_format_arguments = { @@ -710,18 +730,16 @@ def build_start_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -731,14 +749,17 @@ def build_run_command_request_initial( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.RunCommandRequest] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand") # pylint: disable=line-too-long path_format_arguments = { @@ -750,20 +771,18 @@ def build_run_command_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -777,9 +796,12 @@ def build_get_command_result_request( command_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}") # pylint: disable=line-too-long path_format_arguments = { @@ -792,18 +814,16 @@ def build_get_command_result_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -814,9 +834,12 @@ def build_list_outbound_network_dependencies_endpoints_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints") # pylint: disable=line-too-long path_format_arguments = { @@ -828,42 +851,38 @@ def build_list_outbound_network_dependencies_endpoints_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class ManagedClustersOperations(object): # pylint: disable=too-many-public-methods - """ManagedClustersOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ManagedClustersOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_05_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_05_02_preview.ContainerServiceClient`'s + :attr:`managed_clusters` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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_os_options( @@ -871,7 +890,7 @@ def get_os_options( location: str, resource_type: Optional[str] = None, **kwargs: Any - ) -> "_models.OSOptionProfile": + ) -> _models.OSOptionProfile: """Gets supported OS options in the specified subscription. Gets supported OS options in the specified subscription. @@ -886,13 +905,16 @@ def get_os_options( :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.OSOptionProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OSOptionProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OSOptionProfile] request = build_get_os_options_request( @@ -901,11 +923,13 @@ def get_os_options( api_version=api_version, resource_type=resource_type, template_url=self.get_os_options.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -930,7 +954,7 @@ def get_os_options( def list( self, **kwargs: Any - ) -> Iterable["_models.ManagedClusterListResult"]: + ) -> Iterable[_models.ManagedClusterListResult]: """Gets a list of managed clusters in the specified subscription. Gets a list of managed clusters in the specified subscription. @@ -942,13 +966,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -956,9 +983,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -966,9 +995,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -1006,7 +1037,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.ManagedClusterListResult"]: + ) -> Iterable[_models.ManagedClusterListResult]: """Lists managed clusters in the specified subscription and resource group. Lists managed clusters in the specified subscription and resource group. @@ -1020,13 +1051,16 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -1035,9 +1069,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -1046,9 +1082,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -1087,7 +1125,7 @@ def get_upgrade_profile( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedClusterUpgradeProfile": + ) -> _models.ManagedClusterUpgradeProfile: """Gets the upgrade profile of a managed cluster. Gets the upgrade profile of a managed cluster. @@ -1101,13 +1139,16 @@ def get_upgrade_profile( :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterUpgradeProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterUpgradeProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] request = build_get_upgrade_profile_request( @@ -1116,11 +1157,13 @@ def get_upgrade_profile( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1148,7 +1191,7 @@ def get_access_profile( resource_name: str, role_name: str, **kwargs: Any - ) -> "_models.ManagedClusterAccessProfile": + ) -> _models.ManagedClusterAccessProfile: """Gets an access profile of a managed cluster. **WARNING**\ : This API will be deprecated. Instead use `ListClusterUserCredentials @@ -1167,13 +1210,16 @@ def get_access_profile( :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedClusterAccessProfile :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterAccessProfile"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] request = build_get_access_profile_request( @@ -1183,11 +1229,13 @@ def get_access_profile( role_name=role_name, api_version=api_version, template_url=self.get_access_profile.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1215,7 +1263,7 @@ def list_cluster_admin_credentials( resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Lists the admin credentials of a managed cluster. Lists the admin credentials of a managed cluster. @@ -1231,13 +1279,16 @@ def list_cluster_admin_credentials( :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_admin_credentials_request( @@ -1247,11 +1298,13 @@ def list_cluster_admin_credentials( api_version=api_version, server_fqdn=server_fqdn, template_url=self.list_cluster_admin_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1280,7 +1333,7 @@ def list_cluster_user_credentials( server_fqdn: Optional[str] = None, format: Optional[Union[str, "_models.Format"]] = None, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Lists the user credentials of a managed cluster. Lists the user credentials of a managed cluster. @@ -1300,13 +1353,16 @@ def list_cluster_user_credentials( :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_user_credentials_request( @@ -1317,11 +1373,13 @@ def list_cluster_user_credentials( server_fqdn=server_fqdn, format=format, template_url=self.list_cluster_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1349,7 +1407,7 @@ def list_cluster_monitoring_user_credentials( resource_name: str, server_fqdn: Optional[str] = None, **kwargs: Any - ) -> "_models.CredentialResults": + ) -> _models.CredentialResults: """Lists the cluster monitoring user credentials of a managed cluster. Lists the cluster monitoring user credentials of a managed cluster. @@ -1365,13 +1423,16 @@ def list_cluster_monitoring_user_credentials( :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.CredentialResults :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CredentialResults"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] request = build_list_cluster_monitoring_user_credentials_request( @@ -1381,11 +1442,13 @@ def list_cluster_monitoring_user_credentials( api_version=api_version, server_fqdn=server_fqdn, template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1412,7 +1475,7 @@ def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.ManagedCluster": + ) -> _models.ManagedCluster: """Gets a managed cluster. Gets a managed cluster. @@ -1426,13 +1489,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedCluster :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] request = build_get_request( @@ -1441,11 +1507,13 @@ def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1470,17 +1538,20 @@ def _create_or_update_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'ManagedCluster') @@ -1492,11 +1563,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1526,9 +1599,9 @@ def begin_create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedCluster", + parameters: _models.ManagedCluster, **kwargs: Any - ) -> LROPoller["_models.ManagedCluster"]: + ) -> LROPoller[_models.ManagedCluster]: """Creates or updates a managed cluster. Creates or updates a managed cluster. @@ -1553,37 +1626,47 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1600,17 +1683,20 @@ def _update_tags_initial( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.ManagedCluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + ) -> _models.ManagedCluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] _json = self._serialize.body(parameters, 'TagsObject') @@ -1622,11 +1708,13 @@ def _update_tags_initial( content_type=content_type, json=_json, template_url=self._update_tags_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1652,9 +1740,9 @@ def begin_update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> LROPoller["_models.ManagedCluster"]: + ) -> LROPoller[_models.ManagedCluster]: """Updates tags on a managed cluster. Updates tags on a managed cluster. @@ -1679,37 +1767,47 @@ def begin_update_tags( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_05_02_preview.models.ManagedCluster] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._update_tags_initial( + raw_result = self._update_tags_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, 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): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedCluster', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1729,13 +1827,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements ignore_pod_disruption_budget: Optional[bool] = None, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -1745,11 +1846,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements api_version=api_version, ignore_pod_disruption_budget=ignore_pod_disruption_budget, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1797,21 +1900,26 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, ignore_pod_disruption_budget=ignore_pod_disruption_budget, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1821,8 +1929,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1839,17 +1953,20 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') @@ -1861,11 +1978,13 @@ def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-re content_type=content_type, json=_json, template_url=self._reset_service_principal_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1887,7 +2006,7 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterServicePrincipalProfile", + parameters: _models.ManagedClusterServicePrincipalProfile, **kwargs: Any ) -> LROPoller[None]: """Reset the Service Principal Profile of a managed cluster. @@ -1913,23 +2032,28 @@ def begin_reset_service_principal_profile( # pylint: disable=inconsistent-retur :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._reset_service_principal_profile_initial( + raw_result = self._reset_service_principal_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1939,8 +2063,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1957,17 +2087,20 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') @@ -1979,11 +2112,13 @@ def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statement content_type=content_type, json=_json, template_url=self._reset_aad_profile_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2005,7 +2140,7 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, - parameters: "_models.ManagedClusterAADProfile", + parameters: _models.ManagedClusterAADProfile, **kwargs: Any ) -> LROPoller[None]: """Reset the AAD Profile of a managed cluster. @@ -2031,23 +2166,28 @@ def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._reset_aad_profile_initial( + raw_result = self._reset_aad_profile_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -2057,8 +2197,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2077,13 +2223,16 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_rotate_cluster_certificates_request_initial( @@ -2092,11 +2241,13 @@ def _rotate_cluster_certificates_initial( # pylint: disable=inconsistent-return resource_name=resource_name, api_version=api_version, template_url=self._rotate_cluster_certificates_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2141,20 +2292,25 @@ def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-st :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._rotate_cluster_certificates_initial( + raw_result = self._rotate_cluster_certificates_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) @@ -2164,8 +2320,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2184,13 +2346,16 @@ def _rotate_service_account_signing_keys_initial( # pylint: disable=inconsisten resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_rotate_service_account_signing_keys_request_initial( @@ -2199,11 +2364,13 @@ def _rotate_service_account_signing_keys_initial( # pylint: disable=inconsisten resource_name=resource_name, api_version=api_version, template_url=self._rotate_service_account_signing_keys_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2247,20 +2414,25 @@ def begin_rotate_service_account_signing_keys( # pylint: disable=inconsistent-r :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._rotate_service_account_signing_keys_initial( + raw_result = self._rotate_service_account_signing_keys_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) @@ -2270,8 +2442,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2290,13 +2468,16 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_stop_request_initial( @@ -2305,11 +2486,13 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_name, api_version=api_version, template_url=self._stop_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2357,20 +2540,25 @@ def begin_stop( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._stop_initial( + raw_result = self._stop_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) @@ -2380,8 +2568,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2400,13 +2594,16 @@ def _start_initial( # pylint: disable=inconsistent-return-statements resource_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_start_request_initial( @@ -2415,11 +2612,13 @@ def _start_initial( # pylint: disable=inconsistent-return-statements resource_name=resource_name, api_version=api_version, template_url=self._start_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2464,20 +2663,25 @@ def begin_start( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._start_initial( + raw_result = self._start_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) @@ -2487,8 +2691,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2505,17 +2715,20 @@ def _run_command_initial( self, resource_group_name: str, resource_name: str, - request_payload: "_models.RunCommandRequest", + request_payload: _models.RunCommandRequest, **kwargs: Any - ) -> Optional["_models.RunCommandResult"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RunCommandResult"]] + ) -> Optional[_models.RunCommandResult]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-05-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] _json = self._serialize.body(request_payload, 'RunCommandRequest') @@ -2527,11 +2740,13 @@ def _run_command_initial( content_type=content_type, json=_json, template_url=self._run_command_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2559,9 +2774,9 @@ def begin_run_command( self, resource_group_name: str, resource_name: str, - request_payload: "_models.RunCommandRequest", + request_payload: _models.RunCommandRequest, **kwargs: Any - ) -> LROPoller["_models.RunCommandResult"]: + ) -> LROPoller[_models.RunCommandResult]: """Submits a command to run against the Managed Cluster. AKS will create a pod to run the command. This is primarily useful for private clusters. For @@ -2589,37 +2804,47 @@ def begin_run_command( ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_05_02_preview.models.RunCommandResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.RunCommandResult] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandResult"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._run_command_initial( + raw_result = self._run_command_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, request_payload=request_payload, 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): - response = pipeline_response.http_response deserialized = self._deserialize('RunCommandResult', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -2639,7 +2864,7 @@ def get_command_result( resource_name: str, command_id: str, **kwargs: Any - ) -> Optional["_models.RunCommandResult"]: + ) -> Optional[_models.RunCommandResult]: """Gets the results of a command which has been run on the Managed Cluster. Gets the results of a command which has been run on the Managed Cluster. @@ -2655,13 +2880,16 @@ def get_command_result( :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.RunCommandResult or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RunCommandResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] request = build_get_command_result_request( @@ -2671,11 +2899,13 @@ def get_command_result( command_id=command_id, api_version=api_version, template_url=self.get_command_result.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -2704,7 +2934,7 @@ def list_outbound_network_dependencies_endpoints( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Iterable["_models.OutboundEnvironmentEndpointCollection"]: + ) -> Iterable[_models.OutboundEnvironmentEndpointCollection]: """Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. @@ -2722,13 +2952,16 @@ def list_outbound_network_dependencies_endpoints( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_05_02_preview.models.OutboundEnvironmentEndpointCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OutboundEnvironmentEndpointCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -2738,9 +2971,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=self.list_outbound_network_dependencies_endpoints.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -2750,9 +2985,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_operations.py index f9743e63a521..45e2408caa0b 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_operations.py @@ -16,6 +16,7 @@ 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 @@ -29,55 +30,54 @@ def build_list_request( **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.ContainerService/operations") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class Operations(object): - """Operations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_05_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_05_02_preview.ContainerServiceClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> Iterable["_models.OperationListResult"]: + ) -> Iterable[_models.OperationListResult]: """Gets a list of operations. Gets a list of operations. @@ -88,31 +88,38 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_05_02_preview.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_private_endpoint_connections_operations.py index ee93bba1976e..c7692bf4ebb1 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_private_endpoint_connections_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_private_endpoint_connections_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. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast from msrest import Serializer @@ -16,13 +16,13 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -34,9 +34,12 @@ def build_list_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections") # pylint: disable=line-too-long path_format_arguments = { @@ -48,18 +51,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -71,9 +72,12 @@ def build_get_request( private_endpoint_connection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -86,18 +90,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -108,14 +110,17 @@ def build_update_request( resource_name: str, private_endpoint_connection_name: str, *, - json: JSONType = None, + json: Optional[_models.PrivateEndpointConnection] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -128,20 +133,18 @@ def build_update_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -155,9 +158,12 @@ def build_delete_request_initial( private_endpoint_connection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -170,42 +176,38 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class PrivateEndpointConnectionsOperations(object): - """PrivateEndpointConnectionsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class PrivateEndpointConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_05_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_05_02_preview.ContainerServiceClient`'s + :attr:`private_endpoint_connections` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -213,7 +215,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnectionListResult": + ) -> _models.PrivateEndpointConnectionListResult: """Gets a list of private endpoint connections in the specified managed cluster. To learn more about private clusters, see: @@ -229,13 +231,16 @@ def list( ~azure.mgmt.containerservice.v2022_05_02_preview.models.PrivateEndpointConnectionListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] request = build_list_request( @@ -244,11 +249,13 @@ def list( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -276,7 +283,7 @@ def get( resource_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Gets the specified private endpoint connection. To learn more about private clusters, see: @@ -293,13 +300,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] request = build_get_request( @@ -309,11 +319,13 @@ def get( private_endpoint_connection_name=private_endpoint_connection_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -340,9 +352,9 @@ def update( resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - parameters: "_models.PrivateEndpointConnection", + parameters: _models.PrivateEndpointConnection, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Updates a private endpoint connection. Updates a private endpoint connection. @@ -361,14 +373,17 @@ def update( :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] _json = self._serialize.body(parameters, 'PrivateEndpointConnection') @@ -381,11 +396,13 @@ def update( content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -413,13 +430,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -429,11 +449,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements private_endpoint_connection_name=private_endpoint_connection_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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -480,21 +502,26 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -504,8 +531,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_private_link_resources_operations.py index 94744bc4bed6..572317396b70 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_private_link_resources_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_private_link_resources_operations.py @@ -15,6 +15,7 @@ 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 @@ -31,9 +32,12 @@ def build_list_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources") # pylint: disable=line-too-long path_format_arguments = { @@ -45,42 +49,38 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class PrivateLinkResourcesOperations(object): - """PrivateLinkResourcesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class PrivateLinkResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_05_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_05_02_preview.ContainerServiceClient`'s + :attr:`private_link_resources` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -88,7 +88,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.PrivateLinkResourcesListResult": + ) -> _models.PrivateLinkResourcesListResult: """Gets a list of private link resources in the specified managed cluster. To learn more about private clusters, see: @@ -103,13 +103,16 @@ def list( :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.PrivateLinkResourcesListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourcesListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] request = build_list_request( @@ -118,11 +121,13 @@ def list( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_resolve_private_link_service_id_operations.py index deb0e3b9adb2..51ac6e298378 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_resolve_private_link_service_id_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_resolve_private_link_service_id_operations.py @@ -15,12 +15,12 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -31,14 +31,17 @@ def build_post_request( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.PrivateLinkResource] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId") # pylint: disable=line-too-long path_format_arguments = { @@ -50,55 +53,51 @@ def build_post_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs ) -class ResolvePrivateLinkServiceIdOperations(object): - """ResolvePrivateLinkServiceIdOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ResolvePrivateLinkServiceIdOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_05_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_05_02_preview.ContainerServiceClient`'s + :attr:`resolve_private_link_service_id` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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 post( self, resource_group_name: str, resource_name: str, - parameters: "_models.PrivateLinkResource", + parameters: _models.PrivateLinkResource, **kwargs: Any - ) -> "_models.PrivateLinkResource": + ) -> _models.PrivateLinkResource: """Gets the private link service ID for the specified managed cluster. Gets the private link service ID for the specified managed cluster. @@ -114,14 +113,17 @@ def post( :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.PrivateLinkResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-05-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] _json = self._serialize.body(parameters, 'PrivateLinkResource') @@ -133,11 +135,13 @@ def post( content_type=content_type, json=_json, template_url=self.post.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_snapshots_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_snapshots_operations.py index db4d466c858c..29025aba01e3 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_snapshots_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_snapshots_operations.py @@ -16,12 +16,12 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -31,9 +31,12 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots") path_format_arguments = { @@ -43,18 +46,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -64,9 +65,12 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots") # pylint: disable=line-too-long path_format_arguments = { @@ -77,18 +81,16 @@ def build_list_by_resource_group_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -99,9 +101,12 @@ def build_get_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -113,18 +118,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -134,14 +137,17 @@ def build_create_or_update_request( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.Snapshot] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -153,20 +159,18 @@ def build_create_or_update_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -178,14 +182,17 @@ def build_update_tags_request( resource_group_name: str, resource_name: str, *, - json: JSONType = None, + json: Optional[_models.TagsObject] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -197,20 +204,18 @@ def build_update_tags_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -223,9 +228,12 @@ def build_delete_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}") # pylint: disable=line-too-long path_format_arguments = { @@ -237,48 +245,44 @@ def build_delete_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class SnapshotsOperations(object): - """SnapshotsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class SnapshotsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_05_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_05_02_preview.ContainerServiceClient`'s + :attr:`snapshots` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace def list( self, **kwargs: Any - ) -> Iterable["_models.SnapshotListResult"]: + ) -> Iterable[_models.SnapshotListResult]: """Gets a list of snapshots in the specified subscription. Gets a list of snapshots in the specified subscription. @@ -289,13 +293,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_05_02_preview.models.SnapshotListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -303,9 +310,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -313,9 +322,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -353,7 +364,7 @@ def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.SnapshotListResult"]: + ) -> Iterable[_models.SnapshotListResult]: """Lists snapshots in the specified subscription and resource group. Lists snapshots in the specified subscription and resource group. @@ -366,13 +377,16 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_05_02_preview.models.SnapshotListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -381,9 +395,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -392,9 +408,11 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -433,7 +451,7 @@ def get( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> "_models.Snapshot": + ) -> _models.Snapshot: """Gets a snapshot. Gets a snapshot. @@ -447,13 +465,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.Snapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] request = build_get_request( @@ -462,11 +483,13 @@ def get( resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -492,9 +515,9 @@ def create_or_update( self, resource_group_name: str, resource_name: str, - parameters: "_models.Snapshot", + parameters: _models.Snapshot, **kwargs: Any - ) -> "_models.Snapshot": + ) -> _models.Snapshot: """Creates or updates a snapshot. Creates or updates a snapshot. @@ -510,14 +533,17 @@ def create_or_update( :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.Snapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-05-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] _json = self._serialize.body(parameters, 'Snapshot') @@ -529,11 +555,13 @@ def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -563,9 +591,9 @@ def update_tags( self, resource_group_name: str, resource_name: str, - parameters: "_models.TagsObject", + parameters: _models.TagsObject, **kwargs: Any - ) -> "_models.Snapshot": + ) -> _models.Snapshot: """Updates tags on a snapshot. Updates tags on a snapshot. @@ -581,14 +609,17 @@ def update_tags( :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.Snapshot :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] _json = self._serialize.body(parameters, 'TagsObject') @@ -600,11 +631,13 @@ def update_tags( content_type=content_type, json=_json, template_url=self.update_tags.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -645,13 +678,16 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -660,11 +696,13 @@ def delete( # pylint: disable=inconsistent-return-statements resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_trusted_access_role_bindings_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_trusted_access_role_bindings_operations.py index 519273e6a3ee..2a390aa1b769 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_trusted_access_role_bindings_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_trusted_access_role_bindings_operations.py @@ -16,12 +16,12 @@ 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -33,9 +33,12 @@ def build_list_request( resource_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings") # pylint: disable=line-too-long path_format_arguments = { @@ -47,18 +50,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -70,9 +71,12 @@ def build_get_request( trusted_access_role_binding_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}") # pylint: disable=line-too-long path_format_arguments = { @@ -85,18 +89,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -107,14 +109,17 @@ def build_create_or_update_request( resource_name: str, trusted_access_role_binding_name: str, *, - json: JSONType = None, + json: Optional[_models.TrustedAccessRoleBinding] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}") # pylint: disable=line-too-long path_format_arguments = { @@ -127,20 +132,18 @@ def build_create_or_update_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -154,9 +157,12 @@ def build_delete_request( trusted_access_role_binding_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}") # pylint: disable=line-too-long path_format_arguments = { @@ -169,42 +175,38 @@ def build_delete_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class TrustedAccessRoleBindingsOperations(object): - """TrustedAccessRoleBindingsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class TrustedAccessRoleBindingsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_05_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_05_02_preview.ContainerServiceClient`'s + :attr:`trusted_access_role_bindings` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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( @@ -212,7 +214,7 @@ def list( resource_group_name: str, resource_name: str, **kwargs: Any - ) -> Iterable["_models.TrustedAccessRoleBindingListResult"]: + ) -> Iterable[_models.TrustedAccessRoleBindingListResult]: """List trusted access role bindings. List trusted access role bindings. @@ -228,13 +230,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_05_02_preview.models.TrustedAccessRoleBindingListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.TrustedAccessRoleBindingListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.TrustedAccessRoleBindingListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -244,9 +249,11 @@ def prepare_request(next_link=None): resource_name=resource_name, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -256,9 +263,11 @@ def prepare_request(next_link=None): resource_name=resource_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -298,7 +307,7 @@ def get( resource_name: str, trusted_access_role_binding_name: str, **kwargs: Any - ) -> "_models.TrustedAccessRoleBinding": + ) -> _models.TrustedAccessRoleBinding: """Get a trusted access role binding. Get a trusted access role binding. @@ -314,13 +323,16 @@ def get( :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.TrustedAccessRoleBinding :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.TrustedAccessRoleBinding"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.TrustedAccessRoleBinding] request = build_get_request( @@ -330,11 +342,13 @@ def get( trusted_access_role_binding_name=trusted_access_role_binding_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -361,9 +375,9 @@ def create_or_update( resource_group_name: str, resource_name: str, trusted_access_role_binding_name: str, - trusted_access_role_binding: "_models.TrustedAccessRoleBinding", + trusted_access_role_binding: _models.TrustedAccessRoleBinding, **kwargs: Any - ) -> "_models.TrustedAccessRoleBinding": + ) -> _models.TrustedAccessRoleBinding: """Create or update a trusted access role binding. Create or update a trusted access role binding. @@ -382,14 +396,17 @@ def create_or_update( :rtype: ~azure.mgmt.containerservice.v2022_05_02_preview.models.TrustedAccessRoleBinding :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.TrustedAccessRoleBinding"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2022-05-02-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.TrustedAccessRoleBinding] _json = self._serialize.body(trusted_access_role_binding, 'TrustedAccessRoleBinding') @@ -402,11 +419,13 @@ def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -450,13 +469,16 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -466,11 +488,13 @@ def delete( # pylint: disable=inconsistent-return-statements trusted_access_role_binding_name=trusted_access_role_binding_name, 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) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_trusted_access_roles_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_trusted_access_roles_operations.py index 2e8d83c170af..f0c912c6250f 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_trusted_access_roles_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_05_02_preview/operations/_trusted_access_roles_operations.py @@ -16,6 +16,7 @@ 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 @@ -31,9 +32,12 @@ def build_list_request( location: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/trustedAccessRoles") # pylint: disable=line-too-long path_format_arguments = { @@ -44,49 +48,45 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class TrustedAccessRolesOperations(object): - """TrustedAccessRolesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class TrustedAccessRolesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.containerservice.v2022_05_02_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_05_02_preview.ContainerServiceClient`'s + :attr:`trusted_access_roles` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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, location: str, **kwargs: Any - ) -> Iterable["_models.TrustedAccessRoleListResult"]: + ) -> Iterable[_models.TrustedAccessRoleListResult]: """List supported trusted access roles. List supported trusted access roles. @@ -100,13 +100,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_05_02_preview.models.TrustedAccessRoleListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-05-02-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.TrustedAccessRoleListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.TrustedAccessRoleListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -115,9 +118,11 @@ def prepare_request(next_link=None): location=location, 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) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -126,9 +131,11 @@ def prepare_request(next_link=None): location=location, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/__init__.py new file mode 100644 index 000000000000..37a5f9e02e6f --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/__init__.py @@ -0,0 +1,20 @@ +# 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 ._container_service_client import ContainerServiceClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk +__all__ = ['ContainerServiceClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/_configuration.py new file mode 100644 index 000000000000..0ea5a338f54d --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/_configuration.py @@ -0,0 +1,72 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + +VERSION = "unknown" + +class ContainerServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes + """Configuration for ContainerServiceClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :keyword api_version: Api Version. Default value is "2022-06-02-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(ContainerServiceClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2022-06-02-preview") # type: str + + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = api_version + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-containerservice/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs # type: Any + ): + # type: (...) -> None + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/_container_service_client.py new file mode 100644 index 000000000000..8f81cd2f2002 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/_container_service_client.py @@ -0,0 +1,170 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from copy import deepcopy +from typing import Any, TYPE_CHECKING + +from msrest import Deserializer, Serializer + +from azure.core.rest import HttpRequest, HttpResponse +from azure.mgmt.core import ARMPipelineClient + +from . import models +from ._configuration import ContainerServiceClientConfiguration +from .operations import AgentPoolsOperations, FleetMembersOperations, FleetsOperations, MaintenanceConfigurationsOperations, ManagedClusterSnapshotsOperations, ManagedClustersOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, ResolvePrivateLinkServiceIdOperations, SnapshotsOperations, TrustedAccessRoleBindingsOperations, TrustedAccessRolesOperations + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + +class ContainerServiceClient: # pylint: disable=too-many-instance-attributes + """The Container Service Client. + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.containerservice.v2022_06_02_preview.operations.Operations + :ivar managed_clusters: ManagedClustersOperations operations + :vartype managed_clusters: + azure.mgmt.containerservice.v2022_06_02_preview.operations.ManagedClustersOperations + :ivar maintenance_configurations: MaintenanceConfigurationsOperations operations + :vartype maintenance_configurations: + azure.mgmt.containerservice.v2022_06_02_preview.operations.MaintenanceConfigurationsOperations + :ivar agent_pools: AgentPoolsOperations operations + :vartype agent_pools: + azure.mgmt.containerservice.v2022_06_02_preview.operations.AgentPoolsOperations + :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations + :vartype private_endpoint_connections: + azure.mgmt.containerservice.v2022_06_02_preview.operations.PrivateEndpointConnectionsOperations + :ivar private_link_resources: PrivateLinkResourcesOperations operations + :vartype private_link_resources: + azure.mgmt.containerservice.v2022_06_02_preview.operations.PrivateLinkResourcesOperations + :ivar resolve_private_link_service_id: ResolvePrivateLinkServiceIdOperations operations + :vartype resolve_private_link_service_id: + azure.mgmt.containerservice.v2022_06_02_preview.operations.ResolvePrivateLinkServiceIdOperations + :ivar snapshots: SnapshotsOperations operations + :vartype snapshots: + azure.mgmt.containerservice.v2022_06_02_preview.operations.SnapshotsOperations + :ivar managed_cluster_snapshots: ManagedClusterSnapshotsOperations operations + :vartype managed_cluster_snapshots: + azure.mgmt.containerservice.v2022_06_02_preview.operations.ManagedClusterSnapshotsOperations + :ivar trusted_access_roles: TrustedAccessRolesOperations operations + :vartype trusted_access_roles: + azure.mgmt.containerservice.v2022_06_02_preview.operations.TrustedAccessRolesOperations + :ivar trusted_access_role_bindings: TrustedAccessRoleBindingsOperations operations + :vartype trusted_access_role_bindings: + azure.mgmt.containerservice.v2022_06_02_preview.operations.TrustedAccessRoleBindingsOperations + :ivar fleets: FleetsOperations operations + :vartype fleets: azure.mgmt.containerservice.v2022_06_02_preview.operations.FleetsOperations + :ivar fleet_members: FleetMembersOperations operations + :vartype fleet_members: + azure.mgmt.containerservice.v2022_06_02_preview.operations.FleetMembersOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :param base_url: Service URL. Default value is "https://management.azure.com". + :type base_url: str + :keyword api_version: Api Version. Default value is "2022-06-02-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 + Retry-After header is present. + """ + + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = ContainerServiceClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_clusters = ManagedClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.maintenance_configurations = MaintenanceConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.agent_pools = AgentPoolsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.snapshots = SnapshotsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_cluster_snapshots = ManagedClusterSnapshotsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.trusted_access_roles = TrustedAccessRolesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.trusted_access_role_bindings = TrustedAccessRoleBindingsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.fleets = FleetsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.fleet_members = FleetMembersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> HttpResponse: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.HttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> ContainerServiceClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/_metadata.json b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/_metadata.json new file mode 100644 index 000000000000..61189e278164 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/_metadata.json @@ -0,0 +1,114 @@ +{ + "chosen_version": "2022-06-02-preview", + "total_api_version_list": ["2022-06-02-preview"], + "client": { + "name": "ContainerServiceClient", + "filename": "_container_service_client", + "description": "The Container Service Client.", + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, + "azure_arm": true, + "has_lro_operations": true, + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerServiceClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + }, + "global_parameters": { + "sync": { + "credential": { + "signature": "credential, # type: \"TokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id, # type: str", + "description": "The ID of the target subscription.", + "docstring_type": "str", + "required": true + } + }, + "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id: str,", + "description": "The ID of the target subscription.", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, subscription_id", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=\"https://management.azure.com\", # type: str", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: str = \"https://management.azure.com\",", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } + }, + "config": { + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "operation_groups": { + "operations": "Operations", + "managed_clusters": "ManagedClustersOperations", + "maintenance_configurations": "MaintenanceConfigurationsOperations", + "agent_pools": "AgentPoolsOperations", + "private_endpoint_connections": "PrivateEndpointConnectionsOperations", + "private_link_resources": "PrivateLinkResourcesOperations", + "resolve_private_link_service_id": "ResolvePrivateLinkServiceIdOperations", + "snapshots": "SnapshotsOperations", + "managed_cluster_snapshots": "ManagedClusterSnapshotsOperations", + "trusted_access_roles": "TrustedAccessRolesOperations", + "trusted_access_role_bindings": "TrustedAccessRoleBindingsOperations", + "fleets": "FleetsOperations", + "fleet_members": "FleetMembersOperations" + } +} \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/_vendor.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/__init__.py new file mode 100644 index 000000000000..37a5f9e02e6f --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/__init__.py @@ -0,0 +1,20 @@ +# 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 ._container_service_client import ContainerServiceClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk +__all__ = ['ContainerServiceClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/_configuration.py new file mode 100644 index 000000000000..e84eaf42ba4d --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/_configuration.py @@ -0,0 +1,71 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +VERSION = "unknown" + +class ContainerServiceClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes + """Configuration for ContainerServiceClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :keyword api_version: Api Version. Default value is "2022-06-02-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(ContainerServiceClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2022-06-02-preview") # type: str + + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = api_version + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-containerservice/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/_container_service_client.py new file mode 100644 index 000000000000..92f54272638e --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/_container_service_client.py @@ -0,0 +1,168 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from copy import deepcopy +from typing import Any, Awaitable, TYPE_CHECKING + +from msrest import Deserializer, Serializer + +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient + +from .. import models +from ._configuration import ContainerServiceClientConfiguration +from .operations import AgentPoolsOperations, FleetMembersOperations, FleetsOperations, MaintenanceConfigurationsOperations, ManagedClusterSnapshotsOperations, ManagedClustersOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, ResolvePrivateLinkServiceIdOperations, SnapshotsOperations, TrustedAccessRoleBindingsOperations, TrustedAccessRolesOperations + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +class ContainerServiceClient: # pylint: disable=too-many-instance-attributes + """The Container Service Client. + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.containerservice.v2022_06_02_preview.aio.operations.Operations + :ivar managed_clusters: ManagedClustersOperations operations + :vartype managed_clusters: + azure.mgmt.containerservice.v2022_06_02_preview.aio.operations.ManagedClustersOperations + :ivar maintenance_configurations: MaintenanceConfigurationsOperations operations + :vartype maintenance_configurations: + azure.mgmt.containerservice.v2022_06_02_preview.aio.operations.MaintenanceConfigurationsOperations + :ivar agent_pools: AgentPoolsOperations operations + :vartype agent_pools: + azure.mgmt.containerservice.v2022_06_02_preview.aio.operations.AgentPoolsOperations + :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations + :vartype private_endpoint_connections: + azure.mgmt.containerservice.v2022_06_02_preview.aio.operations.PrivateEndpointConnectionsOperations + :ivar private_link_resources: PrivateLinkResourcesOperations operations + :vartype private_link_resources: + azure.mgmt.containerservice.v2022_06_02_preview.aio.operations.PrivateLinkResourcesOperations + :ivar resolve_private_link_service_id: ResolvePrivateLinkServiceIdOperations operations + :vartype resolve_private_link_service_id: + azure.mgmt.containerservice.v2022_06_02_preview.aio.operations.ResolvePrivateLinkServiceIdOperations + :ivar snapshots: SnapshotsOperations operations + :vartype snapshots: + azure.mgmt.containerservice.v2022_06_02_preview.aio.operations.SnapshotsOperations + :ivar managed_cluster_snapshots: ManagedClusterSnapshotsOperations operations + :vartype managed_cluster_snapshots: + azure.mgmt.containerservice.v2022_06_02_preview.aio.operations.ManagedClusterSnapshotsOperations + :ivar trusted_access_roles: TrustedAccessRolesOperations operations + :vartype trusted_access_roles: + azure.mgmt.containerservice.v2022_06_02_preview.aio.operations.TrustedAccessRolesOperations + :ivar trusted_access_role_bindings: TrustedAccessRoleBindingsOperations operations + :vartype trusted_access_role_bindings: + azure.mgmt.containerservice.v2022_06_02_preview.aio.operations.TrustedAccessRoleBindingsOperations + :ivar fleets: FleetsOperations operations + :vartype fleets: + azure.mgmt.containerservice.v2022_06_02_preview.aio.operations.FleetsOperations + :ivar fleet_members: FleetMembersOperations operations + :vartype fleet_members: + azure.mgmt.containerservice.v2022_06_02_preview.aio.operations.FleetMembersOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :param base_url: Service URL. Default value is "https://management.azure.com". + :type base_url: str + :keyword api_version: Api Version. Default value is "2022-06-02-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 + Retry-After header is present. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = ContainerServiceClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_clusters = ManagedClustersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.maintenance_configurations = MaintenanceConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.agent_pools = AgentPoolsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.resolve_private_link_service_id = ResolvePrivateLinkServiceIdOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.snapshots = SnapshotsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_cluster_snapshots = ManagedClusterSnapshotsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.trusted_access_roles = TrustedAccessRolesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.trusted_access_role_bindings = TrustedAccessRoleBindingsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.fleets = FleetsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.fleet_members = FleetMembersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.AsyncHttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "ContainerServiceClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/__init__.py new file mode 100644 index 000000000000..03d015afec25 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/__init__.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._operations import Operations +from ._managed_clusters_operations import ManagedClustersOperations +from ._maintenance_configurations_operations import MaintenanceConfigurationsOperations +from ._agent_pools_operations import AgentPoolsOperations +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations +from ._private_link_resources_operations import PrivateLinkResourcesOperations +from ._resolve_private_link_service_id_operations import ResolvePrivateLinkServiceIdOperations +from ._snapshots_operations import SnapshotsOperations +from ._managed_cluster_snapshots_operations import ManagedClusterSnapshotsOperations +from ._trusted_access_roles_operations import TrustedAccessRolesOperations +from ._trusted_access_role_bindings_operations import TrustedAccessRoleBindingsOperations +from ._fleets_operations import FleetsOperations +from ._fleet_members_operations import FleetMembersOperations + +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk +__all__ = [ + 'Operations', + 'ManagedClustersOperations', + 'MaintenanceConfigurationsOperations', + 'AgentPoolsOperations', + 'PrivateEndpointConnectionsOperations', + 'PrivateLinkResourcesOperations', + 'ResolvePrivateLinkServiceIdOperations', + 'SnapshotsOperations', + 'ManagedClusterSnapshotsOperations', + 'TrustedAccessRolesOperations', + 'TrustedAccessRoleBindingsOperations', + 'FleetsOperations', + 'FleetMembersOperations', +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_agent_pools_operations.py new file mode 100644 index 000000000000..4bb851949e2a --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_agent_pools_operations.py @@ -0,0 +1,776 @@ +# 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, Union, cast + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +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._agent_pools_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_available_agent_pool_versions_request, build_get_request, build_get_upgrade_profile_request, build_list_request, build_upgrade_node_image_version_request_initial +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class AgentPoolsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_06_02_preview.aio.ContainerServiceClient`'s + :attr:`agent_pools` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + + @distributed_trace + def list( + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> AsyncIterable[_models.AgentPoolListResult]: + """Gets a list of agent pools in the specified managed cluster. + + Gets a list of agent pools in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AgentPoolListResult or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_06_02_preview.models.AgentPoolListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + 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) # type: ignore + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + api_version=api_version, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("AgentPoolListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + **kwargs: Any + ) -> _models.AgentPool: + """Gets the specified managed cluster agent pool. + + Gets the specified managed cluster agent pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. + :type agent_pool_name: 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.containerservice.v2022_06_02_preview.models.AgentPool + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + agent_pool_name=agent_pool_name, + 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) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AgentPool', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + + + async def _create_or_update_initial( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: _models.AgentPool, + **kwargs: Any + ) -> _models.AgentPool: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + + _json = self._serialize.body(parameters, 'AgentPool') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + agent_pool_name=agent_pool_name, + api_version=api_version, + content_type=content_type, + json=_json, + 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) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('AgentPool', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('AgentPool', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: _models.AgentPool, + **kwargs: Any + ) -> AsyncLROPoller[_models.AgentPool]: + """Creates or updates an agent pool in the specified managed cluster. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. + :type agent_pool_name: str + :param parameters: The agent pool to create or update. + :type parameters: ~azure.mgmt.containerservice.v2022_06_02_preview.models.AgentPool + :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 AgentPool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_06_02_preview.models.AgentPool] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + agent_pool_name=agent_pool_name, + parameters=parameters, + 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('AgentPool', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + 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) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + ignore_pod_disruption_budget: Optional[bool] = None, + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + agent_pool_name=agent_pool_name, + api_version=api_version, + ignore_pod_disruption_budget=ignore_pod_disruption_budget, + template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + ignore_pod_disruption_budget: Optional[bool] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes an agent pool in the specified managed cluster. + + Deletes an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. + :type agent_pool_name: str + :param ignore_pod_disruption_budget: ignore-pod-disruption-budget=true to delete those pods on + a node without considering Pod Disruption Budget. Default value is None. + :type ignore_pod_disruption_budget: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + agent_pool_name=agent_pool_name, + ignore_pod_disruption_budget=ignore_pod_disruption_budget, + 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): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + 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) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + + @distributed_trace_async + async def get_upgrade_profile( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + **kwargs: Any + ) -> _models.AgentPoolUpgradeProfile: + """Gets the upgrade profile for an agent pool. + + Gets the upgrade profile for an agent pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. + :type agent_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AgentPoolUpgradeProfile, or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.AgentPoolUpgradeProfile + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] + + + request = build_get_upgrade_profile_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + agent_pool_name=agent_pool_name, + 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) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AgentPoolUpgradeProfile', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore + + + @distributed_trace_async + async def get_available_agent_pool_versions( + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> _models.AgentPoolAvailableVersions: + """Gets a list of supported Kubernetes versions for the specified agent pool. + + See `supported Kubernetes versions + `_ for more details about + the version lifecycle. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AgentPoolAvailableVersions, or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.AgentPoolAvailableVersions + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] + + + request = build_get_available_agent_pool_versions_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + api_version=api_version, + template_url=self.get_available_agent_pool_versions.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AgentPoolAvailableVersions', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_available_agent_pool_versions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore + + + async def _upgrade_node_image_version_initial( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + **kwargs: Any + ) -> Optional[_models.AgentPool]: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] + + + request = build_upgrade_node_image_version_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + agent_pool_name=agent_pool_name, + api_version=api_version, + template_url=self._upgrade_node_image_version_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 202: + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + + deserialized = self._deserialize('AgentPool', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _upgrade_node_image_version_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore + + + @distributed_trace_async + async def begin_upgrade_node_image_version( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + **kwargs: Any + ) -> AsyncLROPoller[_models.AgentPool]: + """Upgrades the node image version of an agent pool to the latest. + + Upgrading the node image version of an agent pool applies the newest OS and runtime updates to + the nodes. AKS provides one new image per week with the latest updates. For more details on + node image versions, see: https://docs.microsoft.com/azure/aks/node-image-upgrade. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. + :type agent_pool_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 AgentPool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_06_02_preview.models.AgentPool] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._upgrade_node_image_version_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + 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): + response_headers = {} + response = pipeline_response.http_response + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + + deserialized = self._deserialize('AgentPool', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, response_headers) + return deserialized + + + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + 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) + + begin_upgrade_node_image_version.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_fleet_members_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_fleet_members_operations.py new file mode 100644 index 000000000000..5fde699706da --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_fleet_members_operations.py @@ -0,0 +1,511 @@ +# 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, Union, cast + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +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._fleet_members_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_fleet_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class FleetMembersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_06_02_preview.aio.ContainerServiceClient`'s + :attr:`fleet_members` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + + async def _create_or_update_initial( + self, + resource_group_name: str, + fleet_name: str, + fleet_member_name: str, + parameters: _models.FleetMember, + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + **kwargs: Any + ) -> _models.FleetMember: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.FleetMember] + + _json = self._serialize.body(parameters, 'FleetMember') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + fleet_name=fleet_name, + fleet_member_name=fleet_member_name, + api_version=api_version, + content_type=content_type, + json=_json, + if_match=if_match, + if_none_match=if_none_match, + 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) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('FleetMember', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}"} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + fleet_name: str, + fleet_member_name: str, + parameters: _models.FleetMember, + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.FleetMember]: + """Creates or updates a fleet member. + + A member contains a reference to an existing Kubernetes cluster. Creating a member makes the + referenced cluster join the Fleet. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. + :type fleet_name: str + :param fleet_member_name: The name of the Fleet member resource. + :type fleet_member_name: str + :param parameters: The Fleet member to create or update. + :type parameters: ~azure.mgmt.containerservice.v2022_06_02_preview.models.FleetMember + :param if_match: Omit this value to always overwrite the current resource. Specify the + last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is + None. + :type if_match: str + :param if_none_match: Set to '*' to allow a new resource to be created and prevent updating an + existing resource. Other values will result in a 412 Pre-condition Failed response. Default + value is None. + :type if_none_match: 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 FleetMember or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_06_02_preview.models.FleetMember] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.FleetMember] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( # type: ignore + resource_group_name=resource_group_name, + fleet_name=fleet_name, + fleet_member_name=fleet_member_name, + parameters=parameters, + if_match=if_match, + if_none_match=if_none_match, + 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('FleetMember', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + 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) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}"} # type: ignore + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + fleet_name: str, + fleet_member_name: str, + **kwargs: Any + ) -> _models.FleetMember: + """Gets a Fleet member. + + Gets a Fleet member. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. + :type fleet_name: str + :param fleet_member_name: The name of the Fleet member resource. + :type fleet_member_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FleetMember, or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.FleetMember + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.FleetMember] + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + fleet_name=fleet_name, + fleet_member_name=fleet_member_name, + 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) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # 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('FleetMember', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}"} # type: ignore + + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + fleet_name: str, + fleet_member_name: str, + if_match: Optional[str] = None, + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + fleet_name=fleet_name, + fleet_member_name=fleet_member_name, + api_version=api_version, + if_match=if_match, + template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}"} # type: ignore + + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + fleet_name: str, + fleet_member_name: str, + if_match: Optional[str] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a fleet member. + + Deleting a Fleet member results in the member cluster leaving fleet. The Member azure resource + is deleted upon success. The underlying cluster is not deleted. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. + :type fleet_name: str + :param fleet_member_name: The name of the Fleet member resource. + :type fleet_member_name: str + :param if_match: Omit this value to always overwrite the current resource. Specify the + last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is + None. + :type if_match: 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + fleet_name=fleet_name, + fleet_member_name=fleet_member_name, + if_match=if_match, + 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): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + 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) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}"} # type: ignore + + @distributed_trace + def list_by_fleet( + self, + resource_group_name: str, + fleet_name: str, + **kwargs: Any + ) -> AsyncIterable[_models.FleetMembersListResult]: + """Lists the members of a fleet. + + Lists the members of a fleet. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. + :type fleet_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either FleetMembersListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_06_02_preview.models.FleetMembersListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.FleetMembersListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_fleet_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + fleet_name=fleet_name, + api_version=api_version, + template_url=self.list_by_fleet.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + + request = build_list_by_fleet_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + fleet_name=fleet_name, + api_version=api_version, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("FleetMembersListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # 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_fleet.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_fleets_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_fleets_operations.py new file mode 100644 index 000000000000..b7501a4f5ea5 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_fleets_operations.py @@ -0,0 +1,720 @@ +# 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, Union, cast + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +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._fleets_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_resource_group_request, build_list_credentials_request, build_list_request, build_update_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class FleetsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_06_02_preview.aio.ContainerServiceClient`'s + :attr:`fleets` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + + async def _create_or_update_initial( + self, + resource_group_name: str, + fleet_name: str, + parameters: _models.Fleet, + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + **kwargs: Any + ) -> _models.Fleet: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Fleet] + + _json = self._serialize.body(parameters, 'Fleet') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + fleet_name=fleet_name, + api_version=api_version, + content_type=content_type, + json=_json, + if_match=if_match, + if_none_match=if_none_match, + 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) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Fleet', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Fleet', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}"} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + fleet_name: str, + parameters: _models.Fleet, + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.Fleet]: + """Creates or updates a Fleet. + + Creates or updates a Fleet. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. + :type fleet_name: str + :param parameters: The Fleet to create or update. + :type parameters: ~azure.mgmt.containerservice.v2022_06_02_preview.models.Fleet + :param if_match: Omit this value to always overwrite the current resource. Specify the + last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is + None. + :type if_match: str + :param if_none_match: Set to '*' to allow a new resource to be created and prevent updating an + existing resource. Other values will result in a 412 Pre-condition Failed response. Default + value is None. + :type if_none_match: 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 Fleet or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_06_02_preview.models.Fleet] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Fleet] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( # type: ignore + resource_group_name=resource_group_name, + fleet_name=fleet_name, + parameters=parameters, + if_match=if_match, + if_none_match=if_none_match, + 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('Fleet', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + 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) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}"} # type: ignore + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + fleet_name: str, + if_match: Optional[str] = None, + parameters: Optional[_models.FleetPatch] = None, + **kwargs: Any + ) -> _models.Fleet: + """Patches a fleet resource. + + Patches a fleet resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. + :type fleet_name: str + :param if_match: Omit this value to always overwrite the current resource. Specify the + last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is + None. + :type if_match: str + :param parameters: The properties of a Fleet to update. Default value is None. + :type parameters: ~azure.mgmt.containerservice.v2022_06_02_preview.models.FleetPatch + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Fleet, or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.Fleet + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Fleet] + + if parameters is not None: + _json = self._serialize.body(parameters, 'FleetPatch') + else: + _json = None + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + fleet_name=fleet_name, + api_version=api_version, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.update.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # 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('Fleet', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}"} # type: ignore + + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + fleet_name: str, + **kwargs: Any + ) -> _models.Fleet: + """Gets a Fleet. + + Gets a Fleet. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. + :type fleet_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Fleet, or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.Fleet + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Fleet] + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + fleet_name=fleet_name, + 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) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # 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('Fleet', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}"} # type: ignore + + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + fleet_name: str, + if_match: Optional[str] = None, + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + fleet_name=fleet_name, + api_version=api_version, + if_match=if_match, + template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}"} # type: ignore + + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + fleet_name: str, + if_match: Optional[str] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a Fleet. + + Deletes a Fleet. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. + :type fleet_name: str + :param if_match: Omit this value to always overwrite the current resource. Specify the + last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is + None. + :type if_match: 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + fleet_name=fleet_name, + if_match=if_match, + 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): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + 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) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}"} # type: ignore + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable[_models.FleetListResult]: + """Lists fleets in the specified subscription and resource group. + + Lists fleets in the specified subscription and resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either FleetListResult or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_06_02_preview.models.FleetListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.FleetListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + 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) # type: ignore + + else: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("FleetListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # 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.ContainerService/fleets"} # type: ignore + + @distributed_trace + def list( + self, + **kwargs: Any + ) -> AsyncIterable[_models.FleetListResult]: + """Lists fleets in the specified subscription. + + Lists fleets in the specified subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either FleetListResult or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_06_02_preview.models.FleetListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.FleetListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("FleetListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # 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.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/fleets"} # type: ignore + + @distributed_trace_async + async def list_credentials( + self, + resource_group_name: str, + fleet_name: str, + **kwargs: Any + ) -> _models.FleetCredentialResults: + """Lists the user credentials of a Fleet. + + Lists the user credentials of a Fleet. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. + :type fleet_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FleetCredentialResults, or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.FleetCredentialResults + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.FleetCredentialResults] + + + request = build_list_credentials_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + fleet_name=fleet_name, + api_version=api_version, + template_url=self.list_credentials.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # 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('FleetCredentialResults', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/listCredentials"} # type: ignore + diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_maintenance_configurations_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_maintenance_configurations_operations.py new file mode 100644 index 000000000000..92b8694edde0 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_maintenance_configurations_operations.py @@ -0,0 +1,348 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._maintenance_configurations_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_managed_cluster_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class MaintenanceConfigurationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_06_02_preview.aio.ContainerServiceClient`'s + :attr:`maintenance_configurations` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + + @distributed_trace + def list_by_managed_cluster( + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> AsyncIterable[_models.MaintenanceConfigurationListResult]: + """Gets a list of maintenance configurations in the specified managed cluster. + + Gets a list of maintenance configurations in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either MaintenanceConfigurationListResult or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_06_02_preview.models.MaintenanceConfigurationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfigurationListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_managed_cluster_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + api_version=api_version, + template_url=self.list_by_managed_cluster.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + + request = build_list_by_managed_cluster_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + api_version=api_version, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("MaintenanceConfigurationListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_managed_cluster.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations"} # type: ignore + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Gets the specified maintenance configuration of a managed cluster. + + Gets the specified maintenance configuration of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :type resource_name: str + :param config_name: The name of the maintenance configuration. + :type config_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration, or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.MaintenanceConfiguration + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + config_name=config_name, + 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) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore + + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: _models.MaintenanceConfiguration, + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configuration in the specified managed cluster. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :type resource_name: str + :param config_name: The name of the maintenance configuration. + :type config_name: str + :param parameters: The maintenance configuration to create or update. + :type parameters: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.MaintenanceConfiguration + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration, or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.MaintenanceConfiguration + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] + + _json = self._serialize.body(parameters, 'MaintenanceConfiguration') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + config_name=config_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore + + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + resource_name: str, + config_name: str, + **kwargs: Any + ) -> None: + """Deletes a maintenance configuration. + + Deletes a maintenance configuration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :type resource_name: str + :param config_name: The name of the maintenance configuration. + :type config_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 + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + config_name=config_name, + 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) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore + diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_managed_cluster_snapshots_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_managed_cluster_snapshots_operations.py new file mode 100644 index 000000000000..b7703f90f601 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_managed_cluster_snapshots_operations.py @@ -0,0 +1,489 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._managed_cluster_snapshots_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_resource_group_request, build_list_request, build_update_tags_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ManagedClusterSnapshotsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_06_02_preview.aio.ContainerServiceClient`'s + :attr:`managed_cluster_snapshots` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + + @distributed_trace + def list( + self, + **kwargs: Any + ) -> AsyncIterable[_models.ManagedClusterSnapshotListResult]: + """Gets a list of managed cluster snapshots in the specified subscription. + + Gets a list of managed cluster snapshots in the specified subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ManagedClusterSnapshotListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterSnapshotListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshotListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ManagedClusterSnapshotListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedclustersnapshots"} # type: ignore + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable[_models.ManagedClusterSnapshotListResult]: + """Lists managed cluster snapshots in the specified subscription and resource group. + + Lists managed cluster snapshots in the specified subscription and resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ManagedClusterSnapshotListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterSnapshotListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshotListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + 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) # type: ignore + + else: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ManagedClusterSnapshotListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots"} # type: ignore + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> _models.ManagedClusterSnapshot: + """Gets a managed cluster snapshot. + + Gets a managed cluster snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedClusterSnapshot, or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterSnapshot + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshot] + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + 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) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ManagedClusterSnapshot', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore + + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.ManagedClusterSnapshot, + **kwargs: Any + ) -> _models.ManagedClusterSnapshot: + """Creates or updates a managed cluster snapshot. + + Creates or updates a managed cluster snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :type resource_name: str + :param parameters: The managed cluster snapshot to create or update. + :type parameters: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterSnapshot + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedClusterSnapshot, or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterSnapshot + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshot] + + _json = self._serialize.body(parameters, 'ManagedClusterSnapshot') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ManagedClusterSnapshot', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ManagedClusterSnapshot', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore + + + @distributed_trace_async + async def update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.TagsObject, + **kwargs: Any + ) -> _models.ManagedClusterSnapshot: + """Updates tags on a managed cluster snapshot. + + Updates tags on a managed cluster snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :type resource_name: str + :param parameters: Parameters supplied to the Update managed cluster snapshot Tags operation. + :type parameters: ~azure.mgmt.containerservice.v2022_06_02_preview.models.TagsObject + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedClusterSnapshot, or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterSnapshot + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshot] + + _json = self._serialize.body(parameters, 'TagsObject') + + request = build_update_tags_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update_tags.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ManagedClusterSnapshot', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore + + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> None: + """Deletes a managed cluster snapshot. + + Deletes a managed cluster snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :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 + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + 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) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore + diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_managed_clusters_operations.py new file mode 100644 index 000000000000..1af3f180a768 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_managed_clusters_operations.py @@ -0,0 +1,2185 @@ +# 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, Union, cast + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +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._managed_clusters_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_access_profile_request, build_get_command_result_request, build_get_os_options_request, build_get_request, build_get_upgrade_profile_request, build_list_by_resource_group_request, build_list_cluster_admin_credentials_request, build_list_cluster_monitoring_user_credentials_request, build_list_cluster_user_credentials_request, build_list_outbound_network_dependencies_endpoints_request, build_list_request, build_reset_aad_profile_request_initial, build_reset_service_principal_profile_request_initial, build_rotate_cluster_certificates_request_initial, build_rotate_service_account_signing_keys_request_initial, build_run_command_request_initial, build_start_request_initial, build_stop_request_initial, build_update_tags_request_initial +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ManagedClustersOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_06_02_preview.aio.ContainerServiceClient`'s + :attr:`managed_clusters` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + + @distributed_trace_async + async def get_os_options( + self, + location: str, + resource_type: Optional[str] = None, + **kwargs: Any + ) -> _models.OSOptionProfile: + """Gets supported OS options in the specified subscription. + + Gets supported OS options in the specified subscription. + + :param location: The name of Azure region. + :type location: str + :param resource_type: The resource type for which the OS options needs to be returned. Default + value is None. + :type resource_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: OSOptionProfile, or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.OSOptionProfile + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OSOptionProfile] + + + request = build_get_os_options_request( + subscription_id=self._config.subscription_id, + location=location, + api_version=api_version, + resource_type=resource_type, + template_url=self.get_os_options.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('OSOptionProfile', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_os_options.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default"} # type: ignore + + + @distributed_trace + def list( + self, + **kwargs: Any + ) -> AsyncIterable[_models.ManagedClusterListResult]: + """Gets a list of managed clusters in the specified subscription. + + Gets a list of managed clusters in the specified subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ManagedClusterListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ManagedClusterListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable[_models.ManagedClusterListResult]: + """Lists managed clusters in the specified subscription and resource group. + + Lists managed clusters in the specified subscription and resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ManagedClusterListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + 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) # type: ignore + + else: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ManagedClusterListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + + @distributed_trace_async + async def get_upgrade_profile( + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> _models.ManagedClusterUpgradeProfile: + """Gets the upgrade profile of a managed cluster. + + Gets the upgrade profile of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedClusterUpgradeProfile, or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterUpgradeProfile + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] + + + request = build_get_upgrade_profile_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + 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) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ManagedClusterUpgradeProfile', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore + + + @distributed_trace_async + async def get_access_profile( + self, + resource_group_name: str, + resource_name: str, + role_name: str, + **kwargs: Any + ) -> _models.ManagedClusterAccessProfile: + """Gets an access profile of a managed cluster. + + **WARNING**\ : This API will be deprecated. Instead use `ListClusterUserCredentials + `_ or + `ListClusterAdminCredentials + `_ . + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :type resource_name: str + :param role_name: The name of the role for managed cluster accessProfile resource. + :type role_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedClusterAccessProfile, or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterAccessProfile + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] + + + request = build_get_access_profile_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + role_name=role_name, + api_version=api_version, + template_url=self.get_access_profile.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ManagedClusterAccessProfile', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_access_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore + + + @distributed_trace_async + async def list_cluster_admin_credentials( + self, + resource_group_name: str, + resource_name: str, + server_fqdn: Optional[str] = None, + **kwargs: Any + ) -> _models.CredentialResults: + """Lists the admin credentials of a managed cluster. + + Lists the admin credentials of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :type resource_name: str + :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. + :type server_fqdn: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CredentialResults, or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.CredentialResults + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + + + request = build_list_cluster_admin_credentials_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + api_version=api_version, + server_fqdn=server_fqdn, + template_url=self.list_cluster_admin_credentials.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CredentialResults', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_cluster_admin_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore + + + @distributed_trace_async + async def list_cluster_user_credentials( + self, + resource_group_name: str, + resource_name: str, + server_fqdn: Optional[str] = None, + format: Optional[Union[str, "_models.Format"]] = None, + **kwargs: Any + ) -> _models.CredentialResults: + """Lists the user credentials of a managed cluster. + + Lists the user credentials of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :type resource_name: str + :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. + :type server_fqdn: str + :param format: Only apply to AAD clusters, specifies the format of returned kubeconfig. Format + 'azure' will return azure auth-provider kubeconfig; format 'exec' will return exec format + kubeconfig, which requires kubelogin binary in the path. Default value is None. + :type format: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.Format + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CredentialResults, or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.CredentialResults + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + + + request = build_list_cluster_user_credentials_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + api_version=api_version, + server_fqdn=server_fqdn, + format=format, + template_url=self.list_cluster_user_credentials.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CredentialResults', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_cluster_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore + + + @distributed_trace_async + async def list_cluster_monitoring_user_credentials( + self, + resource_group_name: str, + resource_name: str, + server_fqdn: Optional[str] = None, + **kwargs: Any + ) -> _models.CredentialResults: + """Lists the cluster monitoring user credentials of a managed cluster. + + Lists the cluster monitoring user credentials of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :type resource_name: str + :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. + :type server_fqdn: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CredentialResults, or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.CredentialResults + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + + + request = build_list_cluster_monitoring_user_credentials_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + api_version=api_version, + server_fqdn=server_fqdn, + template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CredentialResults', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_cluster_monitoring_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore + + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> _models.ManagedCluster: + """Gets a managed cluster. + + Gets a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedCluster, or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedCluster + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + 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) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ManagedCluster', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + + + async def _create_or_update_initial( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.ManagedCluster, + **kwargs: Any + ) -> _models.ManagedCluster: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + + _json = self._serialize.body(parameters, 'ManagedCluster') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + api_version=api_version, + content_type=content_type, + json=_json, + 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) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ManagedCluster', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ManagedCluster', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.ManagedCluster, + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :type resource_name: str + :param parameters: The managed cluster to create or update. + :type parameters: ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedCluster + :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 ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedCluster] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + parameters=parameters, + 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('ManagedCluster', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + 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) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + + async def _update_tags_initial( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.TagsObject, + **kwargs: Any + ) -> _models.ManagedCluster: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + + _json = self._serialize.body(parameters, 'TagsObject') + + request = build_update_tags_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_tags_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ManagedCluster', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_tags_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + + + @distributed_trace_async + async def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.TagsObject, + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates tags on a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. + :type parameters: ~azure.mgmt.containerservice.v2022_06_02_preview.models.TagsObject + :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 ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedCluster] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_tags_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + parameters=parameters, + 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('ManagedCluster', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + 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) + + begin_update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + resource_name: str, + ignore_pod_disruption_budget: Optional[bool] = None, + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + api_version=api_version, + ignore_pod_disruption_budget=ignore_pod_disruption_budget, + template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + resource_name: str, + ignore_pod_disruption_budget: Optional[bool] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a managed cluster. + + Deletes a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :type resource_name: str + :param ignore_pod_disruption_budget: ignore-pod-disruption-budget=true to delete those pods on + a node without considering Pod Disruption Budget. Default value is None. + :type ignore_pod_disruption_budget: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + ignore_pod_disruption_budget=ignore_pod_disruption_budget, + 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): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + 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) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + + async def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + resource_name: str, + parameters: _models.ManagedClusterServicePrincipalProfile, + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] + + _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') + + request = build_reset_service_principal_profile_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._reset_service_principal_profile_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _reset_service_principal_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + + + @distributed_trace_async + async def begin_reset_service_principal_profile( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + resource_name: str, + parameters: _models.ManagedClusterServicePrincipalProfile, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset the Service Principal Profile of a managed cluster. + + This action cannot be performed on a cluster that is not using a service principal. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :type resource_name: str + :param parameters: The service principal profile to set on the managed cluster. + :type parameters: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterServicePrincipalProfile + :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 = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._reset_service_principal_profile_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + parameters=parameters, + 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): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + 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) + + begin_reset_service_principal_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + + async def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + resource_name: str, + parameters: _models.ManagedClusterAADProfile, + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] + + _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') + + request = build_reset_aad_profile_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._reset_aad_profile_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _reset_aad_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + + + @distributed_trace_async + async def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + resource_name: str, + parameters: _models.ManagedClusterAADProfile, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset the AAD Profile of a managed cluster. + + Reset the AAD Profile of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :type resource_name: str + :param parameters: The AAD profile to set on the Managed Cluster. + :type parameters: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterAADProfile + :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 = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._reset_aad_profile_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + parameters=parameters, + 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): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + 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) + + begin_reset_aad_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + + async def _rotate_cluster_certificates_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 + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_rotate_cluster_certificates_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + api_version=api_version, + template_url=self._rotate_cluster_certificates_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _rotate_cluster_certificates_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore + + + @distributed_trace_async + async def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Rotates the certificates of a managed cluster. + + See `Certificate rotation `_ for + more details about rotating managed cluster certificates. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :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 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._rotate_cluster_certificates_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): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + 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) + + begin_rotate_cluster_certificates.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore + + async def _rotate_service_account_signing_keys_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 + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_rotate_service_account_signing_keys_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + api_version=api_version, + template_url=self._rotate_service_account_signing_keys_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _rotate_service_account_signing_keys_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateServiceAccountSigningKeys"} # type: ignore + + + @distributed_trace_async + async def begin_rotate_service_account_signing_keys( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Rotates the service account signing keys of a managed cluster. + + Rotates the service account signing keys of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :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 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._rotate_service_account_signing_keys_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): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + 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) + + begin_rotate_service_account_signing_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateServiceAccountSigningKeys"} # type: ignore + + async def _stop_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 + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_stop_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + api_version=api_version, + template_url=self._stop_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore + + + @distributed_trace_async + async def begin_stop( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Stops a Managed Cluster. + + This can only be performed on Azure Virtual Machine Scale set backed clusters. Stopping a + cluster stops the control plane and agent nodes entirely, while maintaining all object and + cluster state. A cluster does not accrue charges while it is stopped. See `stopping a cluster + `_ for more details about stopping a + cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :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 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._stop_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): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + 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) + + begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore + + async def _start_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 + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_start_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + api_version=api_version, + template_url=self._start_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore + + + @distributed_trace_async + async def begin_start( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Starts a previously stopped Managed Cluster. + + See `starting a cluster `_ for more + details about starting a cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :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 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._start_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): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + 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) + + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore + + async def _run_command_initial( + self, + resource_group_name: str, + resource_name: str, + request_payload: _models.RunCommandRequest, + **kwargs: Any + ) -> Optional[_models.RunCommandResult]: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] + + _json = self._serialize.body(request_payload, 'RunCommandRequest') + + request = build_run_command_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._run_command_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('RunCommandResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _run_command_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore + + + @distributed_trace_async + async def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: _models.RunCommandRequest, + **kwargs: Any + ) -> AsyncLROPoller[_models.RunCommandResult]: + """Submits a command to run against the Managed Cluster. + + AKS will create a pod to run the command. This is primarily useful for private clusters. For + more information see `AKS Run Command + `_. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :type resource_name: str + :param request_payload: The run command request. + :type request_payload: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.RunCommandRequest + :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 RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservice.v2022_06_02_preview.models.RunCommandResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.RunCommandResult] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._run_command_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + request_payload=request_payload, + 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('RunCommandResult', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + 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) + + begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore + + @distributed_trace_async + async def get_command_result( + self, + resource_group_name: str, + resource_name: str, + command_id: str, + **kwargs: Any + ) -> Optional[_models.RunCommandResult]: + """Gets the results of a command which has been run on the Managed Cluster. + + Gets the results of a command which has been run on the Managed Cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :type resource_name: str + :param command_id: Id of the command. + :type command_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RunCommandResult, or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.RunCommandResult or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] + + + request = build_get_command_result_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + command_id=command_id, + api_version=api_version, + template_url=self.get_command_result.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('RunCommandResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_command_result.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}"} # type: ignore + + + @distributed_trace + def list_outbound_network_dependencies_endpoints( + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> AsyncIterable[_models.OutboundEnvironmentEndpointCollection]: + """Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the + specified managed cluster. + + Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the + specified managed cluster. The operation returns properties of each egress endpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OutboundEnvironmentEndpointCollection or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_06_02_preview.models.OutboundEnvironmentEndpointCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_outbound_network_dependencies_endpoints_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + api_version=api_version, + template_url=self.list_outbound_network_dependencies_endpoints.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + + request = build_list_outbound_network_dependencies_endpoints_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + api_version=api_version, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("OutboundEnvironmentEndpointCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_outbound_network_dependencies_endpoints.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_operations.py new file mode 100644 index 000000000000..0531804ec4d7 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_operations.py @@ -0,0 +1,123 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._operations import build_list_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_06_02_preview.aio.ContainerServiceClient`'s + :attr:`operations` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + + @distributed_trace + def list( + self, + **kwargs: Any + ) -> AsyncIterable[_models.OperationListResult]: + """Gets a list of operations. + + Gets a list of operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationListResult or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_06_02_preview.models.OperationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + api_version=api_version, + template_url=self.list.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + + request = build_list_request( + api_version=api_version, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("OperationListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/providers/Microsoft.ContainerService/operations"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_private_endpoint_connections_operations.py new file mode 100644 index 000000000000..b4123e1f5965 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_private_endpoint_connections_operations.py @@ -0,0 +1,387 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, 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._private_endpoint_connections_operations import build_delete_request_initial, build_get_request, build_list_request, build_update_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class PrivateEndpointConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_06_02_preview.aio.ContainerServiceClient`'s + :attr:`private_endpoint_connections` 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( + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> _models.PrivateEndpointConnectionListResult: + """Gets a list of private endpoint connections in the specified managed cluster. + + To learn more about private clusters, see: + https://docs.microsoft.com/azure/aks/private-clusters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnectionListResult, or the result of cls(response) + :rtype: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.PrivateEndpointConnectionListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] + + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + 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) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore + + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Gets the specified private endpoint connection. + + To learn more about private clusters, see: + https://docs.microsoft.com/azure/aks/private-clusters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection, or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.PrivateEndpointConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + private_endpoint_connection_name=private_endpoint_connection_name, + 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) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: _models.PrivateEndpointConnection, + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. + :type private_endpoint_connection_name: str + :param parameters: The updated private endpoint connection. + :type parameters: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.PrivateEndpointConnection + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection, or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.PrivateEndpointConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + + _json = self._serialize.body(parameters, 'PrivateEndpointConnection') + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + private_endpoint_connection_name=private_endpoint_connection_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) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a private endpoint connection. + + Deletes a private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. + :type private_endpoint_connection_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + private_endpoint_connection_name=private_endpoint_connection_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): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + 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) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_private_link_resources_operations.py new file mode 100644 index 000000000000..5666ff99f71e --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_private_link_resources_operations.py @@ -0,0 +1,109 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, 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._private_link_resources_operations import build_list_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class PrivateLinkResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_06_02_preview.aio.ContainerServiceClient`'s + :attr:`private_link_resources` 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( + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> _models.PrivateLinkResourcesListResult: + """Gets a list of private link resources in the specified managed cluster. + + To learn more about private clusters, see: + https://docs.microsoft.com/azure/aks/private-clusters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResourcesListResult, or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.PrivateLinkResourcesListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] + + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + 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) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateLinkResourcesListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore + diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_resolve_private_link_service_id_operations.py new file mode 100644 index 000000000000..6cdb62e23c47 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_resolve_private_link_service_id_operations.py @@ -0,0 +1,115 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, 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._resolve_private_link_service_id_operations import build_post_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ResolvePrivateLinkServiceIdOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_06_02_preview.aio.ContainerServiceClient`'s + :attr:`resolve_private_link_service_id` 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 post( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.PrivateLinkResource, + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID for the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :type resource_name: str + :param parameters: Parameters required in order to resolve a private link service ID. + :type parameters: ~azure.mgmt.containerservice.v2022_06_02_preview.models.PrivateLinkResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource, or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.PrivateLinkResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] + + _json = self._serialize.body(parameters, 'PrivateLinkResource') + + request = build_post_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.post.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateLinkResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + post.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore + diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_snapshots_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_snapshots_operations.py new file mode 100644 index 000000000000..7774f20edc49 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_snapshots_operations.py @@ -0,0 +1,486 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._snapshots_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_resource_group_request, build_list_request, build_update_tags_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class SnapshotsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_06_02_preview.aio.ContainerServiceClient`'s + :attr:`snapshots` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + + @distributed_trace + def list( + self, + **kwargs: Any + ) -> AsyncIterable[_models.SnapshotListResult]: + """Gets a list of snapshots in the specified subscription. + + Gets a list of snapshots in the specified subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SnapshotListResult or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_06_02_preview.models.SnapshotListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("SnapshotListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots"} # type: ignore + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable[_models.SnapshotListResult]: + """Lists snapshots in the specified subscription and resource group. + + Lists snapshots in the specified subscription and resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SnapshotListResult or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_06_02_preview.models.SnapshotListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + 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) # type: ignore + + else: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("SnapshotListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots"} # type: ignore + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> _models.Snapshot: + """Gets a snapshot. + + Gets a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot, or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.Snapshot + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + 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) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Snapshot', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore + + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.Snapshot, + **kwargs: Any + ) -> _models.Snapshot: + """Creates or updates a snapshot. + + Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :type resource_name: str + :param parameters: The snapshot to create or update. + :type parameters: ~azure.mgmt.containerservice.v2022_06_02_preview.models.Snapshot + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot, or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.Snapshot + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + + _json = self._serialize.body(parameters, 'Snapshot') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Snapshot', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Snapshot', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore + + + @distributed_trace_async + async def update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.TagsObject, + **kwargs: Any + ) -> _models.Snapshot: + """Updates tags on a snapshot. + + Updates tags on a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :type resource_name: str + :param parameters: Parameters supplied to the Update snapshot Tags operation. + :type parameters: ~azure.mgmt.containerservice.v2022_06_02_preview.models.TagsObject + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot, or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.Snapshot + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + + _json = self._serialize.body(parameters, 'TagsObject') + + request = build_update_tags_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update_tags.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Snapshot', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore + + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> None: + """Deletes a snapshot. + + Deletes a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :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 + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + 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) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore + diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_trusted_access_role_bindings_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_trusted_access_role_bindings_operations.py new file mode 100644 index 000000000000..e1f0dc3dd2c6 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_trusted_access_role_bindings_operations.py @@ -0,0 +1,348 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._trusted_access_role_bindings_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class TrustedAccessRoleBindingsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_06_02_preview.aio.ContainerServiceClient`'s + :attr:`trusted_access_role_bindings` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + + @distributed_trace + def list( + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> AsyncIterable[_models.TrustedAccessRoleBindingListResult]: + """List trusted access role bindings. + + List trusted access role bindings. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either TrustedAccessRoleBindingListResult or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_06_02_preview.models.TrustedAccessRoleBindingListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.TrustedAccessRoleBindingListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + 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) # type: ignore + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + api_version=api_version, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("TrustedAccessRoleBindingListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings"} # type: ignore + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + resource_name: str, + trusted_access_role_binding_name: str, + **kwargs: Any + ) -> _models.TrustedAccessRoleBinding: + """Get a trusted access role binding. + + Get a trusted access role binding. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :type resource_name: str + :param trusted_access_role_binding_name: The name of trusted access role binding. + :type trusted_access_role_binding_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TrustedAccessRoleBinding, or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.TrustedAccessRoleBinding + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.TrustedAccessRoleBinding] + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + trusted_access_role_binding_name=trusted_access_role_binding_name, + 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) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TrustedAccessRoleBinding', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}"} # type: ignore + + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + trusted_access_role_binding_name: str, + trusted_access_role_binding: _models.TrustedAccessRoleBinding, + **kwargs: Any + ) -> _models.TrustedAccessRoleBinding: + """Create or update a trusted access role binding. + + Create or update a trusted access role binding. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :type resource_name: str + :param trusted_access_role_binding_name: The name of trusted access role binding. + :type trusted_access_role_binding_name: str + :param trusted_access_role_binding: A trusted access role binding. + :type trusted_access_role_binding: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.TrustedAccessRoleBinding + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TrustedAccessRoleBinding, or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.TrustedAccessRoleBinding + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.TrustedAccessRoleBinding] + + _json = self._serialize.body(trusted_access_role_binding, 'TrustedAccessRoleBinding') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + trusted_access_role_binding_name=trusted_access_role_binding_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TrustedAccessRoleBinding', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}"} # type: ignore + + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + resource_name: str, + trusted_access_role_binding_name: str, + **kwargs: Any + ) -> None: + """Delete a trusted access role binding. + + Delete a trusted access role binding. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :type resource_name: str + :param trusted_access_role_binding_name: The name of trusted access role binding. + :type trusted_access_role_binding_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 + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + trusted_access_role_binding_name=trusted_access_role_binding_name, + 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) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}"} # type: ignore + diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_trusted_access_roles_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_trusted_access_roles_operations.py new file mode 100644 index 000000000000..762e95d442b6 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/aio/operations/_trusted_access_roles_operations.py @@ -0,0 +1,131 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, 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._trusted_access_roles_operations import build_list_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class TrustedAccessRolesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_06_02_preview.aio.ContainerServiceClient`'s + :attr:`trusted_access_roles` 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, + location: str, + **kwargs: Any + ) -> AsyncIterable[_models.TrustedAccessRoleListResult]: + """List supported trusted access roles. + + List supported trusted access roles. + + :param location: The name of Azure region. + :type location: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either TrustedAccessRoleListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservice.v2022_06_02_preview.models.TrustedAccessRoleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.TrustedAccessRoleListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + location=location, + 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) # type: ignore + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + location=location, + api_version=api_version, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("TrustedAccessRoleListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/trustedAccessRoles"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/models/__init__.py new file mode 100644 index 000000000000..104ebdc171ba --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/models/__init__.py @@ -0,0 +1,343 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._models_py3 import AgentPool +from ._models_py3 import AgentPoolAvailableVersions +from ._models_py3 import AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem +from ._models_py3 import AgentPoolListResult +from ._models_py3 import AgentPoolUpgradeProfile +from ._models_py3 import AgentPoolUpgradeProfilePropertiesUpgradesItem +from ._models_py3 import AgentPoolUpgradeSettings +from ._models_py3 import AzureEntityResource +from ._models_py3 import AzureKeyVaultKms +from ._models_py3 import CloudErrorBody +from ._models_py3 import ContainerServiceDiagnosticsProfile +from ._models_py3 import ContainerServiceLinuxProfile +from ._models_py3 import ContainerServiceMasterProfile +from ._models_py3 import ContainerServiceNetworkProfile +from ._models_py3 import ContainerServiceSshConfiguration +from ._models_py3 import ContainerServiceSshPublicKey +from ._models_py3 import ContainerServiceVMDiagnostics +from ._models_py3 import CreationData +from ._models_py3 import CredentialResult +from ._models_py3 import CredentialResults +from ._models_py3 import EndpointDependency +from ._models_py3 import EndpointDetail +from ._models_py3 import ErrorAdditionalInfo +from ._models_py3 import ErrorDetail +from ._models_py3 import ErrorResponse +from ._models_py3 import ExtendedLocation +from ._models_py3 import Fleet +from ._models_py3 import FleetCredentialResult +from ._models_py3 import FleetCredentialResults +from ._models_py3 import FleetHubProfile +from ._models_py3 import FleetListResult +from ._models_py3 import FleetMember +from ._models_py3 import FleetMembersListResult +from ._models_py3 import FleetPatch +from ._models_py3 import KubeletConfig +from ._models_py3 import LinuxOSConfig +from ._models_py3 import MaintenanceConfiguration +from ._models_py3 import MaintenanceConfigurationListResult +from ._models_py3 import ManagedCluster +from ._models_py3 import ManagedClusterAADProfile +from ._models_py3 import ManagedClusterAPIServerAccessProfile +from ._models_py3 import ManagedClusterAccessProfile +from ._models_py3 import ManagedClusterAddonProfile +from ._models_py3 import ManagedClusterAddonProfileIdentity +from ._models_py3 import ManagedClusterAgentPoolProfile +from ._models_py3 import ManagedClusterAgentPoolProfileProperties +from ._models_py3 import ManagedClusterAutoUpgradeProfile +from ._models_py3 import ManagedClusterHTTPProxyConfig +from ._models_py3 import ManagedClusterIdentity +from ._models_py3 import ManagedClusterIngressProfile +from ._models_py3 import ManagedClusterIngressProfileWebAppRouting +from ._models_py3 import ManagedClusterListResult +from ._models_py3 import ManagedClusterLoadBalancerProfile +from ._models_py3 import ManagedClusterLoadBalancerProfileManagedOutboundIPs +from ._models_py3 import ManagedClusterLoadBalancerProfileOutboundIPPrefixes +from ._models_py3 import ManagedClusterLoadBalancerProfileOutboundIPs +from ._models_py3 import ManagedClusterManagedOutboundIPProfile +from ._models_py3 import ManagedClusterNATGatewayProfile +from ._models_py3 import ManagedClusterOIDCIssuerProfile +from ._models_py3 import ManagedClusterPodIdentity +from ._models_py3 import ManagedClusterPodIdentityException +from ._models_py3 import ManagedClusterPodIdentityProfile +from ._models_py3 import ManagedClusterPodIdentityProvisioningError +from ._models_py3 import ManagedClusterPodIdentityProvisioningErrorBody +from ._models_py3 import ManagedClusterPodIdentityProvisioningInfo +from ._models_py3 import ManagedClusterPoolUpgradeProfile +from ._models_py3 import ManagedClusterPoolUpgradeProfileUpgradesItem +from ._models_py3 import ManagedClusterPropertiesAutoScalerProfile +from ._models_py3 import ManagedClusterPropertiesForSnapshot +from ._models_py3 import ManagedClusterSKU +from ._models_py3 import ManagedClusterSecurityProfile +from ._models_py3 import ManagedClusterSecurityProfileDefender +from ._models_py3 import ManagedClusterSecurityProfileDefenderSecurityMonitoring +from ._models_py3 import ManagedClusterSecurityProfileWorkloadIdentity +from ._models_py3 import ManagedClusterServicePrincipalProfile +from ._models_py3 import ManagedClusterSnapshot +from ._models_py3 import ManagedClusterSnapshotListResult +from ._models_py3 import ManagedClusterStorageProfile +from ._models_py3 import ManagedClusterStorageProfileBlobCSIDriver +from ._models_py3 import ManagedClusterStorageProfileDiskCSIDriver +from ._models_py3 import ManagedClusterStorageProfileFileCSIDriver +from ._models_py3 import ManagedClusterStorageProfileSnapshotController +from ._models_py3 import ManagedClusterUpgradeProfile +from ._models_py3 import ManagedClusterWindowsProfile +from ._models_py3 import ManagedClusterWorkloadAutoScalerProfile +from ._models_py3 import ManagedClusterWorkloadAutoScalerProfileKeda +from ._models_py3 import ManagedServiceIdentityUserAssignedIdentitiesValue +from ._models_py3 import NetworkProfileForSnapshot +from ._models_py3 import OSOptionProfile +from ._models_py3 import OSOptionProperty +from ._models_py3 import OperationListResult +from ._models_py3 import OperationValue +from ._models_py3 import OutboundEnvironmentEndpoint +from ._models_py3 import OutboundEnvironmentEndpointCollection +from ._models_py3 import PowerState +from ._models_py3 import PrivateEndpoint +from ._models_py3 import PrivateEndpointConnection +from ._models_py3 import PrivateEndpointConnectionListResult +from ._models_py3 import PrivateLinkResource +from ._models_py3 import PrivateLinkResourcesListResult +from ._models_py3 import PrivateLinkServiceConnectionState +from ._models_py3 import Resource +from ._models_py3 import ResourceReference +from ._models_py3 import RunCommandRequest +from ._models_py3 import RunCommandResult +from ._models_py3 import Snapshot +from ._models_py3 import SnapshotListResult +from ._models_py3 import SubResource +from ._models_py3 import SysctlConfig +from ._models_py3 import SystemData +from ._models_py3 import TagsObject +from ._models_py3 import TimeInWeek +from ._models_py3 import TimeSpan +from ._models_py3 import TrackedResource +from ._models_py3 import TrustedAccessRole +from ._models_py3 import TrustedAccessRoleBinding +from ._models_py3 import TrustedAccessRoleBindingListResult +from ._models_py3 import TrustedAccessRoleListResult +from ._models_py3 import TrustedAccessRoleRule +from ._models_py3 import UserAssignedIdentity +from ._models_py3 import WindowsGmsaProfile + + +from ._container_service_client_enums import ( + AgentPoolMode, + AgentPoolType, + Code, + ConnectionStatus, + ContainerServiceStorageProfileTypes, + ContainerServiceVMSizeTypes, + Count, + CreatedByType, + Expander, + ExtendedLocationTypes, + FleetMemberProvisioningState, + FleetProvisioningState, + Format, + GPUInstanceProfile, + IpFamily, + KeyVaultNetworkAccessTypes, + KubeletDiskType, + LicenseType, + LoadBalancerSku, + ManagedClusterPodIdentityProvisioningState, + ManagedClusterSKUName, + ManagedClusterSKUTier, + NetworkMode, + NetworkPlugin, + NetworkPluginMode, + NetworkPolicy, + OSDiskType, + OSSKU, + OSType, + OutboundType, + PrivateEndpointConnectionProvisioningState, + PublicNetworkAccess, + ResourceIdentityType, + ScaleDownMode, + ScaleSetEvictionPolicy, + ScaleSetPriority, + SnapshotType, + TrustedAccessRoleBindingProvisioningState, + UpgradeChannel, + WeekDay, + WorkloadRuntime, +) +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk +__all__ = [ + 'AgentPool', + 'AgentPoolAvailableVersions', + 'AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem', + 'AgentPoolListResult', + 'AgentPoolUpgradeProfile', + 'AgentPoolUpgradeProfilePropertiesUpgradesItem', + 'AgentPoolUpgradeSettings', + 'AzureEntityResource', + 'AzureKeyVaultKms', + 'CloudErrorBody', + 'ContainerServiceDiagnosticsProfile', + 'ContainerServiceLinuxProfile', + 'ContainerServiceMasterProfile', + 'ContainerServiceNetworkProfile', + 'ContainerServiceSshConfiguration', + 'ContainerServiceSshPublicKey', + 'ContainerServiceVMDiagnostics', + 'CreationData', + 'CredentialResult', + 'CredentialResults', + 'EndpointDependency', + 'EndpointDetail', + 'ErrorAdditionalInfo', + 'ErrorDetail', + 'ErrorResponse', + 'ExtendedLocation', + 'Fleet', + 'FleetCredentialResult', + 'FleetCredentialResults', + 'FleetHubProfile', + 'FleetListResult', + 'FleetMember', + 'FleetMembersListResult', + 'FleetPatch', + 'KubeletConfig', + 'LinuxOSConfig', + 'MaintenanceConfiguration', + 'MaintenanceConfigurationListResult', + 'ManagedCluster', + 'ManagedClusterAADProfile', + 'ManagedClusterAPIServerAccessProfile', + 'ManagedClusterAccessProfile', + 'ManagedClusterAddonProfile', + 'ManagedClusterAddonProfileIdentity', + 'ManagedClusterAgentPoolProfile', + 'ManagedClusterAgentPoolProfileProperties', + 'ManagedClusterAutoUpgradeProfile', + 'ManagedClusterHTTPProxyConfig', + 'ManagedClusterIdentity', + 'ManagedClusterIngressProfile', + 'ManagedClusterIngressProfileWebAppRouting', + 'ManagedClusterListResult', + 'ManagedClusterLoadBalancerProfile', + 'ManagedClusterLoadBalancerProfileManagedOutboundIPs', + 'ManagedClusterLoadBalancerProfileOutboundIPPrefixes', + 'ManagedClusterLoadBalancerProfileOutboundIPs', + 'ManagedClusterManagedOutboundIPProfile', + 'ManagedClusterNATGatewayProfile', + 'ManagedClusterOIDCIssuerProfile', + 'ManagedClusterPodIdentity', + 'ManagedClusterPodIdentityException', + 'ManagedClusterPodIdentityProfile', + 'ManagedClusterPodIdentityProvisioningError', + 'ManagedClusterPodIdentityProvisioningErrorBody', + 'ManagedClusterPodIdentityProvisioningInfo', + 'ManagedClusterPoolUpgradeProfile', + 'ManagedClusterPoolUpgradeProfileUpgradesItem', + 'ManagedClusterPropertiesAutoScalerProfile', + 'ManagedClusterPropertiesForSnapshot', + 'ManagedClusterSKU', + 'ManagedClusterSecurityProfile', + 'ManagedClusterSecurityProfileDefender', + 'ManagedClusterSecurityProfileDefenderSecurityMonitoring', + 'ManagedClusterSecurityProfileWorkloadIdentity', + 'ManagedClusterServicePrincipalProfile', + 'ManagedClusterSnapshot', + 'ManagedClusterSnapshotListResult', + 'ManagedClusterStorageProfile', + 'ManagedClusterStorageProfileBlobCSIDriver', + 'ManagedClusterStorageProfileDiskCSIDriver', + 'ManagedClusterStorageProfileFileCSIDriver', + 'ManagedClusterStorageProfileSnapshotController', + 'ManagedClusterUpgradeProfile', + 'ManagedClusterWindowsProfile', + 'ManagedClusterWorkloadAutoScalerProfile', + 'ManagedClusterWorkloadAutoScalerProfileKeda', + 'ManagedServiceIdentityUserAssignedIdentitiesValue', + 'NetworkProfileForSnapshot', + 'OSOptionProfile', + 'OSOptionProperty', + 'OperationListResult', + 'OperationValue', + 'OutboundEnvironmentEndpoint', + 'OutboundEnvironmentEndpointCollection', + 'PowerState', + 'PrivateEndpoint', + 'PrivateEndpointConnection', + 'PrivateEndpointConnectionListResult', + 'PrivateLinkResource', + 'PrivateLinkResourcesListResult', + 'PrivateLinkServiceConnectionState', + 'Resource', + 'ResourceReference', + 'RunCommandRequest', + 'RunCommandResult', + 'Snapshot', + 'SnapshotListResult', + 'SubResource', + 'SysctlConfig', + 'SystemData', + 'TagsObject', + 'TimeInWeek', + 'TimeSpan', + 'TrackedResource', + 'TrustedAccessRole', + 'TrustedAccessRoleBinding', + 'TrustedAccessRoleBindingListResult', + 'TrustedAccessRoleListResult', + 'TrustedAccessRoleRule', + 'UserAssignedIdentity', + 'WindowsGmsaProfile', + 'AgentPoolMode', + 'AgentPoolType', + 'Code', + 'ConnectionStatus', + 'ContainerServiceStorageProfileTypes', + 'ContainerServiceVMSizeTypes', + 'Count', + 'CreatedByType', + 'Expander', + 'ExtendedLocationTypes', + 'FleetMemberProvisioningState', + 'FleetProvisioningState', + 'Format', + 'GPUInstanceProfile', + 'IpFamily', + 'KeyVaultNetworkAccessTypes', + 'KubeletDiskType', + 'LicenseType', + 'LoadBalancerSku', + 'ManagedClusterPodIdentityProvisioningState', + 'ManagedClusterSKUName', + 'ManagedClusterSKUTier', + 'NetworkMode', + 'NetworkPlugin', + 'NetworkPluginMode', + 'NetworkPolicy', + 'OSDiskType', + 'OSSKU', + 'OSType', + 'OutboundType', + 'PrivateEndpointConnectionProvisioningState', + 'PublicNetworkAccess', + 'ResourceIdentityType', + 'ScaleDownMode', + 'ScaleSetEvictionPolicy', + 'ScaleSetPriority', + 'SnapshotType', + 'TrustedAccessRoleBindingProvisioningState', + 'UpgradeChannel', + 'WeekDay', + 'WorkloadRuntime', +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/models/_container_service_client_enums.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/models/_container_service_client_enums.py new file mode 100644 index 000000000000..bf7736134910 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/models/_container_service_client_enums.py @@ -0,0 +1,639 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from enum import Enum +from azure.core import CaseInsensitiveEnumMeta + + +class AgentPoolMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """A cluster must have at least one 'System' Agent Pool at all times. For additional information + on agent pool restrictions and best practices, see: + https://docs.microsoft.com/azure/aks/use-system-pools + """ + + #: System agent pools are primarily for hosting critical system pods such as CoreDNS and + #: metrics-server. System agent pools osType must be Linux. System agent pools VM SKU must have at + #: least 2vCPUs and 4GB of memory. + SYSTEM = "System" + #: User agent pools are primarily for hosting your application pods. + USER = "User" + +class AgentPoolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of Agent Pool. + """ + + #: Create an Agent Pool backed by a Virtual Machine Scale Set. + VIRTUAL_MACHINE_SCALE_SETS = "VirtualMachineScaleSets" + #: Use of this is strongly discouraged. + AVAILABILITY_SET = "AvailabilitySet" + +class Code(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Tells whether the cluster is Running or Stopped + """ + + #: The cluster is running. + RUNNING = "Running" + #: The cluster is stopped. + STOPPED = "Stopped" + +class ConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The private link service connection status. + """ + + PENDING = "Pending" + APPROVED = "Approved" + REJECTED = "Rejected" + DISCONNECTED = "Disconnected" + +class ContainerServiceStorageProfileTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Specifies what kind of storage to use. If omitted, the default will be chosen on your behalf + based on the choice of orchestrator. + """ + + STORAGE_ACCOUNT = "StorageAccount" + MANAGED_DISKS = "ManagedDisks" + +class ContainerServiceVMSizeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Size of agent VMs. Note: This is no longer maintained. + """ + + STANDARD_A1 = "Standard_A1" + STANDARD_A10 = "Standard_A10" + STANDARD_A11 = "Standard_A11" + STANDARD_A1_V2 = "Standard_A1_v2" + STANDARD_A2 = "Standard_A2" + STANDARD_A2_V2 = "Standard_A2_v2" + STANDARD_A2_M_V2 = "Standard_A2m_v2" + STANDARD_A3 = "Standard_A3" + STANDARD_A4 = "Standard_A4" + STANDARD_A4_V2 = "Standard_A4_v2" + STANDARD_A4_M_V2 = "Standard_A4m_v2" + STANDARD_A5 = "Standard_A5" + STANDARD_A6 = "Standard_A6" + STANDARD_A7 = "Standard_A7" + STANDARD_A8 = "Standard_A8" + STANDARD_A8_V2 = "Standard_A8_v2" + STANDARD_A8_M_V2 = "Standard_A8m_v2" + STANDARD_A9 = "Standard_A9" + STANDARD_B2_MS = "Standard_B2ms" + STANDARD_B2_S = "Standard_B2s" + STANDARD_B4_MS = "Standard_B4ms" + STANDARD_B8_MS = "Standard_B8ms" + STANDARD_D1 = "Standard_D1" + STANDARD_D11 = "Standard_D11" + STANDARD_D11_V2 = "Standard_D11_v2" + STANDARD_D11_V2_PROMO = "Standard_D11_v2_Promo" + STANDARD_D12 = "Standard_D12" + STANDARD_D12_V2 = "Standard_D12_v2" + STANDARD_D12_V2_PROMO = "Standard_D12_v2_Promo" + STANDARD_D13 = "Standard_D13" + STANDARD_D13_V2 = "Standard_D13_v2" + STANDARD_D13_V2_PROMO = "Standard_D13_v2_Promo" + STANDARD_D14 = "Standard_D14" + STANDARD_D14_V2 = "Standard_D14_v2" + STANDARD_D14_V2_PROMO = "Standard_D14_v2_Promo" + STANDARD_D15_V2 = "Standard_D15_v2" + STANDARD_D16_V3 = "Standard_D16_v3" + STANDARD_D16_S_V3 = "Standard_D16s_v3" + STANDARD_D1_V2 = "Standard_D1_v2" + STANDARD_D2 = "Standard_D2" + STANDARD_D2_V2 = "Standard_D2_v2" + STANDARD_D2_V2_PROMO = "Standard_D2_v2_Promo" + STANDARD_D2_V3 = "Standard_D2_v3" + STANDARD_D2_S_V3 = "Standard_D2s_v3" + STANDARD_D3 = "Standard_D3" + STANDARD_D32_V3 = "Standard_D32_v3" + STANDARD_D32_S_V3 = "Standard_D32s_v3" + STANDARD_D3_V2 = "Standard_D3_v2" + STANDARD_D3_V2_PROMO = "Standard_D3_v2_Promo" + STANDARD_D4 = "Standard_D4" + STANDARD_D4_V2 = "Standard_D4_v2" + STANDARD_D4_V2_PROMO = "Standard_D4_v2_Promo" + STANDARD_D4_V3 = "Standard_D4_v3" + STANDARD_D4_S_V3 = "Standard_D4s_v3" + STANDARD_D5_V2 = "Standard_D5_v2" + STANDARD_D5_V2_PROMO = "Standard_D5_v2_Promo" + STANDARD_D64_V3 = "Standard_D64_v3" + STANDARD_D64_S_V3 = "Standard_D64s_v3" + STANDARD_D8_V3 = "Standard_D8_v3" + STANDARD_D8_S_V3 = "Standard_D8s_v3" + STANDARD_DS1 = "Standard_DS1" + STANDARD_DS11 = "Standard_DS11" + STANDARD_DS11_V2 = "Standard_DS11_v2" + STANDARD_DS11_V2_PROMO = "Standard_DS11_v2_Promo" + STANDARD_DS12 = "Standard_DS12" + STANDARD_DS12_V2 = "Standard_DS12_v2" + STANDARD_DS12_V2_PROMO = "Standard_DS12_v2_Promo" + STANDARD_DS13 = "Standard_DS13" + STANDARD_DS13_2_V2 = "Standard_DS13-2_v2" + STANDARD_DS13_4_V2 = "Standard_DS13-4_v2" + STANDARD_DS13_V2 = "Standard_DS13_v2" + STANDARD_DS13_V2_PROMO = "Standard_DS13_v2_Promo" + STANDARD_DS14 = "Standard_DS14" + STANDARD_DS14_4_V2 = "Standard_DS14-4_v2" + STANDARD_DS14_8_V2 = "Standard_DS14-8_v2" + STANDARD_DS14_V2 = "Standard_DS14_v2" + STANDARD_DS14_V2_PROMO = "Standard_DS14_v2_Promo" + STANDARD_DS15_V2 = "Standard_DS15_v2" + STANDARD_DS1_V2 = "Standard_DS1_v2" + STANDARD_DS2 = "Standard_DS2" + STANDARD_DS2_V2 = "Standard_DS2_v2" + STANDARD_DS2_V2_PROMO = "Standard_DS2_v2_Promo" + STANDARD_DS3 = "Standard_DS3" + STANDARD_DS3_V2 = "Standard_DS3_v2" + STANDARD_DS3_V2_PROMO = "Standard_DS3_v2_Promo" + STANDARD_DS4 = "Standard_DS4" + STANDARD_DS4_V2 = "Standard_DS4_v2" + STANDARD_DS4_V2_PROMO = "Standard_DS4_v2_Promo" + STANDARD_DS5_V2 = "Standard_DS5_v2" + STANDARD_DS5_V2_PROMO = "Standard_DS5_v2_Promo" + STANDARD_E16_V3 = "Standard_E16_v3" + STANDARD_E16_S_V3 = "Standard_E16s_v3" + STANDARD_E2_V3 = "Standard_E2_v3" + STANDARD_E2_S_V3 = "Standard_E2s_v3" + STANDARD_E32_16_S_V3 = "Standard_E32-16s_v3" + STANDARD_E32_8_S_V3 = "Standard_E32-8s_v3" + STANDARD_E32_V3 = "Standard_E32_v3" + STANDARD_E32_S_V3 = "Standard_E32s_v3" + STANDARD_E4_V3 = "Standard_E4_v3" + STANDARD_E4_S_V3 = "Standard_E4s_v3" + STANDARD_E64_16_S_V3 = "Standard_E64-16s_v3" + STANDARD_E64_32_S_V3 = "Standard_E64-32s_v3" + STANDARD_E64_V3 = "Standard_E64_v3" + STANDARD_E64_S_V3 = "Standard_E64s_v3" + STANDARD_E8_V3 = "Standard_E8_v3" + STANDARD_E8_S_V3 = "Standard_E8s_v3" + STANDARD_F1 = "Standard_F1" + STANDARD_F16 = "Standard_F16" + STANDARD_F16_S = "Standard_F16s" + STANDARD_F16_S_V2 = "Standard_F16s_v2" + STANDARD_F1_S = "Standard_F1s" + STANDARD_F2 = "Standard_F2" + STANDARD_F2_S = "Standard_F2s" + STANDARD_F2_S_V2 = "Standard_F2s_v2" + STANDARD_F32_S_V2 = "Standard_F32s_v2" + STANDARD_F4 = "Standard_F4" + STANDARD_F4_S = "Standard_F4s" + STANDARD_F4_S_V2 = "Standard_F4s_v2" + STANDARD_F64_S_V2 = "Standard_F64s_v2" + STANDARD_F72_S_V2 = "Standard_F72s_v2" + STANDARD_F8 = "Standard_F8" + STANDARD_F8_S = "Standard_F8s" + STANDARD_F8_S_V2 = "Standard_F8s_v2" + STANDARD_G1 = "Standard_G1" + STANDARD_G2 = "Standard_G2" + STANDARD_G3 = "Standard_G3" + STANDARD_G4 = "Standard_G4" + STANDARD_G5 = "Standard_G5" + STANDARD_GS1 = "Standard_GS1" + STANDARD_GS2 = "Standard_GS2" + STANDARD_GS3 = "Standard_GS3" + STANDARD_GS4 = "Standard_GS4" + STANDARD_GS4_4 = "Standard_GS4-4" + STANDARD_GS4_8 = "Standard_GS4-8" + STANDARD_GS5 = "Standard_GS5" + STANDARD_GS5_16 = "Standard_GS5-16" + STANDARD_GS5_8 = "Standard_GS5-8" + STANDARD_H16 = "Standard_H16" + STANDARD_H16_M = "Standard_H16m" + STANDARD_H16_MR = "Standard_H16mr" + STANDARD_H16_R = "Standard_H16r" + STANDARD_H8 = "Standard_H8" + STANDARD_H8_M = "Standard_H8m" + STANDARD_L16_S = "Standard_L16s" + STANDARD_L32_S = "Standard_L32s" + STANDARD_L4_S = "Standard_L4s" + STANDARD_L8_S = "Standard_L8s" + STANDARD_M128_32_MS = "Standard_M128-32ms" + STANDARD_M128_64_MS = "Standard_M128-64ms" + STANDARD_M128_MS = "Standard_M128ms" + STANDARD_M128_S = "Standard_M128s" + STANDARD_M64_16_MS = "Standard_M64-16ms" + STANDARD_M64_32_MS = "Standard_M64-32ms" + STANDARD_M64_MS = "Standard_M64ms" + STANDARD_M64_S = "Standard_M64s" + STANDARD_NC12 = "Standard_NC12" + STANDARD_NC12_S_V2 = "Standard_NC12s_v2" + STANDARD_NC12_S_V3 = "Standard_NC12s_v3" + STANDARD_NC24 = "Standard_NC24" + STANDARD_NC24_R = "Standard_NC24r" + STANDARD_NC24_RS_V2 = "Standard_NC24rs_v2" + STANDARD_NC24_RS_V3 = "Standard_NC24rs_v3" + STANDARD_NC24_S_V2 = "Standard_NC24s_v2" + STANDARD_NC24_S_V3 = "Standard_NC24s_v3" + STANDARD_NC6 = "Standard_NC6" + STANDARD_NC6_S_V2 = "Standard_NC6s_v2" + STANDARD_NC6_S_V3 = "Standard_NC6s_v3" + STANDARD_ND12_S = "Standard_ND12s" + STANDARD_ND24_RS = "Standard_ND24rs" + STANDARD_ND24_S = "Standard_ND24s" + STANDARD_ND6_S = "Standard_ND6s" + STANDARD_NV12 = "Standard_NV12" + STANDARD_NV24 = "Standard_NV24" + STANDARD_NV6 = "Standard_NV6" + +class Count(int, Enum, metaclass=CaseInsensitiveEnumMeta): + """Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, and 5. The + default value is 1. + """ + + ONE = 1 + THREE = 3 + FIVE = 5 + +class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of identity that created the resource. + """ + + USER = "User" + APPLICATION = "Application" + MANAGED_IDENTITY = "ManagedIdentity" + KEY = "Key" + +class Expander(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """If not specified, the default is 'random'. See `expanders + `_ + for more information. + """ + + #: Selects the node group that will have the least idle CPU (if tied, unused memory) after + #: scale-up. This is useful when you have different classes of nodes, for example, high CPU or + #: high memory nodes, and only want to expand those when there are pending pods that need a lot of + #: those resources. + LEAST_WASTE = "least-waste" + #: Selects the node group that would be able to schedule the most pods when scaling up. This is + #: useful when you are using nodeSelector to make sure certain pods land on certain nodes. Note + #: that this won't cause the autoscaler to select bigger nodes vs. smaller, as it can add multiple + #: smaller nodes at once. + MOST_PODS = "most-pods" + #: Selects the node group that has the highest priority assigned by the user. It's configuration + #: is described in more details `here + #: `_. + PRIORITY = "priority" + #: Used when you don't have a particular need for the node groups to scale differently. + RANDOM = "random" + +class ExtendedLocationTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of extendedLocation. + """ + + EDGE_ZONE = "EdgeZone" + +class FleetMemberProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The provisioning state of the last accepted operation. + """ + + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELED = "Canceled" + JOINING = "Joining" + LEAVING = "Leaving" + UPDATING = "Updating" + +class FleetProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The provisioning state of the last accepted operation. + """ + + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELED = "Canceled" + CREATING = "Creating" + DELETING = "Deleting" + UPDATING = "Updating" + +class Format(str, Enum, metaclass=CaseInsensitiveEnumMeta): + + #: Return azure auth-provider kubeconfig. This format is deprecated in 1.22 and will be fully + #: removed in 1.25. + AZURE = "azure" + #: Return exec format kubeconfig. This format requires kubelogin binary in the path. + EXEC_ENUM = "exec" + +class GPUInstanceProfile(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """GPUInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU. + """ + + MIG1_G = "MIG1g" + MIG2_G = "MIG2g" + MIG3_G = "MIG3g" + MIG4_G = "MIG4g" + MIG7_G = "MIG7g" + +class IpFamily(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The IP version to use for cluster networking and IP assignment. + """ + + I_PV4 = "IPv4" + I_PV6 = "IPv6" + +class KeyVaultNetworkAccessTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Network access of key vault. The possible values are ``Public`` and ``Private``. ``Public`` + means the key vault allows public access from all networks. ``Private`` means the key vault + disables public access and enables private link. The default value is ``Public``. + """ + + PUBLIC = "Public" + PRIVATE = "Private" + +class KubeletDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Determines the placement of emptyDir volumes, container runtime data root, and Kubelet + ephemeral storage. + """ + + #: Kubelet will use the OS disk for its data. + OS = "OS" + #: Kubelet will use the temporary disk for its data. + TEMPORARY = "Temporary" + +class LicenseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The license type to use for Windows VMs. See `Azure Hybrid User Benefits + `_ for more details. + """ + + #: No additional licensing is applied. + NONE = "None" + #: Enables Azure Hybrid User Benefits for Windows VMs. + WINDOWS_SERVER = "Windows_Server" + +class LoadBalancerSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The default is 'standard'. See `Azure Load Balancer SKUs + `_ for more information about the + differences between load balancer SKUs. + """ + + #: Use a a standard Load Balancer. This is the recommended Load Balancer SKU. For more information + #: about on working with the load balancer in the managed cluster, see the `standard Load Balancer + #: `_ article. + STANDARD = "standard" + #: Use a basic Load Balancer with limited functionality. + BASIC = "basic" + +class ManagedClusterPodIdentityProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The current provisioning state of the pod identity. + """ + + ASSIGNED = "Assigned" + UPDATING = "Updating" + DELETING = "Deleting" + FAILED = "Failed" + +class ManagedClusterSKUName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The name of a managed cluster SKU. + """ + + BASIC = "Basic" + +class ManagedClusterSKUTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """If not specified, the default is 'Free'. See `uptime SLA + `_ for more details. + """ + + #: Guarantees 99.95% availability of the Kubernetes API server endpoint for clusters that use + #: Availability Zones and 99.9% of availability for clusters that don't use Availability Zones. + PAID = "Paid" + #: No guaranteed SLA, no additional charges. Free tier clusters have an SLO of 99.5%. + FREE = "Free" + +class NetworkMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """This cannot be specified if networkPlugin is anything other than 'azure'. + """ + + #: No bridge is created. Intra-VM Pod to Pod communication is through IP routes created by Azure + #: CNI. See `Transparent Mode `_ for + #: more information. + TRANSPARENT = "transparent" + #: This is no longer supported. + BRIDGE = "bridge" + +class NetworkPlugin(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Network plugin used for building the Kubernetes network. + """ + + #: Use the Azure CNI network plugin. See `Azure CNI (advanced) networking + #: `_ for + #: more information. + AZURE = "azure" + #: Use the Kubenet network plugin. See `Kubenet (basic) networking + #: `_ for more + #: information. + KUBENET = "kubenet" + #: Do not use a network plugin. A custom CNI will need to be installed after cluster creation for + #: networking functionality. + NONE = "none" + +class NetworkPluginMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The mode the network plugin should use. + """ + + #: Pods are given IPs from the PodCIDR address space but use Azure Routing Domains rather than + #: Kubenet reference plugins host-local and bridge. + OVERLAY = "Overlay" + +class NetworkPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Network policy used for building the Kubernetes network. + """ + + #: Use Calico network policies. See `differences between Azure and Calico policies + #: `_ + #: for more information. + CALICO = "calico" + #: Use Azure network policies. See `differences between Azure and Calico policies + #: `_ + #: for more information. + AZURE = "azure" + +class OSDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The default is 'Ephemeral' if the VM supports it and has a cache disk larger than the requested + OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed after creation. For more + information see `Ephemeral OS + `_. + """ + + #: Azure replicates the operating system disk for a virtual machine to Azure storage to avoid data + #: loss should the VM need to be relocated to another host. Since containers aren't designed to + #: have local state persisted, this behavior offers limited value while providing some drawbacks, + #: including slower node provisioning and higher read/write latency. + MANAGED = "Managed" + #: Ephemeral OS disks are stored only on the host machine, just like a temporary disk. This + #: provides lower read/write latency, along with faster node scaling and cluster upgrades. + EPHEMERAL = "Ephemeral" + +class OSSKU(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Specifies the OS SKU used by the agent pool. If not specified, the default is Ubuntu if + OSType=Linux or Windows2019 if OSType=Windows. And the default Windows OSSKU will be changed to + Windows2022 after Windows2019 is deprecated. + """ + + UBUNTU = "Ubuntu" + CBL_MARINER = "CBLMariner" + WINDOWS2019 = "Windows2019" + WINDOWS2022 = "Windows2022" + +class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The operating system type. The default is Linux. + """ + + #: Use Linux. + LINUX = "Linux" + #: Use Windows. + WINDOWS = "Windows" + +class OutboundType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """This can only be set at cluster creation time and cannot be changed later. For more information + see `egress outbound type `_. + """ + + #: The load balancer is used for egress through an AKS assigned public IP. This supports + #: Kubernetes services of type 'loadBalancer'. For more information see `outbound type + #: loadbalancer + #: `_. + LOAD_BALANCER = "loadBalancer" + #: Egress paths must be defined by the user. This is an advanced scenario and requires proper + #: network configuration. For more information see `outbound type userDefinedRouting + #: `_. + USER_DEFINED_ROUTING = "userDefinedRouting" + #: The AKS-managed NAT gateway is used for egress. + MANAGED_NAT_GATEWAY = "managedNATGateway" + #: The user-assigned NAT gateway associated to the cluster subnet is used for egress. This is an + #: advanced scenario and requires proper network configuration. + USER_ASSIGNED_NAT_GATEWAY = "userAssignedNATGateway" + +class PrivateEndpointConnectionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The current provisioning state. + """ + + SUCCEEDED = "Succeeded" + CREATING = "Creating" + DELETING = "Deleting" + FAILED = "Failed" + +class PublicNetworkAccess(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Allow or deny public network access for AKS + """ + + ENABLED = "Enabled" + DISABLED = "Disabled" + +class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """For more information see `use managed identities in AKS + `_. + """ + + #: Use an implicitly created system assigned managed identity to manage cluster resources. Master + #: components in the control plane such as kube-controller-manager will use the system assigned + #: managed identity to manipulate Azure resources. + SYSTEM_ASSIGNED = "SystemAssigned" + #: Use a user-specified identity to manage cluster resources. Master components in the control + #: plane such as kube-controller-manager will use the specified user assigned managed identity to + #: manipulate Azure resources. + USER_ASSIGNED = "UserAssigned" + #: Do not use a managed identity for the Managed Cluster, service principal will be used instead. + NONE = "None" + +class ScaleDownMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Describes how VMs are added to or removed from Agent Pools. See `billing states + `_. + """ + + #: Create new instances during scale up and remove instances during scale down. + DELETE = "Delete" + #: Attempt to start deallocated instances (if they exist) during scale up and deallocate instances + #: during scale down. + DEALLOCATE = "Deallocate" + +class ScaleSetEvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The eviction policy specifies what to do with the VM when it is evicted. The default is Delete. + For more information about eviction see `spot VMs + `_ + """ + + #: Nodes in the underlying Scale Set of the node pool are deleted when they're evicted. + DELETE = "Delete" + #: Nodes in the underlying Scale Set of the node pool are set to the stopped-deallocated state + #: upon eviction. Nodes in the stopped-deallocated state count against your compute quota and can + #: cause issues with cluster scaling or upgrading. + DEALLOCATE = "Deallocate" + +class ScaleSetPriority(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The Virtual Machine Scale Set priority. + """ + + #: Spot priority VMs will be used. There is no SLA for spot nodes. See `spot on AKS + #: `_ for more information. + SPOT = "Spot" + #: Regular VMs will be used. + REGULAR = "Regular" + +class SnapshotType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of a snapshot. The default is NodePool. + """ + + #: The snapshot is a snapshot of a node pool. + NODE_POOL = "NodePool" + #: The snapshot is a snapshot of a managed cluster. + MANAGED_CLUSTER = "ManagedCluster" + +class TrustedAccessRoleBindingProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The current provisioning state of trusted access role binding. + """ + + SUCCEEDED = "Succeeded" + FAILED = "Failed" + UPDATING = "Updating" + DELETING = "Deleting" + +class UpgradeChannel(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """For more information see `setting the AKS cluster auto-upgrade channel + `_. + """ + + #: Automatically upgrade the cluster to the latest supported patch release on the latest supported + #: minor version. In cases where the cluster is at a version of Kubernetes that is at an N-2 minor + #: version where N is the latest supported minor version, the cluster first upgrades to the latest + #: supported patch version on N-1 minor version. For example, if a cluster is running version + #: 1.17.7 and versions 1.17.9, 1.18.4, 1.18.6, and 1.19.1 are available, your cluster first is + #: upgraded to 1.18.6, then is upgraded to 1.19.1. + RAPID = "rapid" + #: Automatically upgrade the cluster to the latest supported patch release on minor version N-1, + #: where N is the latest supported minor version. For example, if a cluster is running version + #: 1.17.7 and versions 1.17.9, 1.18.4, 1.18.6, and 1.19.1 are available, your cluster is upgraded + #: to 1.18.6. + STABLE = "stable" + #: Automatically upgrade the cluster to the latest supported patch version when it becomes + #: available while keeping the minor version the same. For example, if a cluster is running + #: version 1.17.7 and versions 1.17.9, 1.18.4, 1.18.6, and 1.19.1 are available, your cluster is + #: upgraded to 1.17.9. + PATCH = "patch" + #: Automatically upgrade the node image to the latest version available. Microsoft provides + #: patches and new images for image nodes frequently (usually weekly), but your running nodes + #: won't get the new images unless you do a node image upgrade. Turning on the node-image channel + #: will automatically update your node images whenever a new version is available. + NODE_IMAGE = "node-image" + #: Disables auto-upgrades and keeps the cluster at its current version of Kubernetes. + NONE = "none" + +class WeekDay(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The weekday enum. + """ + + SUNDAY = "Sunday" + MONDAY = "Monday" + TUESDAY = "Tuesday" + WEDNESDAY = "Wednesday" + THURSDAY = "Thursday" + FRIDAY = "Friday" + SATURDAY = "Saturday" + +class WorkloadRuntime(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Determines the type of workload a node can run. + """ + + #: Nodes will use Kubelet to run standard OCI container workloads. + OCI_CONTAINER = "OCIContainer" + #: Nodes will use Krustlet to run WASM workloads using the WASI provider (Preview). + WASM_WASI = "WasmWasi" diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/models/_models_py3.py new file mode 100644 index 000000000000..e44bcdcb2342 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/models/_models_py3.py @@ -0,0 +1,7593 @@ +# 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 datetime +from typing import Dict, List, Optional, TYPE_CHECKING, Union + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + import __init__ as _models + + +class SubResource(msrest.serialization.Model): + """Reference to another subresource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: The name of the resource that is unique within a resource group. This name can be + used to access the resource. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(SubResource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class AgentPool(SubResource): + """Agent Pool. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: The name of the resource that is unique within a resource group. This name can be + used to access the resource. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar count: Number of agents (VMs) to host docker containers. Allowed values must be in the + range of 0 to 1000 (inclusive) for user pools and in the range of 1 to 1000 (inclusive) for + system pools. The default value is 1. + :vartype count: int + :ivar vm_size: VM size availability varies by region. If a node contains insufficient compute + resources (memory, cpu, etc) pods might fail to run correctly. For more details on restricted + VM sizes, see: https://docs.microsoft.com/azure/aks/quotas-skus-regions. + :vartype vm_size: str + :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine + in the master/agent pool. If you specify 0, it will apply the default osDisk size according to + the vmSize specified. + :vartype os_disk_size_gb: int + :ivar os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk + larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed + after creation. For more information see `Ephemeral OS + `_. Known values are: + "Managed", "Ephemeral". + :vartype os_disk_type: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.OSDiskType + :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data + root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + :vartype kubelet_disk_type: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.KubeletDiskType + :ivar workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer", "WasmWasi". + :vartype workload_runtime: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.WorkloadRuntime + :ivar message_of_the_day: A base64-encoded string which will be written to /etc/motd after + decoding. This allows customization of the message of the day for Linux nodes. It must not be + specified for Windows nodes. It must be a static string (i.e., will be printed raw and not be + executed as a script). + :vartype message_of_the_day: str + :ivar vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and used. + If no podSubnetID is specified, this applies to nodes and pods, otherwise it applies to just + nodes. This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. + :vartype vnet_subnet_id: str + :ivar pod_subnet_id: If omitted, pod IPs are statically assigned on the node subnet (see + vnetSubnetID for more details). This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. + :vartype pod_subnet_id: str + :ivar max_pods: The maximum number of pods that can run on a node. + :vartype max_pods: int + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". + :vartype os_type: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.OSType + :ivar os_sku: Specifies the OS SKU used by the agent pool. If not specified, the default is + Ubuntu if OSType=Linux or Windows2019 if OSType=Windows. And the default Windows OSSKU will be + changed to Windows2022 after Windows2019 is deprecated. Known values are: "Ubuntu", + "CBLMariner", "Windows2019", "Windows2022". + :vartype os_sku: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.OSSKU + :ivar max_count: The maximum number of nodes for auto-scaling. + :vartype max_count: int + :ivar min_count: The minimum number of nodes for auto-scaling. + :vartype min_count: int + :ivar enable_auto_scaling: Whether to enable auto-scaler. + :vartype enable_auto_scaling: bool + :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it + defaults to Delete. Known values are: "Delete", "Deallocate". + :vartype scale_down_mode: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ScaleDownMode + :ivar type_properties_type: The type of Agent Pool. Known values are: + "VirtualMachineScaleSets", "AvailabilitySet". + :vartype type_properties_type: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.AgentPoolType + :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional + information on agent pool restrictions and best practices, see: + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + :vartype mode: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.AgentPoolMode + :ivar orchestrator_version: Both patch version and are + supported. When is specified, the latest supported patch version is chosen + automatically. Updating the agent pool with the same once it has been created + will not trigger an upgrade, even if a newer patch version is available. As a best practice, + you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node + pool version must have the same major version as the control plane. The node pool minor version + must be within two minor versions of the control plane version. The node pool version cannot be + greater than the control plane version. For more information see `upgrading a node pool + `_. + :vartype orchestrator_version: str + :ivar current_orchestrator_version: If orchestratorVersion was a fully specified version + , this field will be exactly equal to it. If orchestratorVersion was + , this field will contain the full version being used. + :vartype current_orchestrator_version: str + :ivar node_image_version: The version of node image. + :vartype node_image_version: str + :ivar upgrade_settings: Settings for upgrading the agentpool. + :vartype upgrade_settings: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.AgentPoolUpgradeSettings + :ivar provisioning_state: The current deployment or provisioning state. + :vartype provisioning_state: str + :ivar power_state: When an Agent Pool is first created it is initially Running. The Agent Pool + can be stopped by setting this field to Stopped. A stopped Agent Pool stops all of its VMs and + does not accrue billing charges. An Agent Pool can only be stopped if it is Running and + provisioning state is Succeeded. + :vartype power_state: ~azure.mgmt.containerservice.v2022_06_02_preview.models.PowerState + :ivar availability_zones: The list of Availability zones to use for nodes. This can only be + specified if the AgentPoolType property is 'VirtualMachineScaleSets'. + :vartype availability_zones: list[str] + :ivar enable_node_public_ip: Some scenarios may require nodes in a node pool to receive their + own dedicated public IP addresses. A common scenario is for gaming workloads, where a console + needs to make a direct connection to a cloud virtual machine to minimize hops. For more + information see `assigning a public IP per node + `_. + The default is false. + :vartype enable_node_public_ip: bool + :ivar enable_custom_ca_trust: When set to true, AKS deploys a daemonset and host services to + sync custom certificate authorities from a user-provided config map into node trust stores. + Defaults to false. + :vartype enable_custom_ca_trust: bool + :ivar node_public_ip_prefix_id: This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. + :vartype node_public_ip_prefix_id: str + :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default + is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + :vartype scale_set_priority: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ScaleSetPriority + :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". + :vartype scale_set_eviction_policy: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ScaleSetEvictionPolicy + :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which + indicates the willingness to pay any on-demand price. For more details on spot pricing, see + `spot VMs pricing `_. + :vartype spot_max_price: float + :ivar tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale + set. + :vartype tags: dict[str, str] + :ivar node_labels: The node labels to be persisted across all nodes in agent pool. + :vartype node_labels: dict[str, str] + :ivar node_taints: The taints added to new nodes during node pool create and scale. For + example, key=value:NoSchedule. + :vartype node_taints: list[str] + :ivar proximity_placement_group_id: The ID for Proximity Placement Group. + :vartype proximity_placement_group_id: str + :ivar kubelet_config: The Kubelet configuration on the agent pool nodes. + :vartype kubelet_config: ~azure.mgmt.containerservice.v2022_06_02_preview.models.KubeletConfig + :ivar linux_os_config: The OS configuration of Linux agent nodes. + :vartype linux_os_config: ~azure.mgmt.containerservice.v2022_06_02_preview.models.LinuxOSConfig + :ivar enable_encryption_at_host: This is only supported on certain VM sizes and in certain + Azure regions. For more information, see: + https://docs.microsoft.com/azure/aks/enable-host-encryption. + :vartype enable_encryption_at_host: bool + :ivar enable_ultra_ssd: Whether to enable UltraSSD. + :vartype enable_ultra_ssd: bool + :ivar enable_fips: See `Add a FIPS-enabled node pool + `_ + for more details. + :vartype enable_fips: bool + :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + :vartype gpu_instance_profile: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.GPUInstanceProfile + :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool + will be created/upgraded using a snapshot. + :vartype creation_data: ~azure.mgmt.containerservice.v2022_06_02_preview.models.CreationData + :ivar capacity_reservation_group_id: AKS will associate the specified agent pool with the + Capacity Reservation Group. + :vartype capacity_reservation_group_id: str + :ivar host_group_id: This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}. + For more information see `Azure dedicated hosts + `_. + :vartype host_group_id: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'os_disk_size_gb': {'maximum': 2048, 'minimum': 0}, + 'current_orchestrator_version': {'readonly': True}, + 'node_image_version': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'count': {'key': 'properties.count', 'type': 'int'}, + 'vm_size': {'key': 'properties.vmSize', 'type': 'str'}, + 'os_disk_size_gb': {'key': 'properties.osDiskSizeGB', 'type': 'int'}, + 'os_disk_type': {'key': 'properties.osDiskType', 'type': 'str'}, + 'kubelet_disk_type': {'key': 'properties.kubeletDiskType', 'type': 'str'}, + 'workload_runtime': {'key': 'properties.workloadRuntime', 'type': 'str'}, + 'message_of_the_day': {'key': 'properties.messageOfTheDay', 'type': 'str'}, + 'vnet_subnet_id': {'key': 'properties.vnetSubnetID', 'type': 'str'}, + 'pod_subnet_id': {'key': 'properties.podSubnetID', 'type': 'str'}, + 'max_pods': {'key': 'properties.maxPods', 'type': 'int'}, + 'os_type': {'key': 'properties.osType', 'type': 'str'}, + 'os_sku': {'key': 'properties.osSKU', 'type': 'str'}, + 'max_count': {'key': 'properties.maxCount', 'type': 'int'}, + 'min_count': {'key': 'properties.minCount', 'type': 'int'}, + 'enable_auto_scaling': {'key': 'properties.enableAutoScaling', 'type': 'bool'}, + 'scale_down_mode': {'key': 'properties.scaleDownMode', 'type': 'str'}, + 'type_properties_type': {'key': 'properties.type', 'type': 'str'}, + 'mode': {'key': 'properties.mode', 'type': 'str'}, + 'orchestrator_version': {'key': 'properties.orchestratorVersion', 'type': 'str'}, + 'current_orchestrator_version': {'key': 'properties.currentOrchestratorVersion', 'type': 'str'}, + 'node_image_version': {'key': 'properties.nodeImageVersion', 'type': 'str'}, + 'upgrade_settings': {'key': 'properties.upgradeSettings', 'type': 'AgentPoolUpgradeSettings'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'power_state': {'key': 'properties.powerState', 'type': 'PowerState'}, + 'availability_zones': {'key': 'properties.availabilityZones', 'type': '[str]'}, + 'enable_node_public_ip': {'key': 'properties.enableNodePublicIP', 'type': 'bool'}, + 'enable_custom_ca_trust': {'key': 'properties.enableCustomCATrust', 'type': 'bool'}, + 'node_public_ip_prefix_id': {'key': 'properties.nodePublicIPPrefixID', 'type': 'str'}, + 'scale_set_priority': {'key': 'properties.scaleSetPriority', 'type': 'str'}, + 'scale_set_eviction_policy': {'key': 'properties.scaleSetEvictionPolicy', 'type': 'str'}, + 'spot_max_price': {'key': 'properties.spotMaxPrice', 'type': 'float'}, + 'tags': {'key': 'properties.tags', 'type': '{str}'}, + 'node_labels': {'key': 'properties.nodeLabels', 'type': '{str}'}, + 'node_taints': {'key': 'properties.nodeTaints', 'type': '[str]'}, + 'proximity_placement_group_id': {'key': 'properties.proximityPlacementGroupID', 'type': 'str'}, + 'kubelet_config': {'key': 'properties.kubeletConfig', 'type': 'KubeletConfig'}, + 'linux_os_config': {'key': 'properties.linuxOSConfig', 'type': 'LinuxOSConfig'}, + 'enable_encryption_at_host': {'key': 'properties.enableEncryptionAtHost', 'type': 'bool'}, + 'enable_ultra_ssd': {'key': 'properties.enableUltraSSD', 'type': 'bool'}, + 'enable_fips': {'key': 'properties.enableFIPS', 'type': 'bool'}, + 'gpu_instance_profile': {'key': 'properties.gpuInstanceProfile', 'type': 'str'}, + 'creation_data': {'key': 'properties.creationData', 'type': 'CreationData'}, + 'capacity_reservation_group_id': {'key': 'properties.capacityReservationGroupID', 'type': 'str'}, + 'host_group_id': {'key': 'properties.hostGroupID', 'type': 'str'}, + } + + def __init__( + self, + *, + count: Optional[int] = None, + vm_size: Optional[str] = None, + os_disk_size_gb: Optional[int] = None, + os_disk_type: Optional[Union[str, "_models.OSDiskType"]] = None, + kubelet_disk_type: Optional[Union[str, "_models.KubeletDiskType"]] = None, + workload_runtime: Optional[Union[str, "_models.WorkloadRuntime"]] = None, + message_of_the_day: Optional[str] = None, + vnet_subnet_id: Optional[str] = None, + pod_subnet_id: Optional[str] = None, + max_pods: Optional[int] = None, + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_sku: Optional[Union[str, "_models.OSSKU"]] = None, + max_count: Optional[int] = None, + min_count: Optional[int] = None, + enable_auto_scaling: Optional[bool] = None, + scale_down_mode: Optional[Union[str, "_models.ScaleDownMode"]] = None, + type_properties_type: Optional[Union[str, "_models.AgentPoolType"]] = None, + mode: Optional[Union[str, "_models.AgentPoolMode"]] = None, + orchestrator_version: Optional[str] = None, + upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, + power_state: Optional["_models.PowerState"] = None, + availability_zones: Optional[List[str]] = None, + enable_node_public_ip: Optional[bool] = None, + enable_custom_ca_trust: Optional[bool] = None, + node_public_ip_prefix_id: Optional[str] = None, + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", + spot_max_price: Optional[float] = -1, + tags: Optional[Dict[str, str]] = None, + node_labels: Optional[Dict[str, str]] = None, + node_taints: Optional[List[str]] = None, + proximity_placement_group_id: Optional[str] = None, + kubelet_config: Optional["_models.KubeletConfig"] = None, + linux_os_config: Optional["_models.LinuxOSConfig"] = None, + enable_encryption_at_host: Optional[bool] = None, + enable_ultra_ssd: Optional[bool] = None, + enable_fips: Optional[bool] = None, + gpu_instance_profile: Optional[Union[str, "_models.GPUInstanceProfile"]] = None, + creation_data: Optional["_models.CreationData"] = None, + capacity_reservation_group_id: Optional[str] = None, + host_group_id: Optional[str] = None, + **kwargs + ): + """ + :keyword count: Number of agents (VMs) to host docker containers. Allowed values must be in the + range of 0 to 1000 (inclusive) for user pools and in the range of 1 to 1000 (inclusive) for + system pools. The default value is 1. + :paramtype count: int + :keyword vm_size: VM size availability varies by region. If a node contains insufficient + compute resources (memory, cpu, etc) pods might fail to run correctly. For more details on + restricted VM sizes, see: https://docs.microsoft.com/azure/aks/quotas-skus-regions. + :paramtype vm_size: str + :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every + machine in the master/agent pool. If you specify 0, it will apply the default osDisk size + according to the vmSize specified. + :paramtype os_disk_size_gb: int + :keyword os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk + larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed + after creation. For more information see `Ephemeral OS + `_. Known values are: + "Managed", "Ephemeral". + :paramtype os_disk_type: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.OSDiskType + :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime + data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + :paramtype kubelet_disk_type: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.KubeletDiskType + :keyword workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer", "WasmWasi". + :paramtype workload_runtime: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.WorkloadRuntime + :keyword message_of_the_day: A base64-encoded string which will be written to /etc/motd after + decoding. This allows customization of the message of the day for Linux nodes. It must not be + specified for Windows nodes. It must be a static string (i.e., will be printed raw and not be + executed as a script). + :paramtype message_of_the_day: str + :keyword vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and + used. If no podSubnetID is specified, this applies to nodes and pods, otherwise it applies to + just nodes. This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. + :paramtype vnet_subnet_id: str + :keyword pod_subnet_id: If omitted, pod IPs are statically assigned on the node subnet (see + vnetSubnetID for more details). This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. + :paramtype pod_subnet_id: str + :keyword max_pods: The maximum number of pods that can run on a node. + :paramtype max_pods: int + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". + :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.OSType + :keyword os_sku: Specifies the OS SKU used by the agent pool. If not specified, the default is + Ubuntu if OSType=Linux or Windows2019 if OSType=Windows. And the default Windows OSSKU will be + changed to Windows2022 after Windows2019 is deprecated. Known values are: "Ubuntu", + "CBLMariner", "Windows2019", "Windows2022". + :paramtype os_sku: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.OSSKU + :keyword max_count: The maximum number of nodes for auto-scaling. + :paramtype max_count: int + :keyword min_count: The minimum number of nodes for auto-scaling. + :paramtype min_count: int + :keyword enable_auto_scaling: Whether to enable auto-scaler. + :paramtype enable_auto_scaling: bool + :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, + it defaults to Delete. Known values are: "Delete", "Deallocate". + :paramtype scale_down_mode: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ScaleDownMode + :keyword type_properties_type: The type of Agent Pool. Known values are: + "VirtualMachineScaleSets", "AvailabilitySet". + :paramtype type_properties_type: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.AgentPoolType + :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For + additional information on agent pool restrictions and best practices, see: + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + :paramtype mode: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.AgentPoolMode + :keyword orchestrator_version: Both patch version and are + supported. When is specified, the latest supported patch version is chosen + automatically. Updating the agent pool with the same once it has been created + will not trigger an upgrade, even if a newer patch version is available. As a best practice, + you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node + pool version must have the same major version as the control plane. The node pool minor version + must be within two minor versions of the control plane version. The node pool version cannot be + greater than the control plane version. For more information see `upgrading a node pool + `_. + :paramtype orchestrator_version: str + :keyword upgrade_settings: Settings for upgrading the agentpool. + :paramtype upgrade_settings: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.AgentPoolUpgradeSettings + :keyword power_state: When an Agent Pool is first created it is initially Running. The Agent + Pool can be stopped by setting this field to Stopped. A stopped Agent Pool stops all of its VMs + and does not accrue billing charges. An Agent Pool can only be stopped if it is Running and + provisioning state is Succeeded. + :paramtype power_state: ~azure.mgmt.containerservice.v2022_06_02_preview.models.PowerState + :keyword availability_zones: The list of Availability zones to use for nodes. This can only be + specified if the AgentPoolType property is 'VirtualMachineScaleSets'. + :paramtype availability_zones: list[str] + :keyword enable_node_public_ip: Some scenarios may require nodes in a node pool to receive + their own dedicated public IP addresses. A common scenario is for gaming workloads, where a + console needs to make a direct connection to a cloud virtual machine to minimize hops. For more + information see `assigning a public IP per node + `_. + The default is false. + :paramtype enable_node_public_ip: bool + :keyword enable_custom_ca_trust: When set to true, AKS deploys a daemonset and host services to + sync custom certificate authorities from a user-provided config map into node trust stores. + Defaults to false. + :paramtype enable_custom_ca_trust: bool + :keyword node_public_ip_prefix_id: This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. + :paramtype node_public_ip_prefix_id: str + :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the + default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + :paramtype scale_set_priority: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ScaleSetPriority + :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". + :paramtype scale_set_eviction_policy: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ScaleSetEvictionPolicy + :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which + indicates the willingness to pay any on-demand price. For more details on spot pricing, see + `spot VMs pricing `_. + :paramtype spot_max_price: float + :keyword tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale + set. + :paramtype tags: dict[str, str] + :keyword node_labels: The node labels to be persisted across all nodes in agent pool. + :paramtype node_labels: dict[str, str] + :keyword node_taints: The taints added to new nodes during node pool create and scale. For + example, key=value:NoSchedule. + :paramtype node_taints: list[str] + :keyword proximity_placement_group_id: The ID for Proximity Placement Group. + :paramtype proximity_placement_group_id: str + :keyword kubelet_config: The Kubelet configuration on the agent pool nodes. + :paramtype kubelet_config: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.KubeletConfig + :keyword linux_os_config: The OS configuration of Linux agent nodes. + :paramtype linux_os_config: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.LinuxOSConfig + :keyword enable_encryption_at_host: This is only supported on certain VM sizes and in certain + Azure regions. For more information, see: + https://docs.microsoft.com/azure/aks/enable-host-encryption. + :paramtype enable_encryption_at_host: bool + :keyword enable_ultra_ssd: Whether to enable UltraSSD. + :paramtype enable_ultra_ssd: bool + :keyword enable_fips: See `Add a FIPS-enabled node pool + `_ + for more details. + :paramtype enable_fips: bool + :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + "MIG7g". + :paramtype gpu_instance_profile: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.GPUInstanceProfile + :keyword creation_data: CreationData to be used to specify the source Snapshot ID if the node + pool will be created/upgraded using a snapshot. + :paramtype creation_data: ~azure.mgmt.containerservice.v2022_06_02_preview.models.CreationData + :keyword capacity_reservation_group_id: AKS will associate the specified agent pool with the + Capacity Reservation Group. + :paramtype capacity_reservation_group_id: str + :keyword host_group_id: This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}. + For more information see `Azure dedicated hosts + `_. + :paramtype host_group_id: str + """ + super(AgentPool, self).__init__(**kwargs) + self.count = count + self.vm_size = vm_size + self.os_disk_size_gb = os_disk_size_gb + self.os_disk_type = os_disk_type + self.kubelet_disk_type = kubelet_disk_type + self.workload_runtime = workload_runtime + self.message_of_the_day = message_of_the_day + self.vnet_subnet_id = vnet_subnet_id + self.pod_subnet_id = pod_subnet_id + self.max_pods = max_pods + self.os_type = os_type + self.os_sku = os_sku + self.max_count = max_count + self.min_count = min_count + self.enable_auto_scaling = enable_auto_scaling + self.scale_down_mode = scale_down_mode + self.type_properties_type = type_properties_type + self.mode = mode + self.orchestrator_version = orchestrator_version + self.current_orchestrator_version = None + self.node_image_version = None + self.upgrade_settings = upgrade_settings + self.provisioning_state = None + self.power_state = power_state + self.availability_zones = availability_zones + self.enable_node_public_ip = enable_node_public_ip + self.enable_custom_ca_trust = enable_custom_ca_trust + self.node_public_ip_prefix_id = node_public_ip_prefix_id + self.scale_set_priority = scale_set_priority + self.scale_set_eviction_policy = scale_set_eviction_policy + self.spot_max_price = spot_max_price + self.tags = tags + self.node_labels = node_labels + self.node_taints = node_taints + self.proximity_placement_group_id = proximity_placement_group_id + self.kubelet_config = kubelet_config + self.linux_os_config = linux_os_config + self.enable_encryption_at_host = enable_encryption_at_host + self.enable_ultra_ssd = enable_ultra_ssd + self.enable_fips = enable_fips + self.gpu_instance_profile = gpu_instance_profile + self.creation_data = creation_data + self.capacity_reservation_group_id = capacity_reservation_group_id + self.host_group_id = host_group_id + + +class AgentPoolAvailableVersions(msrest.serialization.Model): + """The list of available versions for an agent pool. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The ID of the agent pool version list. + :vartype id: str + :ivar name: The name of the agent pool version list. + :vartype name: str + :ivar type: Type of the agent pool version list. + :vartype type: str + :ivar agent_pool_versions: List of versions available for agent pool. + :vartype agent_pool_versions: + list[~azure.mgmt.containerservice.v2022_06_02_preview.models.AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'agent_pool_versions': {'key': 'properties.agentPoolVersions', 'type': '[AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem]'}, + } + + def __init__( + self, + *, + agent_pool_versions: Optional[List["_models.AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem"]] = None, + **kwargs + ): + """ + :keyword agent_pool_versions: List of versions available for agent pool. + :paramtype agent_pool_versions: + list[~azure.mgmt.containerservice.v2022_06_02_preview.models.AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem] + """ + super(AgentPoolAvailableVersions, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.agent_pool_versions = agent_pool_versions + + +class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(msrest.serialization.Model): + """AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem. + + :ivar default: Whether this version is the default agent pool version. + :vartype default: bool + :ivar kubernetes_version: The Kubernetes version (major.minor.patch). + :vartype kubernetes_version: str + :ivar is_preview: Whether Kubernetes version is currently in preview. + :vartype is_preview: bool + """ + + _attribute_map = { + 'default': {'key': 'default', 'type': 'bool'}, + 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, + 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + } + + def __init__( + self, + *, + default: Optional[bool] = None, + kubernetes_version: Optional[str] = None, + is_preview: Optional[bool] = None, + **kwargs + ): + """ + :keyword default: Whether this version is the default agent pool version. + :paramtype default: bool + :keyword kubernetes_version: The Kubernetes version (major.minor.patch). + :paramtype kubernetes_version: str + :keyword is_preview: Whether Kubernetes version is currently in preview. + :paramtype is_preview: bool + """ + super(AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem, self).__init__(**kwargs) + self.default = default + self.kubernetes_version = kubernetes_version + self.is_preview = is_preview + + +class AgentPoolListResult(msrest.serialization.Model): + """The response from the List Agent Pools operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The list of agent pools. + :vartype value: list[~azure.mgmt.containerservice.v2022_06_02_preview.models.AgentPool] + :ivar next_link: The URL to get the next set of agent pool results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[AgentPool]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["_models.AgentPool"]] = None, + **kwargs + ): + """ + :keyword value: The list of agent pools. + :paramtype value: list[~azure.mgmt.containerservice.v2022_06_02_preview.models.AgentPool] + """ + super(AgentPoolListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class AgentPoolUpgradeProfile(msrest.serialization.Model): + """The list of available upgrades for an agent pool. + + 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: The ID of the agent pool upgrade profile. + :vartype id: str + :ivar name: The name of the agent pool upgrade profile. + :vartype name: str + :ivar type: The type of the agent pool upgrade profile. + :vartype type: str + :ivar kubernetes_version: Required. The Kubernetes version (major.minor.patch). + :vartype kubernetes_version: str + :ivar os_type: Required. The operating system type. The default is Linux. Known values are: + "Linux", "Windows". Default value: "Linux". + :vartype os_type: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.OSType + :ivar upgrades: List of orchestrator types and versions available for upgrade. + :vartype upgrades: + list[~azure.mgmt.containerservice.v2022_06_02_preview.models.AgentPoolUpgradeProfilePropertiesUpgradesItem] + :ivar latest_node_image_version: The latest AKS supported node image version. + :vartype latest_node_image_version: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'kubernetes_version': {'required': True}, + 'os_type': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, + 'os_type': {'key': 'properties.osType', 'type': 'str'}, + 'upgrades': {'key': 'properties.upgrades', 'type': '[AgentPoolUpgradeProfilePropertiesUpgradesItem]'}, + 'latest_node_image_version': {'key': 'properties.latestNodeImageVersion', 'type': 'str'}, + } + + def __init__( + self, + *, + kubernetes_version: str, + os_type: Union[str, "_models.OSType"] = "Linux", + upgrades: Optional[List["_models.AgentPoolUpgradeProfilePropertiesUpgradesItem"]] = None, + latest_node_image_version: Optional[str] = None, + **kwargs + ): + """ + :keyword kubernetes_version: Required. The Kubernetes version (major.minor.patch). + :paramtype kubernetes_version: str + :keyword os_type: Required. The operating system type. The default is Linux. Known values are: + "Linux", "Windows". Default value: "Linux". + :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.OSType + :keyword upgrades: List of orchestrator types and versions available for upgrade. + :paramtype upgrades: + list[~azure.mgmt.containerservice.v2022_06_02_preview.models.AgentPoolUpgradeProfilePropertiesUpgradesItem] + :keyword latest_node_image_version: The latest AKS supported node image version. + :paramtype latest_node_image_version: str + """ + super(AgentPoolUpgradeProfile, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.kubernetes_version = kubernetes_version + self.os_type = os_type + self.upgrades = upgrades + self.latest_node_image_version = latest_node_image_version + + +class AgentPoolUpgradeProfilePropertiesUpgradesItem(msrest.serialization.Model): + """AgentPoolUpgradeProfilePropertiesUpgradesItem. + + :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 + """ + + _attribute_map = { + 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, + 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + } + + def __init__( + self, + *, + kubernetes_version: Optional[str] = None, + is_preview: Optional[bool] = None, + **kwargs + ): + """ + :keyword kubernetes_version: The Kubernetes version (major.minor.patch). + :paramtype kubernetes_version: str + :keyword is_preview: Whether the Kubernetes version is currently in preview. + :paramtype is_preview: bool + """ + super(AgentPoolUpgradeProfilePropertiesUpgradesItem, self).__init__(**kwargs) + self.kubernetes_version = kubernetes_version + self.is_preview = is_preview + + +class AgentPoolUpgradeSettings(msrest.serialization.Model): + """Settings for upgrading an agentpool. + + :ivar max_surge: This can either be set to an integer (e.g. '5') or a percentage (e.g. '50%'). + If a percentage is specified, it is the percentage of the total agent pool size at the time of + the upgrade. For percentages, fractional nodes are rounded up. If not specified, the default is + 1. For more information, including best practices, see: + https://docs.microsoft.com/azure/aks/upgrade-cluster#customize-node-surge-upgrade. + :vartype max_surge: str + """ + + _attribute_map = { + 'max_surge': {'key': 'maxSurge', 'type': 'str'}, + } + + def __init__( + self, + *, + max_surge: Optional[str] = None, + **kwargs + ): + """ + :keyword max_surge: This can either be set to an integer (e.g. '5') or a percentage (e.g. + '50%'). If a percentage is specified, it is the percentage of the total agent pool size at the + time of the upgrade. For percentages, fractional nodes are rounded up. If not specified, the + default is 1. For more information, including best practices, see: + https://docs.microsoft.com/azure/aks/upgrade-cluster#customize-node-surge-upgrade. + :paramtype max_surge: str + """ + super(AgentPoolUpgradeSettings, self).__init__(**kwargs) + self.max_surge = max_surge + + +class Resource(msrest.serialization.Model): + """Common fields that are returned in the response for all Azure Resource Manager resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.containerservice.v2022_06_02_preview.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 + ): + """ + """ + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.system_data = None + + +class AzureEntityResource(Resource): + """The resource model definition for an Azure Resource Manager resource with an etag. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.containerservice.v2022_06_02_preview.models.SystemData + :ivar etag: Resource Etag. + :vartype etag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'etag': {'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'}, + 'etag': {'key': 'etag', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(AzureEntityResource, self).__init__(**kwargs) + self.etag = None + + +class AzureKeyVaultKms(msrest.serialization.Model): + """Azure Key Vault key management service settings for the security profile. + + :ivar enabled: Whether to enable Azure Key Vault key management service. The default is false. + :vartype enabled: bool + :ivar key_id: Identifier of Azure Key Vault key. See `key identifier format + `_ + for more details. When Azure Key Vault key management service is enabled, this field is + required and must be a valid key identifier. When Azure Key Vault key management service is + disabled, leave the field empty. + :vartype key_id: str + :ivar key_vault_network_access: Network access of key vault. The possible values are ``Public`` + and ``Private``. ``Public`` means the key vault allows public access from all networks. + ``Private`` means the key vault disables public access and enables private link. The default + value is ``Public``. Known values are: "Public", "Private". Default value: "Public". + :vartype key_vault_network_access: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.KeyVaultNetworkAccessTypes + :ivar key_vault_resource_id: Resource ID of key vault. When keyVaultNetworkAccess is + ``Private``\ , this field is required and must be a valid resource ID. When + keyVaultNetworkAccess is ``Public``\ , leave the field empty. + :vartype key_vault_resource_id: str + """ + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'key_id': {'key': 'keyId', 'type': 'str'}, + 'key_vault_network_access': {'key': 'keyVaultNetworkAccess', 'type': 'str'}, + 'key_vault_resource_id': {'key': 'keyVaultResourceId', 'type': 'str'}, + } + + def __init__( + self, + *, + enabled: Optional[bool] = None, + key_id: Optional[str] = None, + key_vault_network_access: Optional[Union[str, "_models.KeyVaultNetworkAccessTypes"]] = "Public", + key_vault_resource_id: Optional[str] = None, + **kwargs + ): + """ + :keyword enabled: Whether to enable Azure Key Vault key management service. The default is + false. + :paramtype enabled: bool + :keyword key_id: Identifier of Azure Key Vault key. See `key identifier format + `_ + for more details. When Azure Key Vault key management service is enabled, this field is + required and must be a valid key identifier. When Azure Key Vault key management service is + disabled, leave the field empty. + :paramtype key_id: str + :keyword key_vault_network_access: Network access of key vault. The possible values are + ``Public`` and ``Private``. ``Public`` means the key vault allows public access from all + networks. ``Private`` means the key vault disables public access and enables private link. The + default value is ``Public``. Known values are: "Public", "Private". Default value: "Public". + :paramtype key_vault_network_access: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.KeyVaultNetworkAccessTypes + :keyword key_vault_resource_id: Resource ID of key vault. When keyVaultNetworkAccess is + ``Private``\ , this field is required and must be a valid resource ID. When + keyVaultNetworkAccess is ``Public``\ , leave the field empty. + :paramtype key_vault_resource_id: str + """ + super(AzureKeyVaultKms, self).__init__(**kwargs) + self.enabled = enabled + self.key_id = key_id + self.key_vault_network_access = key_vault_network_access + self.key_vault_resource_id = key_vault_resource_id + + +class CloudErrorBody(msrest.serialization.Model): + """An error response from the Container service. + + :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :vartype code: str + :ivar message: A message describing the error, intended to be suitable for display in a user + interface. + :vartype message: str + :ivar target: The target of the particular error. For example, the name of the property in + error. + :vartype target: str + :ivar details: A list of additional details about the error. + :vartype details: list[~azure.mgmt.containerservice.v2022_06_02_preview.models.CloudErrorBody] + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, + } + + def __init__( + self, + *, + code: Optional[str] = None, + message: Optional[str] = None, + target: Optional[str] = None, + details: Optional[List["_models.CloudErrorBody"]] = None, + **kwargs + ): + """ + :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :paramtype code: str + :keyword message: A message describing the error, intended to be suitable for display in a user + interface. + :paramtype message: str + :keyword target: The target of the particular error. For example, the name of the property in + error. + :paramtype target: str + :keyword details: A list of additional details about the error. + :paramtype details: + list[~azure.mgmt.containerservice.v2022_06_02_preview.models.CloudErrorBody] + """ + super(CloudErrorBody, self).__init__(**kwargs) + self.code = code + self.message = message + self.target = target + self.details = details + + +class ContainerServiceDiagnosticsProfile(msrest.serialization.Model): + """Profile for diagnostics on the container service cluster. + + All required parameters must be populated in order to send to Azure. + + :ivar vm_diagnostics: Required. Profile for diagnostics on the container service VMs. + :vartype vm_diagnostics: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ContainerServiceVMDiagnostics + """ + + _validation = { + 'vm_diagnostics': {'required': True}, + } + + _attribute_map = { + 'vm_diagnostics': {'key': 'vmDiagnostics', 'type': 'ContainerServiceVMDiagnostics'}, + } + + def __init__( + self, + *, + vm_diagnostics: "_models.ContainerServiceVMDiagnostics", + **kwargs + ): + """ + :keyword vm_diagnostics: Required. Profile for diagnostics on the container service VMs. + :paramtype vm_diagnostics: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ContainerServiceVMDiagnostics + """ + super(ContainerServiceDiagnosticsProfile, self).__init__(**kwargs) + self.vm_diagnostics = vm_diagnostics + + +class ContainerServiceLinuxProfile(msrest.serialization.Model): + """Profile for Linux VMs in the container service cluster. + + All required parameters must be populated in order to send to Azure. + + :ivar admin_username: Required. The administrator username to use for Linux VMs. + :vartype admin_username: str + :ivar ssh: Required. The SSH configuration for Linux-based VMs running on Azure. + :vartype ssh: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ContainerServiceSshConfiguration + """ + + _validation = { + 'admin_username': {'required': True, 'pattern': r'^[A-Za-z][-A-Za-z0-9_]*$'}, + 'ssh': {'required': True}, + } + + _attribute_map = { + 'admin_username': {'key': 'adminUsername', 'type': 'str'}, + 'ssh': {'key': 'ssh', 'type': 'ContainerServiceSshConfiguration'}, + } + + def __init__( + self, + *, + admin_username: str, + ssh: "_models.ContainerServiceSshConfiguration", + **kwargs + ): + """ + :keyword admin_username: Required. The administrator username to use for Linux VMs. + :paramtype admin_username: str + :keyword ssh: Required. The SSH configuration for Linux-based VMs running on Azure. + :paramtype ssh: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ContainerServiceSshConfiguration + """ + super(ContainerServiceLinuxProfile, self).__init__(**kwargs) + self.admin_username = admin_username + self.ssh = ssh + + +class ContainerServiceMasterProfile(msrest.serialization.Model): + """Profile for the container service master. + + 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 count: Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, + and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". + :vartype count: int or ~azure.mgmt.containerservice.v2022_06_02_preview.models.Count + :ivar dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. + :vartype dns_prefix: str + :ivar vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", + "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", + "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", + "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", "Standard_B8ms", + "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", "Standard_D12", + "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", + "Standard_D13_v2_Promo", "Standard_D14", "Standard_D14_v2", "Standard_D14_v2_Promo", + "Standard_D15_v2", "Standard_D16_v3", "Standard_D16s_v3", "Standard_D1_v2", "Standard_D2", + "Standard_D2_v2", "Standard_D2_v2_Promo", "Standard_D2_v3", "Standard_D2s_v3", "Standard_D3", + "Standard_D32_v3", "Standard_D32s_v3", "Standard_D3_v2", "Standard_D3_v2_Promo", "Standard_D4", + "Standard_D4_v2", "Standard_D4_v2_Promo", "Standard_D4_v3", "Standard_D4s_v3", + "Standard_D5_v2", "Standard_D5_v2_Promo", "Standard_D64_v3", "Standard_D64s_v3", + "Standard_D8_v3", "Standard_D8s_v3", "Standard_DS1", "Standard_DS11", "Standard_DS11_v2", + "Standard_DS11_v2_Promo", "Standard_DS12", "Standard_DS12_v2", "Standard_DS12_v2_Promo", + "Standard_DS13", "Standard_DS13-2_v2", "Standard_DS13-4_v2", "Standard_DS13_v2", + "Standard_DS13_v2_Promo", "Standard_DS14", "Standard_DS14-4_v2", "Standard_DS14-8_v2", + "Standard_DS14_v2", "Standard_DS14_v2_Promo", "Standard_DS15_v2", "Standard_DS1_v2", + "Standard_DS2", "Standard_DS2_v2", "Standard_DS2_v2_Promo", "Standard_DS3", "Standard_DS3_v2", + "Standard_DS3_v2_Promo", "Standard_DS4", "Standard_DS4_v2", "Standard_DS4_v2_Promo", + "Standard_DS5_v2", "Standard_DS5_v2_Promo", "Standard_E16_v3", "Standard_E16s_v3", + "Standard_E2_v3", "Standard_E2s_v3", "Standard_E32-16s_v3", "Standard_E32-8s_v3", + "Standard_E32_v3", "Standard_E32s_v3", "Standard_E4_v3", "Standard_E4s_v3", + "Standard_E64-16s_v3", "Standard_E64-32s_v3", "Standard_E64_v3", "Standard_E64s_v3", + "Standard_E8_v3", "Standard_E8s_v3", "Standard_F1", "Standard_F16", "Standard_F16s", + "Standard_F16s_v2", "Standard_F1s", "Standard_F2", "Standard_F2s", "Standard_F2s_v2", + "Standard_F32s_v2", "Standard_F4", "Standard_F4s", "Standard_F4s_v2", "Standard_F64s_v2", + "Standard_F72s_v2", "Standard_F8", "Standard_F8s", "Standard_F8s_v2", "Standard_G1", + "Standard_G2", "Standard_G3", "Standard_G4", "Standard_G5", "Standard_GS1", "Standard_GS2", + "Standard_GS3", "Standard_GS4", "Standard_GS4-4", "Standard_GS4-8", "Standard_GS5", + "Standard_GS5-16", "Standard_GS5-8", "Standard_H16", "Standard_H16m", "Standard_H16mr", + "Standard_H16r", "Standard_H8", "Standard_H8m", "Standard_L16s", "Standard_L32s", + "Standard_L4s", "Standard_L8s", "Standard_M128-32ms", "Standard_M128-64ms", "Standard_M128ms", + "Standard_M128s", "Standard_M64-16ms", "Standard_M64-32ms", "Standard_M64ms", "Standard_M64s", + "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", + "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", + "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + :vartype vm_size: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ContainerServiceVMSizeTypes + :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine + in this master/agent pool. If you specify 0, it will apply the default osDisk size according to + the vmSize specified. + :vartype os_disk_size_gb: int + :ivar vnet_subnet_id: VNet SubnetID specifies the VNet's subnet identifier. + :vartype vnet_subnet_id: str + :ivar first_consecutive_static_ip: FirstConsecutiveStaticIP used to specify the first static ip + of masters. + :vartype first_consecutive_static_ip: str + :ivar storage_profile: Storage profile specifies what kind of storage used. Choose from + StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the + orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". + :vartype storage_profile: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ContainerServiceStorageProfileTypes + :ivar fqdn: FQDN for the master pool. + :vartype fqdn: str + """ + + _validation = { + 'dns_prefix': {'required': True}, + 'vm_size': {'required': True}, + 'os_disk_size_gb': {'maximum': 2048, 'minimum': 0}, + 'fqdn': {'readonly': True}, + } + + _attribute_map = { + 'count': {'key': 'count', 'type': 'int'}, + 'dns_prefix': {'key': 'dnsPrefix', 'type': 'str'}, + 'vm_size': {'key': 'vmSize', 'type': 'str'}, + 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, + 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, + 'first_consecutive_static_ip': {'key': 'firstConsecutiveStaticIP', 'type': 'str'}, + 'storage_profile': {'key': 'storageProfile', 'type': 'str'}, + 'fqdn': {'key': 'fqdn', 'type': 'str'}, + } + + def __init__( + self, + *, + dns_prefix: str, + vm_size: Union[str, "_models.ContainerServiceVMSizeTypes"], + count: Optional[Union[int, "_models.Count"]] = 1, + os_disk_size_gb: Optional[int] = None, + vnet_subnet_id: Optional[str] = None, + first_consecutive_static_ip: Optional[str] = "10.240.255.5", + storage_profile: Optional[Union[str, "_models.ContainerServiceStorageProfileTypes"]] = None, + **kwargs + ): + """ + :keyword count: Number of masters (VMs) in the container service cluster. Allowed values are 1, + 3, and 5. The default value is 1. Known values are: 1, 3, 5. Default value: "1". + :paramtype count: int or ~azure.mgmt.containerservice.v2022_06_02_preview.models.Count + :keyword dns_prefix: Required. DNS prefix to be used to create the FQDN for the master pool. + :paramtype dns_prefix: str + :keyword vm_size: Required. Size of agent VMs. Known values are: "Standard_A1", "Standard_A10", + "Standard_A11", "Standard_A1_v2", "Standard_A2", "Standard_A2_v2", "Standard_A2m_v2", + "Standard_A3", "Standard_A4", "Standard_A4_v2", "Standard_A4m_v2", "Standard_A5", + "Standard_A6", "Standard_A7", "Standard_A8", "Standard_A8_v2", "Standard_A8m_v2", + "Standard_A9", "Standard_B2ms", "Standard_B2s", "Standard_B4ms", "Standard_B8ms", + "Standard_D1", "Standard_D11", "Standard_D11_v2", "Standard_D11_v2_Promo", "Standard_D12", + "Standard_D12_v2", "Standard_D12_v2_Promo", "Standard_D13", "Standard_D13_v2", + "Standard_D13_v2_Promo", "Standard_D14", "Standard_D14_v2", "Standard_D14_v2_Promo", + "Standard_D15_v2", "Standard_D16_v3", "Standard_D16s_v3", "Standard_D1_v2", "Standard_D2", + "Standard_D2_v2", "Standard_D2_v2_Promo", "Standard_D2_v3", "Standard_D2s_v3", "Standard_D3", + "Standard_D32_v3", "Standard_D32s_v3", "Standard_D3_v2", "Standard_D3_v2_Promo", "Standard_D4", + "Standard_D4_v2", "Standard_D4_v2_Promo", "Standard_D4_v3", "Standard_D4s_v3", + "Standard_D5_v2", "Standard_D5_v2_Promo", "Standard_D64_v3", "Standard_D64s_v3", + "Standard_D8_v3", "Standard_D8s_v3", "Standard_DS1", "Standard_DS11", "Standard_DS11_v2", + "Standard_DS11_v2_Promo", "Standard_DS12", "Standard_DS12_v2", "Standard_DS12_v2_Promo", + "Standard_DS13", "Standard_DS13-2_v2", "Standard_DS13-4_v2", "Standard_DS13_v2", + "Standard_DS13_v2_Promo", "Standard_DS14", "Standard_DS14-4_v2", "Standard_DS14-8_v2", + "Standard_DS14_v2", "Standard_DS14_v2_Promo", "Standard_DS15_v2", "Standard_DS1_v2", + "Standard_DS2", "Standard_DS2_v2", "Standard_DS2_v2_Promo", "Standard_DS3", "Standard_DS3_v2", + "Standard_DS3_v2_Promo", "Standard_DS4", "Standard_DS4_v2", "Standard_DS4_v2_Promo", + "Standard_DS5_v2", "Standard_DS5_v2_Promo", "Standard_E16_v3", "Standard_E16s_v3", + "Standard_E2_v3", "Standard_E2s_v3", "Standard_E32-16s_v3", "Standard_E32-8s_v3", + "Standard_E32_v3", "Standard_E32s_v3", "Standard_E4_v3", "Standard_E4s_v3", + "Standard_E64-16s_v3", "Standard_E64-32s_v3", "Standard_E64_v3", "Standard_E64s_v3", + "Standard_E8_v3", "Standard_E8s_v3", "Standard_F1", "Standard_F16", "Standard_F16s", + "Standard_F16s_v2", "Standard_F1s", "Standard_F2", "Standard_F2s", "Standard_F2s_v2", + "Standard_F32s_v2", "Standard_F4", "Standard_F4s", "Standard_F4s_v2", "Standard_F64s_v2", + "Standard_F72s_v2", "Standard_F8", "Standard_F8s", "Standard_F8s_v2", "Standard_G1", + "Standard_G2", "Standard_G3", "Standard_G4", "Standard_G5", "Standard_GS1", "Standard_GS2", + "Standard_GS3", "Standard_GS4", "Standard_GS4-4", "Standard_GS4-8", "Standard_GS5", + "Standard_GS5-16", "Standard_GS5-8", "Standard_H16", "Standard_H16m", "Standard_H16mr", + "Standard_H16r", "Standard_H8", "Standard_H8m", "Standard_L16s", "Standard_L32s", + "Standard_L4s", "Standard_L8s", "Standard_M128-32ms", "Standard_M128-64ms", "Standard_M128ms", + "Standard_M128s", "Standard_M64-16ms", "Standard_M64-32ms", "Standard_M64ms", "Standard_M64s", + "Standard_NC12", "Standard_NC12s_v2", "Standard_NC12s_v3", "Standard_NC24", "Standard_NC24r", + "Standard_NC24rs_v2", "Standard_NC24rs_v3", "Standard_NC24s_v2", "Standard_NC24s_v3", + "Standard_NC6", "Standard_NC6s_v2", "Standard_NC6s_v3", "Standard_ND12s", "Standard_ND24rs", + "Standard_ND24s", "Standard_ND6s", "Standard_NV12", "Standard_NV24", "Standard_NV6". + :paramtype vm_size: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ContainerServiceVMSizeTypes + :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every + machine in this master/agent pool. If you specify 0, it will apply the default osDisk size + according to the vmSize specified. + :paramtype os_disk_size_gb: int + :keyword vnet_subnet_id: VNet SubnetID specifies the VNet's subnet identifier. + :paramtype vnet_subnet_id: str + :keyword first_consecutive_static_ip: FirstConsecutiveStaticIP used to specify the first static + ip of masters. + :paramtype first_consecutive_static_ip: str + :keyword storage_profile: Storage profile specifies what kind of storage used. Choose from + StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the + orchestrator choice. Known values are: "StorageAccount", "ManagedDisks". + :paramtype storage_profile: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ContainerServiceStorageProfileTypes + """ + super(ContainerServiceMasterProfile, self).__init__(**kwargs) + self.count = count + self.dns_prefix = dns_prefix + self.vm_size = vm_size + self.os_disk_size_gb = os_disk_size_gb + self.vnet_subnet_id = vnet_subnet_id + self.first_consecutive_static_ip = first_consecutive_static_ip + self.storage_profile = storage_profile + self.fqdn = None + + +class ContainerServiceNetworkProfile(msrest.serialization.Model): + """Profile of network configuration. + + :ivar network_plugin: Network plugin used for building the Kubernetes network. Known values + are: "azure", "kubenet", "none". Default value: "kubenet". + :vartype network_plugin: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.NetworkPlugin + :ivar network_plugin_mode: Network plugin mode used for building the Kubernetes network. Known + values are: "Overlay". + :vartype network_plugin_mode: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.NetworkPluginMode + :ivar network_policy: Network policy used for building the Kubernetes network. Known values + are: "calico", "azure". + :vartype network_policy: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.NetworkPolicy + :ivar network_mode: This cannot be specified if networkPlugin is anything other than 'azure'. + Known values are: "transparent", "bridge". + :vartype network_mode: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.NetworkMode + :ivar pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. + :vartype pod_cidr: str + :ivar service_cidr: 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 dns_service_ip: 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 docker_bridge_cidr: A CIDR notation IP range assigned to the Docker bridge network. It + must not overlap with any Subnet IP ranges or the Kubernetes service address range. + :vartype docker_bridge_cidr: str + :ivar outbound_type: This can only be set at cluster creation time and cannot be changed later. + For more information see `egress outbound type + `_. Known values are: "loadBalancer", + "userDefinedRouting", "managedNATGateway", "userAssignedNATGateway". Default value: + "loadBalancer". + :vartype outbound_type: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.OutboundType + :ivar load_balancer_sku: The default is 'standard'. See `Azure Load Balancer SKUs + `_ for more information about the + differences between load balancer SKUs. Known values are: "standard", "basic". + :vartype load_balancer_sku: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.LoadBalancerSku + :ivar load_balancer_profile: Profile of the cluster load balancer. + :vartype load_balancer_profile: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterLoadBalancerProfile + :ivar nat_gateway_profile: Profile of the cluster NAT gateway. + :vartype nat_gateway_profile: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterNATGatewayProfile + :ivar pod_cidrs: 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_cidrs: 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] + :ivar ip_families: IP families are used to determine single-stack or dual-stack clusters. For + single-stack, the expected value is IPv4. For dual-stack, the expected values are IPv4 and + IPv6. + :vartype ip_families: list[str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.IpFamily] + """ + + _validation = { + 'pod_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, + 'service_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, + 'dns_service_ip': {'pattern': r'^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$'}, + 'docker_bridge_cidr': {'pattern': r'^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$'}, + } + + _attribute_map = { + 'network_plugin': {'key': 'networkPlugin', 'type': 'str'}, + 'network_plugin_mode': {'key': 'networkPluginMode', 'type': 'str'}, + 'network_policy': {'key': 'networkPolicy', 'type': 'str'}, + 'network_mode': {'key': 'networkMode', 'type': 'str'}, + 'pod_cidr': {'key': 'podCidr', 'type': 'str'}, + 'service_cidr': {'key': 'serviceCidr', 'type': 'str'}, + 'dns_service_ip': {'key': 'dnsServiceIP', 'type': 'str'}, + 'docker_bridge_cidr': {'key': 'dockerBridgeCidr', 'type': 'str'}, + 'outbound_type': {'key': 'outboundType', 'type': 'str'}, + 'load_balancer_sku': {'key': 'loadBalancerSku', 'type': 'str'}, + 'load_balancer_profile': {'key': 'loadBalancerProfile', 'type': 'ManagedClusterLoadBalancerProfile'}, + 'nat_gateway_profile': {'key': 'natGatewayProfile', 'type': 'ManagedClusterNATGatewayProfile'}, + 'pod_cidrs': {'key': 'podCidrs', 'type': '[str]'}, + 'service_cidrs': {'key': 'serviceCidrs', 'type': '[str]'}, + 'ip_families': {'key': 'ipFamilies', 'type': '[str]'}, + } + + def __init__( + self, + *, + network_plugin: Optional[Union[str, "_models.NetworkPlugin"]] = "kubenet", + network_plugin_mode: Optional[Union[str, "_models.NetworkPluginMode"]] = None, + network_policy: Optional[Union[str, "_models.NetworkPolicy"]] = None, + network_mode: Optional[Union[str, "_models.NetworkMode"]] = None, + pod_cidr: Optional[str] = "10.244.0.0/16", + service_cidr: Optional[str] = "10.0.0.0/16", + dns_service_ip: Optional[str] = "10.0.0.10", + docker_bridge_cidr: Optional[str] = "172.17.0.1/16", + outbound_type: Optional[Union[str, "_models.OutboundType"]] = "loadBalancer", + load_balancer_sku: Optional[Union[str, "_models.LoadBalancerSku"]] = None, + load_balancer_profile: Optional["_models.ManagedClusterLoadBalancerProfile"] = None, + nat_gateway_profile: Optional["_models.ManagedClusterNATGatewayProfile"] = None, + pod_cidrs: Optional[List[str]] = None, + service_cidrs: Optional[List[str]] = None, + ip_families: Optional[List[Union[str, "_models.IpFamily"]]] = None, + **kwargs + ): + """ + :keyword network_plugin: Network plugin used for building the Kubernetes network. Known values + are: "azure", "kubenet", "none". Default value: "kubenet". + :paramtype network_plugin: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.NetworkPlugin + :keyword network_plugin_mode: Network plugin mode used for building the Kubernetes network. + Known values are: "Overlay". + :paramtype network_plugin_mode: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.NetworkPluginMode + :keyword network_policy: Network policy used for building the Kubernetes network. Known values + are: "calico", "azure". + :paramtype network_policy: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.NetworkPolicy + :keyword network_mode: This cannot be specified if networkPlugin is anything other than + 'azure'. Known values are: "transparent", "bridge". + :paramtype network_mode: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.NetworkMode + :keyword pod_cidr: A CIDR notation IP range from which to assign pod IPs when kubenet is used. + :paramtype pod_cidr: str + :keyword service_cidr: 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 dns_service_ip: 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 docker_bridge_cidr: A CIDR notation IP range assigned to the Docker bridge network. It + must not overlap with any Subnet IP ranges or the Kubernetes service address range. + :paramtype docker_bridge_cidr: str + :keyword outbound_type: This can only be set at cluster creation time and cannot be changed + later. For more information see `egress outbound type + `_. Known values are: "loadBalancer", + "userDefinedRouting", "managedNATGateway", "userAssignedNATGateway". Default value: + "loadBalancer". + :paramtype outbound_type: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.OutboundType + :keyword load_balancer_sku: The default is 'standard'. See `Azure Load Balancer SKUs + `_ for more information about the + differences between load balancer SKUs. Known values are: "standard", "basic". + :paramtype load_balancer_sku: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.LoadBalancerSku + :keyword load_balancer_profile: Profile of the cluster load balancer. + :paramtype load_balancer_profile: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterLoadBalancerProfile + :keyword nat_gateway_profile: Profile of the cluster NAT gateway. + :paramtype nat_gateway_profile: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterNATGatewayProfile + :keyword pod_cidrs: 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_cidrs: 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 ip_families: IP families are used to determine single-stack or dual-stack clusters. + For single-stack, the expected value is IPv4. For dual-stack, the expected values are IPv4 and + IPv6. + :paramtype ip_families: list[str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.IpFamily] + """ + super(ContainerServiceNetworkProfile, self).__init__(**kwargs) + self.network_plugin = network_plugin + self.network_plugin_mode = network_plugin_mode + self.network_policy = network_policy + self.network_mode = network_mode + self.pod_cidr = pod_cidr + self.service_cidr = service_cidr + self.dns_service_ip = dns_service_ip + self.docker_bridge_cidr = docker_bridge_cidr + self.outbound_type = outbound_type + self.load_balancer_sku = load_balancer_sku + self.load_balancer_profile = load_balancer_profile + self.nat_gateway_profile = nat_gateway_profile + self.pod_cidrs = pod_cidrs + self.service_cidrs = service_cidrs + self.ip_families = ip_families + + +class ContainerServiceSshConfiguration(msrest.serialization.Model): + """SSH configuration for Linux-based VMs running on Azure. + + All required parameters must be populated in order to send to Azure. + + :ivar public_keys: Required. The list of SSH public keys used to authenticate with Linux-based + VMs. A maximum of 1 key may be specified. + :vartype public_keys: + list[~azure.mgmt.containerservice.v2022_06_02_preview.models.ContainerServiceSshPublicKey] + """ + + _validation = { + 'public_keys': {'required': True}, + } + + _attribute_map = { + 'public_keys': {'key': 'publicKeys', 'type': '[ContainerServiceSshPublicKey]'}, + } + + def __init__( + self, + *, + public_keys: List["_models.ContainerServiceSshPublicKey"], + **kwargs + ): + """ + :keyword public_keys: Required. The list of SSH public keys used to authenticate with + Linux-based VMs. A maximum of 1 key may be specified. + :paramtype public_keys: + list[~azure.mgmt.containerservice.v2022_06_02_preview.models.ContainerServiceSshPublicKey] + """ + super(ContainerServiceSshConfiguration, self).__init__(**kwargs) + self.public_keys = public_keys + + +class ContainerServiceSshPublicKey(msrest.serialization.Model): + """Contains information about SSH certificate public key data. + + All required parameters must be populated in order to send to Azure. + + :ivar key_data: Required. 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 = { + 'key_data': {'required': True}, + } + + _attribute_map = { + 'key_data': {'key': 'keyData', 'type': 'str'}, + } + + def __init__( + self, + *, + key_data: str, + **kwargs + ): + """ + :keyword key_data: Required. 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(ContainerServiceSshPublicKey, self).__init__(**kwargs) + self.key_data = key_data + + +class ContainerServiceVMDiagnostics(msrest.serialization.Model): + """Profile for diagnostics on the container service VMs. + + 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 enabled: Required. Whether the VM diagnostic agent is provisioned on the VM. + :vartype enabled: bool + :ivar storage_uri: The URI of the storage account where diagnostics are stored. + :vartype storage_uri: str + """ + + _validation = { + 'enabled': {'required': True}, + 'storage_uri': {'readonly': True}, + } + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'storage_uri': {'key': 'storageUri', 'type': 'str'}, + } + + def __init__( + self, + *, + enabled: bool, + **kwargs + ): + """ + :keyword enabled: Required. Whether the VM diagnostic agent is provisioned on the VM. + :paramtype enabled: bool + """ + super(ContainerServiceVMDiagnostics, self).__init__(**kwargs) + self.enabled = enabled + self.storage_uri = None + + +class CreationData(msrest.serialization.Model): + """Data used when creating a target resource from a source resource. + + :ivar source_resource_id: This is the ARM ID of the source object to be used to create the + target object. + :vartype source_resource_id: str + """ + + _attribute_map = { + 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, + } + + def __init__( + self, + *, + source_resource_id: Optional[str] = None, + **kwargs + ): + """ + :keyword source_resource_id: This is the ARM ID of the source object to be used to create the + target object. + :paramtype source_resource_id: str + """ + super(CreationData, self).__init__(**kwargs) + self.source_resource_id = source_resource_id + + +class CredentialResult(msrest.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: bytearray + """ + + _validation = { + 'name': {'readonly': True}, + 'value': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'bytearray'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(CredentialResult, self).__init__(**kwargs) + self.name = None + self.value = None + + +class CredentialResults(msrest.serialization.Model): + """The list credential result response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar kubeconfigs: Base64-encoded Kubernetes configuration file. + :vartype kubeconfigs: + list[~azure.mgmt.containerservice.v2022_06_02_preview.models.CredentialResult] + """ + + _validation = { + 'kubeconfigs': {'readonly': True}, + } + + _attribute_map = { + 'kubeconfigs': {'key': 'kubeconfigs', 'type': '[CredentialResult]'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(CredentialResults, self).__init__(**kwargs) + self.kubeconfigs = None + + +class EndpointDependency(msrest.serialization.Model): + """A domain name that AKS agent nodes are reaching at. + + :ivar domain_name: The domain name of the dependency. + :vartype domain_name: str + :ivar endpoint_details: The Ports and Protocols used when connecting to domainName. + :vartype endpoint_details: + list[~azure.mgmt.containerservice.v2022_06_02_preview.models.EndpointDetail] + """ + + _attribute_map = { + 'domain_name': {'key': 'domainName', 'type': 'str'}, + 'endpoint_details': {'key': 'endpointDetails', 'type': '[EndpointDetail]'}, + } + + def __init__( + self, + *, + domain_name: Optional[str] = None, + endpoint_details: Optional[List["_models.EndpointDetail"]] = None, + **kwargs + ): + """ + :keyword domain_name: The domain name of the dependency. + :paramtype domain_name: str + :keyword endpoint_details: The Ports and Protocols used when connecting to domainName. + :paramtype endpoint_details: + list[~azure.mgmt.containerservice.v2022_06_02_preview.models.EndpointDetail] + """ + super(EndpointDependency, self).__init__(**kwargs) + self.domain_name = domain_name + self.endpoint_details = endpoint_details + + +class EndpointDetail(msrest.serialization.Model): + """connect information from the AKS agent nodes to a single endpoint. + + :ivar ip_address: An IP Address that Domain Name currently resolves to. + :vartype ip_address: str + :ivar port: The port an endpoint is connected to. + :vartype port: int + :ivar protocol: The protocol used for connection. + :vartype protocol: str + :ivar description: Description of the detail. + :vartype description: str + """ + + _attribute_map = { + 'ip_address': {'key': 'ipAddress', 'type': 'str'}, + 'port': {'key': 'port', 'type': 'int'}, + 'protocol': {'key': 'protocol', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + *, + ip_address: Optional[str] = None, + port: Optional[int] = None, + protocol: Optional[str] = None, + description: Optional[str] = None, + **kwargs + ): + """ + :keyword ip_address: An IP Address that Domain Name currently resolves to. + :paramtype ip_address: str + :keyword port: The port an endpoint is connected to. + :paramtype port: int + :keyword protocol: The protocol used for connection. + :paramtype protocol: str + :keyword description: Description of the detail. + :paramtype description: str + """ + super(EndpointDetail, self).__init__(**kwargs) + self.ip_address = ip_address + self.port = port + self.protocol = protocol + self.description = description + + +class ErrorAdditionalInfo(msrest.serialization.Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: any + """ + + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorDetail(msrest.serialization.Model): + """The error detail. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~azure.mgmt.containerservice.v2022_06_02_preview.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: + list[~azure.mgmt.containerservice.v2022_06_02_preview.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorDetail]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ErrorDetail, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class ErrorResponse(msrest.serialization.Model): + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + + :ivar error: The error object. + :vartype error: ~azure.mgmt.containerservice.v2022_06_02_preview.models.ErrorDetail + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDetail'}, + } + + def __init__( + self, + *, + error: Optional["_models.ErrorDetail"] = None, + **kwargs + ): + """ + :keyword error: The error object. + :paramtype error: ~azure.mgmt.containerservice.v2022_06_02_preview.models.ErrorDetail + """ + super(ErrorResponse, self).__init__(**kwargs) + self.error = error + + +class ExtendedLocation(msrest.serialization.Model): + """The complex type of the extended location. + + :ivar name: The name of the extended location. + :vartype name: str + :ivar type: The type of the extended location. Known values are: "EdgeZone". + :vartype type: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ExtendedLocationTypes + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + type: Optional[Union[str, "_models.ExtendedLocationTypes"]] = None, + **kwargs + ): + """ + :keyword name: The name of the extended location. + :paramtype name: str + :keyword type: The type of the extended location. Known values are: "EdgeZone". + :paramtype type: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ExtendedLocationTypes + """ + super(ExtendedLocation, self).__init__(**kwargs) + self.name = name + self.type = type + + +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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.containerservice.v2022_06_02_preview.models.SystemData + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :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 + ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + """ + super(TrackedResource, self).__init__(**kwargs) + self.tags = tags + self.location = location + + +class Fleet(TrackedResource): + """The Fleet resource which contains multiple Kubernetes clusters as its members. + + 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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.containerservice.v2022_06_02_preview.models.SystemData + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str + :ivar etag: Resource Etag. + :vartype etag: str + :ivar hub_profile: The FleetHubProfile configures the Fleet's hub. + :vartype hub_profile: ~azure.mgmt.containerservice.v2022_06_02_preview.models.FleetHubProfile + :ivar provisioning_state: The provisioning state of the last accepted operation. Known values + are: "Succeeded", "Failed", "Canceled", "Creating", "Deleting", "Updating". + :vartype provisioning_state: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.FleetProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'location': {'required': True}, + 'etag': {'readonly': True}, + 'provisioning_state': {'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'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'hub_profile': {'key': 'properties.hubProfile', 'type': 'FleetHubProfile'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + hub_profile: Optional["_models.FleetHubProfile"] = None, + **kwargs + ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + :keyword hub_profile: The FleetHubProfile configures the Fleet's hub. + :paramtype hub_profile: ~azure.mgmt.containerservice.v2022_06_02_preview.models.FleetHubProfile + """ + super(Fleet, self).__init__(tags=tags, location=location, **kwargs) + self.etag = None + self.hub_profile = hub_profile + self.provisioning_state = None + + +class FleetCredentialResult(msrest.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: bytearray + """ + + _validation = { + 'name': {'readonly': True}, + 'value': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'bytearray'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(FleetCredentialResult, self).__init__(**kwargs) + self.name = None + self.value = None + + +class FleetCredentialResults(msrest.serialization.Model): + """The list credential result response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar kubeconfigs: Base64-encoded Kubernetes configuration file. + :vartype kubeconfigs: + list[~azure.mgmt.containerservice.v2022_06_02_preview.models.FleetCredentialResult] + """ + + _validation = { + 'kubeconfigs': {'readonly': True}, + } + + _attribute_map = { + 'kubeconfigs': {'key': 'kubeconfigs', 'type': '[FleetCredentialResult]'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(FleetCredentialResults, self).__init__(**kwargs) + self.kubeconfigs = None + + +class FleetHubProfile(msrest.serialization.Model): + """The FleetHubProfile configures the fleet hub. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar dns_prefix: DNS prefix used to create the FQDN for the Fleet hub. + :vartype dns_prefix: str + :ivar fqdn: The FQDN of the Fleet hub. + :vartype fqdn: str + :ivar kubernetes_version: The Kubernetes version of the Fleet hub. + :vartype kubernetes_version: str + """ + + _validation = { + 'fqdn': {'readonly': True}, + 'kubernetes_version': {'readonly': True}, + } + + _attribute_map = { + 'dns_prefix': {'key': 'dnsPrefix', 'type': 'str'}, + 'fqdn': {'key': 'fqdn', 'type': 'str'}, + 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, + } + + def __init__( + self, + *, + dns_prefix: Optional[str] = None, + **kwargs + ): + """ + :keyword dns_prefix: DNS prefix used to create the FQDN for the Fleet hub. + :paramtype dns_prefix: str + """ + super(FleetHubProfile, self).__init__(**kwargs) + self.dns_prefix = dns_prefix + self.fqdn = None + self.kubernetes_version = None + + +class FleetListResult(msrest.serialization.Model): + """The response from the List Fleets operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The list of Fleets. + :vartype value: list[~azure.mgmt.containerservice.v2022_06_02_preview.models.Fleet] + :ivar next_link: The URL to get the next page of Fleets. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Fleet]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["_models.Fleet"]] = None, + **kwargs + ): + """ + :keyword value: The list of Fleets. + :paramtype value: list[~azure.mgmt.containerservice.v2022_06_02_preview.models.Fleet] + """ + super(FleetListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class FleetMember(AzureEntityResource): + """A member of the Fleet. It contains a reference to an existing Kubernetes cluster on Azure. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.containerservice.v2022_06_02_preview.models.SystemData + :ivar etag: Resource Etag. + :vartype etag: str + :ivar cluster_resource_id: The ARM resource id of the cluster that joins the Fleet. Must be a + valid Azure resource id. e.g.: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{clusterName}'. + :vartype cluster_resource_id: str + :ivar provisioning_state: The provisioning state of the last accepted operation. Known values + are: "Succeeded", "Failed", "Canceled", "Joining", "Leaving", "Updating". + :vartype provisioning_state: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.FleetMemberProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'etag': {'readonly': True}, + 'provisioning_state': {'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'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'cluster_resource_id': {'key': 'properties.clusterResourceId', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + cluster_resource_id: Optional[str] = None, + **kwargs + ): + """ + :keyword cluster_resource_id: The ARM resource id of the cluster that joins the Fleet. Must be + a valid Azure resource id. e.g.: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{clusterName}'. + :paramtype cluster_resource_id: str + """ + super(FleetMember, self).__init__(**kwargs) + self.cluster_resource_id = cluster_resource_id + self.provisioning_state = None + + +class FleetMembersListResult(msrest.serialization.Model): + """The response from the List FleetMembers operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The list of members in a given Fleet. + :vartype value: list[~azure.mgmt.containerservice.v2022_06_02_preview.models.FleetMember] + :ivar next_link: The URL to get the next page of Fleet members. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[FleetMember]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["_models.FleetMember"]] = None, + **kwargs + ): + """ + :keyword value: The list of members in a given Fleet. + :paramtype value: list[~azure.mgmt.containerservice.v2022_06_02_preview.models.FleetMember] + """ + super(FleetMembersListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class FleetPatch(msrest.serialization.Model): + """Properties of a Fleet that can be patched. + + :ivar tags: A set of 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 + ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ + super(FleetPatch, self).__init__(**kwargs) + self.tags = tags + + +class KubeletConfig(msrest.serialization.Model): + """See `AKS custom node configuration `_ for more details. + + :ivar cpu_manager_policy: The default is 'none'. See `Kubernetes CPU management policies + `_ + for more information. Allowed values are 'none' and 'static'. + :vartype cpu_manager_policy: str + :ivar cpu_cfs_quota: The default is true. + :vartype cpu_cfs_quota: bool + :ivar cpu_cfs_quota_period: The default is '100ms.' Valid values are a sequence of decimal + numbers with an optional fraction and a unit suffix. For example: '300ms', '2h45m'. Supported + units are 'ns', 'us', 'ms', 's', 'm', and 'h'. + :vartype cpu_cfs_quota_period: str + :ivar image_gc_high_threshold: To disable image garbage collection, set to 100. The default is + 85%. + :vartype image_gc_high_threshold: int + :ivar image_gc_low_threshold: This cannot be set higher than imageGcHighThreshold. The default + is 80%. + :vartype image_gc_low_threshold: int + :ivar topology_manager_policy: For more information see `Kubernetes Topology Manager + `_. The default is + 'none'. Allowed values are 'none', 'best-effort', 'restricted', and 'single-numa-node'. + :vartype topology_manager_policy: str + :ivar allowed_unsafe_sysctls: Allowed list of unsafe sysctls or unsafe sysctl patterns (ending + in ``*``\ ). + :vartype allowed_unsafe_sysctls: list[str] + :ivar fail_swap_on: If set to true it will make the Kubelet fail to start if swap is enabled on + the node. + :vartype fail_swap_on: bool + :ivar container_log_max_size_mb: The maximum size (e.g. 10Mi) of container log file before it + is rotated. + :vartype container_log_max_size_mb: int + :ivar container_log_max_files: The maximum number of container log files that can be present + for a container. The number must be ≥ 2. + :vartype container_log_max_files: int + :ivar pod_max_pids: The maximum number of processes per pod. + :vartype pod_max_pids: int + """ + + _validation = { + 'container_log_max_files': {'minimum': 2}, + } + + _attribute_map = { + 'cpu_manager_policy': {'key': 'cpuManagerPolicy', 'type': 'str'}, + 'cpu_cfs_quota': {'key': 'cpuCfsQuota', 'type': 'bool'}, + 'cpu_cfs_quota_period': {'key': 'cpuCfsQuotaPeriod', 'type': 'str'}, + 'image_gc_high_threshold': {'key': 'imageGcHighThreshold', 'type': 'int'}, + 'image_gc_low_threshold': {'key': 'imageGcLowThreshold', 'type': 'int'}, + 'topology_manager_policy': {'key': 'topologyManagerPolicy', 'type': 'str'}, + 'allowed_unsafe_sysctls': {'key': 'allowedUnsafeSysctls', 'type': '[str]'}, + 'fail_swap_on': {'key': 'failSwapOn', 'type': 'bool'}, + 'container_log_max_size_mb': {'key': 'containerLogMaxSizeMB', 'type': 'int'}, + 'container_log_max_files': {'key': 'containerLogMaxFiles', 'type': 'int'}, + 'pod_max_pids': {'key': 'podMaxPids', 'type': 'int'}, + } + + def __init__( + self, + *, + cpu_manager_policy: Optional[str] = None, + cpu_cfs_quota: Optional[bool] = None, + cpu_cfs_quota_period: Optional[str] = None, + image_gc_high_threshold: Optional[int] = None, + image_gc_low_threshold: Optional[int] = None, + topology_manager_policy: Optional[str] = None, + allowed_unsafe_sysctls: Optional[List[str]] = None, + fail_swap_on: Optional[bool] = None, + container_log_max_size_mb: Optional[int] = None, + container_log_max_files: Optional[int] = None, + pod_max_pids: Optional[int] = None, + **kwargs + ): + """ + :keyword cpu_manager_policy: The default is 'none'. See `Kubernetes CPU management policies + `_ + for more information. Allowed values are 'none' and 'static'. + :paramtype cpu_manager_policy: str + :keyword cpu_cfs_quota: The default is true. + :paramtype cpu_cfs_quota: bool + :keyword cpu_cfs_quota_period: The default is '100ms.' Valid values are a sequence of decimal + numbers with an optional fraction and a unit suffix. For example: '300ms', '2h45m'. Supported + units are 'ns', 'us', 'ms', 's', 'm', and 'h'. + :paramtype cpu_cfs_quota_period: str + :keyword image_gc_high_threshold: To disable image garbage collection, set to 100. The default + is 85%. + :paramtype image_gc_high_threshold: int + :keyword image_gc_low_threshold: This cannot be set higher than imageGcHighThreshold. The + default is 80%. + :paramtype image_gc_low_threshold: int + :keyword topology_manager_policy: For more information see `Kubernetes Topology Manager + `_. The default is + 'none'. Allowed values are 'none', 'best-effort', 'restricted', and 'single-numa-node'. + :paramtype topology_manager_policy: str + :keyword allowed_unsafe_sysctls: Allowed list of unsafe sysctls or unsafe sysctl patterns + (ending in ``*``\ ). + :paramtype allowed_unsafe_sysctls: list[str] + :keyword fail_swap_on: If set to true it will make the Kubelet fail to start if swap is enabled + on the node. + :paramtype fail_swap_on: bool + :keyword container_log_max_size_mb: The maximum size (e.g. 10Mi) of container log file before + it is rotated. + :paramtype container_log_max_size_mb: int + :keyword container_log_max_files: The maximum number of container log files that can be present + for a container. The number must be ≥ 2. + :paramtype container_log_max_files: int + :keyword pod_max_pids: The maximum number of processes per pod. + :paramtype pod_max_pids: int + """ + super(KubeletConfig, self).__init__(**kwargs) + self.cpu_manager_policy = cpu_manager_policy + self.cpu_cfs_quota = cpu_cfs_quota + self.cpu_cfs_quota_period = cpu_cfs_quota_period + self.image_gc_high_threshold = image_gc_high_threshold + self.image_gc_low_threshold = image_gc_low_threshold + self.topology_manager_policy = topology_manager_policy + self.allowed_unsafe_sysctls = allowed_unsafe_sysctls + self.fail_swap_on = fail_swap_on + self.container_log_max_size_mb = container_log_max_size_mb + self.container_log_max_files = container_log_max_files + self.pod_max_pids = pod_max_pids + + +class LinuxOSConfig(msrest.serialization.Model): + """See `AKS custom node configuration `_ for more details. + + :ivar sysctls: Sysctl settings for Linux agent nodes. + :vartype sysctls: ~azure.mgmt.containerservice.v2022_06_02_preview.models.SysctlConfig + :ivar transparent_huge_page_enabled: Valid values are 'always', 'madvise', and 'never'. The + default is 'always'. For more information see `Transparent Hugepages + `_. + :vartype transparent_huge_page_enabled: str + :ivar transparent_huge_page_defrag: Valid values are 'always', 'defer', 'defer+madvise', + 'madvise' and 'never'. The default is 'madvise'. For more information see `Transparent + Hugepages + `_. + :vartype transparent_huge_page_defrag: str + :ivar swap_file_size_mb: The size in MB of a swap file that will be created on each node. + :vartype swap_file_size_mb: int + """ + + _attribute_map = { + 'sysctls': {'key': 'sysctls', 'type': 'SysctlConfig'}, + 'transparent_huge_page_enabled': {'key': 'transparentHugePageEnabled', 'type': 'str'}, + 'transparent_huge_page_defrag': {'key': 'transparentHugePageDefrag', 'type': 'str'}, + 'swap_file_size_mb': {'key': 'swapFileSizeMB', 'type': 'int'}, + } + + def __init__( + self, + *, + sysctls: Optional["_models.SysctlConfig"] = None, + transparent_huge_page_enabled: Optional[str] = None, + transparent_huge_page_defrag: Optional[str] = None, + swap_file_size_mb: Optional[int] = None, + **kwargs + ): + """ + :keyword sysctls: Sysctl settings for Linux agent nodes. + :paramtype sysctls: ~azure.mgmt.containerservice.v2022_06_02_preview.models.SysctlConfig + :keyword transparent_huge_page_enabled: Valid values are 'always', 'madvise', and 'never'. The + default is 'always'. For more information see `Transparent Hugepages + `_. + :paramtype transparent_huge_page_enabled: str + :keyword transparent_huge_page_defrag: Valid values are 'always', 'defer', 'defer+madvise', + 'madvise' and 'never'. The default is 'madvise'. For more information see `Transparent + Hugepages + `_. + :paramtype transparent_huge_page_defrag: str + :keyword swap_file_size_mb: The size in MB of a swap file that will be created on each node. + :paramtype swap_file_size_mb: int + """ + super(LinuxOSConfig, self).__init__(**kwargs) + self.sysctls = sysctls + self.transparent_huge_page_enabled = transparent_huge_page_enabled + self.transparent_huge_page_defrag = transparent_huge_page_defrag + self.swap_file_size_mb = swap_file_size_mb + + +class MaintenanceConfiguration(SubResource): + """See `planned maintenance `_ for more information about planned maintenance. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: The name of the resource that is unique within a resource group. This name can be + used to access the resource. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar system_data: The system metadata relating to this resource. + :vartype system_data: ~azure.mgmt.containerservice.v2022_06_02_preview.models.SystemData + :ivar time_in_week: If two array entries specify the same day of the week, the applied + configuration is the union of times in both entries. + :vartype time_in_week: list[~azure.mgmt.containerservice.v2022_06_02_preview.models.TimeInWeek] + :ivar not_allowed_time: Time slots on which upgrade is not allowed. + :vartype not_allowed_time: + list[~azure.mgmt.containerservice.v2022_06_02_preview.models.TimeSpan] + """ + + _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'}, + 'time_in_week': {'key': 'properties.timeInWeek', 'type': '[TimeInWeek]'}, + 'not_allowed_time': {'key': 'properties.notAllowedTime', 'type': '[TimeSpan]'}, + } + + def __init__( + self, + *, + time_in_week: Optional[List["_models.TimeInWeek"]] = None, + not_allowed_time: Optional[List["_models.TimeSpan"]] = None, + **kwargs + ): + """ + :keyword time_in_week: If two array entries specify the same day of the week, the applied + configuration is the union of times in both entries. + :paramtype time_in_week: + list[~azure.mgmt.containerservice.v2022_06_02_preview.models.TimeInWeek] + :keyword not_allowed_time: Time slots on which upgrade is not allowed. + :paramtype not_allowed_time: + list[~azure.mgmt.containerservice.v2022_06_02_preview.models.TimeSpan] + """ + super(MaintenanceConfiguration, self).__init__(**kwargs) + self.system_data = None + self.time_in_week = time_in_week + self.not_allowed_time = not_allowed_time + + +class MaintenanceConfigurationListResult(msrest.serialization.Model): + """The response from the List maintenance configurations operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The list of maintenance configurations. + :vartype value: + list[~azure.mgmt.containerservice.v2022_06_02_preview.models.MaintenanceConfiguration] + :ivar next_link: The URL to get the next set of maintenance configuration results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[MaintenanceConfiguration]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["_models.MaintenanceConfiguration"]] = None, + **kwargs + ): + """ + :keyword value: The list of maintenance configurations. + :paramtype value: + list[~azure.mgmt.containerservice.v2022_06_02_preview.models.MaintenanceConfiguration] + """ + super(MaintenanceConfigurationListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class ManagedCluster(TrackedResource): + """Managed cluster. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.containerservice.v2022_06_02_preview.models.SystemData + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str + :ivar sku: The managed cluster SKU. + :vartype sku: ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterSKU + :ivar extended_location: The extended location of the Virtual Machine. + :vartype extended_location: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ExtendedLocation + :ivar identity: The identity of the managed cluster, if configured. + :vartype identity: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterIdentity + :ivar provisioning_state: The current provisioning state. + :vartype provisioning_state: str + :ivar power_state: The Power State of the cluster. + :vartype power_state: ~azure.mgmt.containerservice.v2022_06_02_preview.models.PowerState + :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the cluster + will be created/upgraded using a snapshot. + :vartype creation_data: ~azure.mgmt.containerservice.v2022_06_02_preview.models.CreationData + :ivar max_agent_pools: The max number of agent pools for the managed cluster. + :vartype max_agent_pools: int + :ivar kubernetes_version: When you upgrade a supported AKS cluster, Kubernetes minor versions + cannot be skipped. All upgrades must be performed sequentially by major version number. For + example, upgrades between 1.14.x -> 1.15.x or 1.15.x -> 1.16.x are allowed, however 1.14.x -> + 1.16.x is not allowed. See `upgrading an AKS cluster + `_ for more details. + :vartype kubernetes_version: str + :ivar current_kubernetes_version: The version of Kubernetes the Managed Cluster is running. + :vartype current_kubernetes_version: str + :ivar dns_prefix: This cannot be updated once the Managed Cluster has been created. + :vartype dns_prefix: str + :ivar fqdn_subdomain: This cannot be updated once the Managed Cluster has been created. + :vartype fqdn_subdomain: str + :ivar fqdn: The FQDN of the master pool. + :vartype fqdn: str + :ivar private_fqdn: The FQDN of private cluster. + :vartype private_fqdn: str + :ivar azure_portal_fqdn: The Azure Portal requires certain Cross-Origin Resource Sharing (CORS) + headers to be sent in some responses, which Kubernetes APIServer doesn't handle by default. + This special FQDN supports CORS, allowing the Azure Portal to function properly. + :vartype azure_portal_fqdn: str + :ivar agent_pool_profiles: The agent pool properties. + :vartype agent_pool_profiles: + list[~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterAgentPoolProfile] + :ivar linux_profile: The profile for Linux VMs in the Managed Cluster. + :vartype linux_profile: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ContainerServiceLinuxProfile + :ivar windows_profile: The profile for Windows VMs in the Managed Cluster. + :vartype windows_profile: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterWindowsProfile + :ivar service_principal_profile: Information about a service principal identity for the cluster + to use for manipulating Azure APIs. + :vartype service_principal_profile: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterServicePrincipalProfile + :ivar addon_profiles: The profile of managed cluster add-on. + :vartype addon_profiles: dict[str, + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterAddonProfile] + :ivar pod_identity_profile: See `use AAD pod identity + `_ for more details on AAD pod + identity integration. + :vartype pod_identity_profile: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterPodIdentityProfile + :ivar oidc_issuer_profile: The OIDC issuer profile of the Managed Cluster. + :vartype oidc_issuer_profile: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterOIDCIssuerProfile + :ivar node_resource_group: The name of the resource group containing agent pool nodes. + :vartype node_resource_group: str + :ivar enable_rbac: Whether to enable Kubernetes Role-Based Access Control. + :vartype enable_rbac: bool + :ivar enable_pod_security_policy: (DEPRECATING) Whether to enable Kubernetes pod security + policy (preview). This feature is set for removal on October 15th, 2020. Learn more at + aka.ms/aks/azpodpolicy. + :vartype enable_pod_security_policy: bool + :ivar enable_namespace_resources: The default value is false. It can be enabled/disabled on + creation and updation of the managed cluster. See `https://aka.ms/NamespaceARMResource + `_ for more details on Namespace as a ARM Resource. + :vartype enable_namespace_resources: bool + :ivar network_profile: The network configuration profile. + :vartype network_profile: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ContainerServiceNetworkProfile + :ivar aad_profile: The Azure Active Directory configuration. + :vartype aad_profile: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterAADProfile + :ivar auto_upgrade_profile: The auto upgrade configuration. + :vartype auto_upgrade_profile: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterAutoUpgradeProfile + :ivar auto_scaler_profile: Parameters to be applied to the cluster-autoscaler when enabled. + :vartype auto_scaler_profile: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterPropertiesAutoScalerProfile + :ivar api_server_access_profile: The access profile for managed cluster API server. + :vartype api_server_access_profile: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterAPIServerAccessProfile + :ivar disk_encryption_set_id: This is of the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{encryptionSetName}'. + :vartype disk_encryption_set_id: str + :ivar identity_profile: Identities associated with the cluster. + :vartype identity_profile: dict[str, + ~azure.mgmt.containerservice.v2022_06_02_preview.models.UserAssignedIdentity] + :ivar private_link_resources: Private link resources associated with the cluster. + :vartype private_link_resources: + list[~azure.mgmt.containerservice.v2022_06_02_preview.models.PrivateLinkResource] + :ivar disable_local_accounts: If set to true, getting static credentials will be disabled for + this cluster. This must only be used on Managed Clusters that are AAD enabled. For more details + see `disable local accounts + `_. + :vartype disable_local_accounts: bool + :ivar http_proxy_config: Configurations for provisioning the cluster with HTTP proxy servers. + :vartype http_proxy_config: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterHTTPProxyConfig + :ivar security_profile: Security profile for the managed cluster. + :vartype security_profile: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterSecurityProfile + :ivar storage_profile: Storage profile for the managed cluster. + :vartype storage_profile: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterStorageProfile + :ivar ingress_profile: Ingress profile for the managed cluster. + :vartype ingress_profile: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterIngressProfile + :ivar public_network_access: Allow or deny public network access for AKS. Known values are: + "Enabled", "Disabled". + :vartype public_network_access: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.PublicNetworkAccess + :ivar workload_auto_scaler_profile: Workload Auto-scaler profile for the container service + cluster. + :vartype workload_auto_scaler_profile: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterWorkloadAutoScalerProfile + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'location': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'power_state': {'readonly': True}, + 'max_agent_pools': {'readonly': True}, + 'current_kubernetes_version': {'readonly': True}, + 'fqdn': {'readonly': True}, + 'private_fqdn': {'readonly': True}, + 'azure_portal_fqdn': {'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'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'ManagedClusterSKU'}, + 'extended_location': {'key': 'extendedLocation', 'type': 'ExtendedLocation'}, + 'identity': {'key': 'identity', 'type': 'ManagedClusterIdentity'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'power_state': {'key': 'properties.powerState', 'type': 'PowerState'}, + 'creation_data': {'key': 'properties.creationData', 'type': 'CreationData'}, + 'max_agent_pools': {'key': 'properties.maxAgentPools', 'type': 'int'}, + 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, + 'current_kubernetes_version': {'key': 'properties.currentKubernetesVersion', 'type': 'str'}, + 'dns_prefix': {'key': 'properties.dnsPrefix', 'type': 'str'}, + 'fqdn_subdomain': {'key': 'properties.fqdnSubdomain', 'type': 'str'}, + 'fqdn': {'key': 'properties.fqdn', 'type': 'str'}, + 'private_fqdn': {'key': 'properties.privateFQDN', 'type': 'str'}, + 'azure_portal_fqdn': {'key': 'properties.azurePortalFQDN', 'type': 'str'}, + 'agent_pool_profiles': {'key': 'properties.agentPoolProfiles', 'type': '[ManagedClusterAgentPoolProfile]'}, + 'linux_profile': {'key': 'properties.linuxProfile', 'type': 'ContainerServiceLinuxProfile'}, + 'windows_profile': {'key': 'properties.windowsProfile', 'type': 'ManagedClusterWindowsProfile'}, + 'service_principal_profile': {'key': 'properties.servicePrincipalProfile', 'type': 'ManagedClusterServicePrincipalProfile'}, + 'addon_profiles': {'key': 'properties.addonProfiles', 'type': '{ManagedClusterAddonProfile}'}, + 'pod_identity_profile': {'key': 'properties.podIdentityProfile', 'type': 'ManagedClusterPodIdentityProfile'}, + 'oidc_issuer_profile': {'key': 'properties.oidcIssuerProfile', 'type': 'ManagedClusterOIDCIssuerProfile'}, + 'node_resource_group': {'key': 'properties.nodeResourceGroup', 'type': 'str'}, + 'enable_rbac': {'key': 'properties.enableRBAC', 'type': 'bool'}, + 'enable_pod_security_policy': {'key': 'properties.enablePodSecurityPolicy', 'type': 'bool'}, + 'enable_namespace_resources': {'key': 'properties.enableNamespaceResources', 'type': 'bool'}, + 'network_profile': {'key': 'properties.networkProfile', 'type': 'ContainerServiceNetworkProfile'}, + 'aad_profile': {'key': 'properties.aadProfile', 'type': 'ManagedClusterAADProfile'}, + 'auto_upgrade_profile': {'key': 'properties.autoUpgradeProfile', 'type': 'ManagedClusterAutoUpgradeProfile'}, + 'auto_scaler_profile': {'key': 'properties.autoScalerProfile', 'type': 'ManagedClusterPropertiesAutoScalerProfile'}, + 'api_server_access_profile': {'key': 'properties.apiServerAccessProfile', 'type': 'ManagedClusterAPIServerAccessProfile'}, + 'disk_encryption_set_id': {'key': 'properties.diskEncryptionSetID', 'type': 'str'}, + 'identity_profile': {'key': 'properties.identityProfile', 'type': '{UserAssignedIdentity}'}, + 'private_link_resources': {'key': 'properties.privateLinkResources', 'type': '[PrivateLinkResource]'}, + 'disable_local_accounts': {'key': 'properties.disableLocalAccounts', 'type': 'bool'}, + 'http_proxy_config': {'key': 'properties.httpProxyConfig', 'type': 'ManagedClusterHTTPProxyConfig'}, + 'security_profile': {'key': 'properties.securityProfile', 'type': 'ManagedClusterSecurityProfile'}, + 'storage_profile': {'key': 'properties.storageProfile', 'type': 'ManagedClusterStorageProfile'}, + 'ingress_profile': {'key': 'properties.ingressProfile', 'type': 'ManagedClusterIngressProfile'}, + 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, + 'workload_auto_scaler_profile': {'key': 'properties.workloadAutoScalerProfile', 'type': 'ManagedClusterWorkloadAutoScalerProfile'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + sku: Optional["_models.ManagedClusterSKU"] = None, + extended_location: Optional["_models.ExtendedLocation"] = None, + identity: Optional["_models.ManagedClusterIdentity"] = None, + creation_data: Optional["_models.CreationData"] = None, + kubernetes_version: Optional[str] = None, + dns_prefix: Optional[str] = None, + fqdn_subdomain: Optional[str] = None, + agent_pool_profiles: Optional[List["_models.ManagedClusterAgentPoolProfile"]] = None, + linux_profile: Optional["_models.ContainerServiceLinuxProfile"] = None, + windows_profile: Optional["_models.ManagedClusterWindowsProfile"] = None, + service_principal_profile: Optional["_models.ManagedClusterServicePrincipalProfile"] = None, + addon_profiles: Optional[Dict[str, "_models.ManagedClusterAddonProfile"]] = None, + pod_identity_profile: Optional["_models.ManagedClusterPodIdentityProfile"] = None, + oidc_issuer_profile: Optional["_models.ManagedClusterOIDCIssuerProfile"] = None, + node_resource_group: Optional[str] = None, + enable_rbac: Optional[bool] = None, + enable_pod_security_policy: Optional[bool] = None, + enable_namespace_resources: Optional[bool] = None, + network_profile: Optional["_models.ContainerServiceNetworkProfile"] = None, + aad_profile: Optional["_models.ManagedClusterAADProfile"] = None, + auto_upgrade_profile: Optional["_models.ManagedClusterAutoUpgradeProfile"] = None, + auto_scaler_profile: Optional["_models.ManagedClusterPropertiesAutoScalerProfile"] = None, + api_server_access_profile: Optional["_models.ManagedClusterAPIServerAccessProfile"] = None, + disk_encryption_set_id: Optional[str] = None, + identity_profile: Optional[Dict[str, "_models.UserAssignedIdentity"]] = None, + private_link_resources: Optional[List["_models.PrivateLinkResource"]] = None, + disable_local_accounts: Optional[bool] = None, + http_proxy_config: Optional["_models.ManagedClusterHTTPProxyConfig"] = None, + security_profile: Optional["_models.ManagedClusterSecurityProfile"] = None, + storage_profile: Optional["_models.ManagedClusterStorageProfile"] = None, + ingress_profile: Optional["_models.ManagedClusterIngressProfile"] = None, + public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None, + workload_auto_scaler_profile: Optional["_models.ManagedClusterWorkloadAutoScalerProfile"] = None, + **kwargs + ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + :keyword sku: The managed cluster SKU. + :paramtype sku: ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterSKU + :keyword extended_location: The extended location of the Virtual Machine. + :paramtype extended_location: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ExtendedLocation + :keyword identity: The identity of the managed cluster, if configured. + :paramtype identity: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterIdentity + :keyword creation_data: CreationData to be used to specify the source Snapshot ID if the + cluster will be created/upgraded using a snapshot. + :paramtype creation_data: ~azure.mgmt.containerservice.v2022_06_02_preview.models.CreationData + :keyword kubernetes_version: When you upgrade a supported AKS cluster, Kubernetes minor + versions cannot be skipped. All upgrades must be performed sequentially by major version + number. For example, upgrades between 1.14.x -> 1.15.x or 1.15.x -> 1.16.x are allowed, however + 1.14.x -> 1.16.x is not allowed. See `upgrading an AKS cluster + `_ for more details. + :paramtype kubernetes_version: str + :keyword dns_prefix: This cannot be updated once the Managed Cluster has been created. + :paramtype dns_prefix: str + :keyword fqdn_subdomain: This cannot be updated once the Managed Cluster has been created. + :paramtype fqdn_subdomain: str + :keyword agent_pool_profiles: The agent pool properties. + :paramtype agent_pool_profiles: + list[~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterAgentPoolProfile] + :keyword linux_profile: The profile for Linux VMs in the Managed Cluster. + :paramtype linux_profile: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ContainerServiceLinuxProfile + :keyword windows_profile: The profile for Windows VMs in the Managed Cluster. + :paramtype windows_profile: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterWindowsProfile + :keyword service_principal_profile: Information about a service principal identity for the + cluster to use for manipulating Azure APIs. + :paramtype service_principal_profile: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterServicePrincipalProfile + :keyword addon_profiles: The profile of managed cluster add-on. + :paramtype addon_profiles: dict[str, + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterAddonProfile] + :keyword pod_identity_profile: See `use AAD pod identity + `_ for more details on AAD pod + identity integration. + :paramtype pod_identity_profile: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterPodIdentityProfile + :keyword oidc_issuer_profile: The OIDC issuer profile of the Managed Cluster. + :paramtype oidc_issuer_profile: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterOIDCIssuerProfile + :keyword node_resource_group: The name of the resource group containing agent pool nodes. + :paramtype node_resource_group: str + :keyword enable_rbac: Whether to enable Kubernetes Role-Based Access Control. + :paramtype enable_rbac: bool + :keyword enable_pod_security_policy: (DEPRECATING) Whether to enable Kubernetes pod security + policy (preview). This feature is set for removal on October 15th, 2020. Learn more at + aka.ms/aks/azpodpolicy. + :paramtype enable_pod_security_policy: bool + :keyword enable_namespace_resources: The default value is false. It can be enabled/disabled on + creation and updation of the managed cluster. See `https://aka.ms/NamespaceARMResource + `_ for more details on Namespace as a ARM Resource. + :paramtype enable_namespace_resources: bool + :keyword network_profile: The network configuration profile. + :paramtype network_profile: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ContainerServiceNetworkProfile + :keyword aad_profile: The Azure Active Directory configuration. + :paramtype aad_profile: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterAADProfile + :keyword auto_upgrade_profile: The auto upgrade configuration. + :paramtype auto_upgrade_profile: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterAutoUpgradeProfile + :keyword auto_scaler_profile: Parameters to be applied to the cluster-autoscaler when enabled. + :paramtype auto_scaler_profile: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterPropertiesAutoScalerProfile + :keyword api_server_access_profile: The access profile for managed cluster API server. + :paramtype api_server_access_profile: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterAPIServerAccessProfile + :keyword disk_encryption_set_id: This is of the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{encryptionSetName}'. + :paramtype disk_encryption_set_id: str + :keyword identity_profile: Identities associated with the cluster. + :paramtype identity_profile: dict[str, + ~azure.mgmt.containerservice.v2022_06_02_preview.models.UserAssignedIdentity] + :keyword private_link_resources: Private link resources associated with the cluster. + :paramtype private_link_resources: + list[~azure.mgmt.containerservice.v2022_06_02_preview.models.PrivateLinkResource] + :keyword disable_local_accounts: If set to true, getting static credentials will be disabled + for this cluster. This must only be used on Managed Clusters that are AAD enabled. For more + details see `disable local accounts + `_. + :paramtype disable_local_accounts: bool + :keyword http_proxy_config: Configurations for provisioning the cluster with HTTP proxy + servers. + :paramtype http_proxy_config: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterHTTPProxyConfig + :keyword security_profile: Security profile for the managed cluster. + :paramtype security_profile: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterSecurityProfile + :keyword storage_profile: Storage profile for the managed cluster. + :paramtype storage_profile: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterStorageProfile + :keyword ingress_profile: Ingress profile for the managed cluster. + :paramtype ingress_profile: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterIngressProfile + :keyword public_network_access: Allow or deny public network access for AKS. Known values are: + "Enabled", "Disabled". + :paramtype public_network_access: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.PublicNetworkAccess + :keyword workload_auto_scaler_profile: Workload Auto-scaler profile for the container service + cluster. + :paramtype workload_auto_scaler_profile: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterWorkloadAutoScalerProfile + """ + super(ManagedCluster, self).__init__(tags=tags, location=location, **kwargs) + self.sku = sku + self.extended_location = extended_location + self.identity = identity + self.provisioning_state = None + self.power_state = None + self.creation_data = creation_data + self.max_agent_pools = None + self.kubernetes_version = kubernetes_version + self.current_kubernetes_version = None + self.dns_prefix = dns_prefix + self.fqdn_subdomain = fqdn_subdomain + self.fqdn = None + self.private_fqdn = None + self.azure_portal_fqdn = None + self.agent_pool_profiles = agent_pool_profiles + self.linux_profile = linux_profile + self.windows_profile = windows_profile + self.service_principal_profile = service_principal_profile + self.addon_profiles = addon_profiles + self.pod_identity_profile = pod_identity_profile + self.oidc_issuer_profile = oidc_issuer_profile + self.node_resource_group = node_resource_group + self.enable_rbac = enable_rbac + self.enable_pod_security_policy = enable_pod_security_policy + self.enable_namespace_resources = enable_namespace_resources + self.network_profile = network_profile + self.aad_profile = aad_profile + self.auto_upgrade_profile = auto_upgrade_profile + self.auto_scaler_profile = auto_scaler_profile + self.api_server_access_profile = api_server_access_profile + self.disk_encryption_set_id = disk_encryption_set_id + self.identity_profile = identity_profile + self.private_link_resources = private_link_resources + self.disable_local_accounts = disable_local_accounts + self.http_proxy_config = http_proxy_config + self.security_profile = security_profile + self.storage_profile = storage_profile + self.ingress_profile = ingress_profile + self.public_network_access = public_network_access + self.workload_auto_scaler_profile = workload_auto_scaler_profile + + +class ManagedClusterAADProfile(msrest.serialization.Model): + """For more details see `managed AAD on AKS `_. + + :ivar managed: Whether to enable managed AAD. + :vartype managed: bool + :ivar enable_azure_rbac: Whether to enable Azure RBAC for Kubernetes authorization. + :vartype enable_azure_rbac: bool + :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 server_app_id: The server AAD application ID. + :vartype server_app_id: str + :ivar server_app_secret: The server AAD application secret. + :vartype server_app_secret: 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 = { + 'managed': {'key': 'managed', 'type': 'bool'}, + 'enable_azure_rbac': {'key': 'enableAzureRBAC', 'type': 'bool'}, + 'admin_group_object_i_ds': {'key': 'adminGroupObjectIDs', 'type': '[str]'}, + 'client_app_id': {'key': 'clientAppID', 'type': 'str'}, + 'server_app_id': {'key': 'serverAppID', 'type': 'str'}, + 'server_app_secret': {'key': 'serverAppSecret', 'type': 'str'}, + 'tenant_id': {'key': 'tenantID', 'type': 'str'}, + } + + def __init__( + self, + *, + managed: Optional[bool] = None, + enable_azure_rbac: Optional[bool] = None, + admin_group_object_i_ds: Optional[List[str]] = None, + client_app_id: Optional[str] = None, + server_app_id: Optional[str] = None, + server_app_secret: Optional[str] = None, + tenant_id: Optional[str] = None, + **kwargs + ): + """ + :keyword managed: Whether to enable managed AAD. + :paramtype managed: bool + :keyword enable_azure_rbac: Whether to enable Azure RBAC for Kubernetes authorization. + :paramtype enable_azure_rbac: bool + :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 server_app_id: The server AAD application ID. + :paramtype server_app_id: str + :keyword server_app_secret: The server AAD application secret. + :paramtype server_app_secret: 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(ManagedClusterAADProfile, self).__init__(**kwargs) + self.managed = managed + self.enable_azure_rbac = enable_azure_rbac + self.admin_group_object_i_ds = admin_group_object_i_ds + self.client_app_id = client_app_id + self.server_app_id = server_app_id + self.server_app_secret = server_app_secret + self.tenant_id = tenant_id + + +class ManagedClusterAccessProfile(TrackedResource): + """Managed cluster Access Profile. + + 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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.containerservice.v2022_06_02_preview.models.SystemData + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str + :ivar kube_config: Base64-encoded Kubernetes configuration file. + :vartype kube_config: bytearray + """ + + _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'}, + 'kube_config': {'key': 'properties.kubeConfig', 'type': 'bytearray'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + kube_config: Optional[bytearray] = None, + **kwargs + ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + :keyword kube_config: Base64-encoded Kubernetes configuration file. + :paramtype kube_config: bytearray + """ + super(ManagedClusterAccessProfile, self).__init__(tags=tags, location=location, **kwargs) + self.kube_config = kube_config + + +class ManagedClusterAddonProfile(msrest.serialization.Model): + """A Kubernetes add-on profile for a managed cluster. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar enabled: Required. Whether the add-on is enabled or not. + :vartype enabled: bool + :ivar config: Key-value pairs for configuring an add-on. + :vartype config: dict[str, str] + :ivar identity: Information of user assigned identity used by this add-on. + :vartype identity: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterAddonProfileIdentity + """ + + _validation = { + 'enabled': {'required': True}, + 'identity': {'readonly': True}, + } + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'config': {'key': 'config', 'type': '{str}'}, + 'identity': {'key': 'identity', 'type': 'ManagedClusterAddonProfileIdentity'}, + } + + def __init__( + self, + *, + enabled: bool, + config: Optional[Dict[str, str]] = None, + **kwargs + ): + """ + :keyword enabled: Required. Whether the add-on is enabled or not. + :paramtype enabled: bool + :keyword config: Key-value pairs for configuring an add-on. + :paramtype config: dict[str, str] + """ + super(ManagedClusterAddonProfile, self).__init__(**kwargs) + self.enabled = enabled + self.config = config + self.identity = None + + +class UserAssignedIdentity(msrest.serialization.Model): + """Details about a user assigned identity. + + :ivar resource_id: The resource ID of the user assigned identity. + :vartype resource_id: str + :ivar client_id: The client ID of the user assigned identity. + :vartype client_id: str + :ivar object_id: The object ID of the user assigned identity. + :vartype object_id: str + """ + + _attribute_map = { + 'resource_id': {'key': 'resourceId', 'type': 'str'}, + 'client_id': {'key': 'clientId', 'type': 'str'}, + 'object_id': {'key': 'objectId', 'type': 'str'}, + } + + def __init__( + self, + *, + resource_id: Optional[str] = None, + client_id: Optional[str] = None, + object_id: Optional[str] = None, + **kwargs + ): + """ + :keyword resource_id: The resource ID of the user assigned identity. + :paramtype resource_id: str + :keyword client_id: The client ID of the user assigned identity. + :paramtype client_id: str + :keyword object_id: The object ID of the user assigned identity. + :paramtype object_id: str + """ + super(UserAssignedIdentity, self).__init__(**kwargs) + self.resource_id = resource_id + self.client_id = client_id + self.object_id = object_id + + +class ManagedClusterAddonProfileIdentity(UserAssignedIdentity): + """Information of user assigned identity used by this add-on. + + :ivar resource_id: The resource ID of the user assigned identity. + :vartype resource_id: str + :ivar client_id: The client ID of the user assigned identity. + :vartype client_id: str + :ivar object_id: The object ID of the user assigned identity. + :vartype object_id: str + """ + + _attribute_map = { + 'resource_id': {'key': 'resourceId', 'type': 'str'}, + 'client_id': {'key': 'clientId', 'type': 'str'}, + 'object_id': {'key': 'objectId', 'type': 'str'}, + } + + def __init__( + self, + *, + resource_id: Optional[str] = None, + client_id: Optional[str] = None, + object_id: Optional[str] = None, + **kwargs + ): + """ + :keyword resource_id: The resource ID of the user assigned identity. + :paramtype resource_id: str + :keyword client_id: The client ID of the user assigned identity. + :paramtype client_id: str + :keyword object_id: The object ID of the user assigned identity. + :paramtype object_id: str + """ + super(ManagedClusterAddonProfileIdentity, self).__init__(resource_id=resource_id, client_id=client_id, object_id=object_id, **kwargs) + + +class ManagedClusterAgentPoolProfileProperties(msrest.serialization.Model): + """Properties for the container service agent pool profile. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar count: Number of agents (VMs) to host docker containers. Allowed values must be in the + range of 0 to 1000 (inclusive) for user pools and in the range of 1 to 1000 (inclusive) for + system pools. The default value is 1. + :vartype count: int + :ivar vm_size: VM size availability varies by region. If a node contains insufficient compute + resources (memory, cpu, etc) pods might fail to run correctly. For more details on restricted + VM sizes, see: https://docs.microsoft.com/azure/aks/quotas-skus-regions. + :vartype vm_size: str + :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine + in the master/agent pool. If you specify 0, it will apply the default osDisk size according to + the vmSize specified. + :vartype os_disk_size_gb: int + :ivar os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk + larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed + after creation. For more information see `Ephemeral OS + `_. Known values are: + "Managed", "Ephemeral". + :vartype os_disk_type: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.OSDiskType + :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data + root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + :vartype kubelet_disk_type: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.KubeletDiskType + :ivar workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer", "WasmWasi". + :vartype workload_runtime: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.WorkloadRuntime + :ivar message_of_the_day: A base64-encoded string which will be written to /etc/motd after + decoding. This allows customization of the message of the day for Linux nodes. It must not be + specified for Windows nodes. It must be a static string (i.e., will be printed raw and not be + executed as a script). + :vartype message_of_the_day: str + :ivar vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and used. + If no podSubnetID is specified, this applies to nodes and pods, otherwise it applies to just + nodes. This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. + :vartype vnet_subnet_id: str + :ivar pod_subnet_id: If omitted, pod IPs are statically assigned on the node subnet (see + vnetSubnetID for more details). This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. + :vartype pod_subnet_id: str + :ivar max_pods: The maximum number of pods that can run on a node. + :vartype max_pods: int + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". + :vartype os_type: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.OSType + :ivar os_sku: Specifies the OS SKU used by the agent pool. If not specified, the default is + Ubuntu if OSType=Linux or Windows2019 if OSType=Windows. And the default Windows OSSKU will be + changed to Windows2022 after Windows2019 is deprecated. Known values are: "Ubuntu", + "CBLMariner", "Windows2019", "Windows2022". + :vartype os_sku: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.OSSKU + :ivar max_count: The maximum number of nodes for auto-scaling. + :vartype max_count: int + :ivar min_count: The minimum number of nodes for auto-scaling. + :vartype min_count: int + :ivar enable_auto_scaling: Whether to enable auto-scaler. + :vartype enable_auto_scaling: bool + :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it + defaults to Delete. Known values are: "Delete", "Deallocate". + :vartype scale_down_mode: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ScaleDownMode + :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", + "AvailabilitySet". + :vartype type: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.AgentPoolType + :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional + information on agent pool restrictions and best practices, see: + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + :vartype mode: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.AgentPoolMode + :ivar orchestrator_version: Both patch version and are + supported. When is specified, the latest supported patch version is chosen + automatically. Updating the agent pool with the same once it has been created + will not trigger an upgrade, even if a newer patch version is available. As a best practice, + you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node + pool version must have the same major version as the control plane. The node pool minor version + must be within two minor versions of the control plane version. The node pool version cannot be + greater than the control plane version. For more information see `upgrading a node pool + `_. + :vartype orchestrator_version: str + :ivar current_orchestrator_version: If orchestratorVersion was a fully specified version + , this field will be exactly equal to it. If orchestratorVersion was + , this field will contain the full version being used. + :vartype current_orchestrator_version: str + :ivar node_image_version: The version of node image. + :vartype node_image_version: str + :ivar upgrade_settings: Settings for upgrading the agentpool. + :vartype upgrade_settings: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.AgentPoolUpgradeSettings + :ivar provisioning_state: The current deployment or provisioning state. + :vartype provisioning_state: str + :ivar power_state: When an Agent Pool is first created it is initially Running. The Agent Pool + can be stopped by setting this field to Stopped. A stopped Agent Pool stops all of its VMs and + does not accrue billing charges. An Agent Pool can only be stopped if it is Running and + provisioning state is Succeeded. + :vartype power_state: ~azure.mgmt.containerservice.v2022_06_02_preview.models.PowerState + :ivar availability_zones: The list of Availability zones to use for nodes. This can only be + specified if the AgentPoolType property is 'VirtualMachineScaleSets'. + :vartype availability_zones: list[str] + :ivar enable_node_public_ip: Some scenarios may require nodes in a node pool to receive their + own dedicated public IP addresses. A common scenario is for gaming workloads, where a console + needs to make a direct connection to a cloud virtual machine to minimize hops. For more + information see `assigning a public IP per node + `_. + The default is false. + :vartype enable_node_public_ip: bool + :ivar enable_custom_ca_trust: When set to true, AKS deploys a daemonset and host services to + sync custom certificate authorities from a user-provided config map into node trust stores. + Defaults to false. + :vartype enable_custom_ca_trust: bool + :ivar node_public_ip_prefix_id: This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. + :vartype node_public_ip_prefix_id: str + :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default + is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + :vartype scale_set_priority: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ScaleSetPriority + :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". + :vartype scale_set_eviction_policy: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ScaleSetEvictionPolicy + :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which + indicates the willingness to pay any on-demand price. For more details on spot pricing, see + `spot VMs pricing `_. + :vartype spot_max_price: float + :ivar tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale + set. + :vartype tags: dict[str, str] + :ivar node_labels: The node labels to be persisted across all nodes in agent pool. + :vartype node_labels: dict[str, str] + :ivar node_taints: The taints added to new nodes during node pool create and scale. For + example, key=value:NoSchedule. + :vartype node_taints: list[str] + :ivar proximity_placement_group_id: The ID for Proximity Placement Group. + :vartype proximity_placement_group_id: str + :ivar kubelet_config: The Kubelet configuration on the agent pool nodes. + :vartype kubelet_config: ~azure.mgmt.containerservice.v2022_06_02_preview.models.KubeletConfig + :ivar linux_os_config: The OS configuration of Linux agent nodes. + :vartype linux_os_config: ~azure.mgmt.containerservice.v2022_06_02_preview.models.LinuxOSConfig + :ivar enable_encryption_at_host: This is only supported on certain VM sizes and in certain + Azure regions. For more information, see: + https://docs.microsoft.com/azure/aks/enable-host-encryption. + :vartype enable_encryption_at_host: bool + :ivar enable_ultra_ssd: Whether to enable UltraSSD. + :vartype enable_ultra_ssd: bool + :ivar enable_fips: See `Add a FIPS-enabled node pool + `_ + for more details. + :vartype enable_fips: bool + :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + :vartype gpu_instance_profile: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.GPUInstanceProfile + :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool + will be created/upgraded using a snapshot. + :vartype creation_data: ~azure.mgmt.containerservice.v2022_06_02_preview.models.CreationData + :ivar capacity_reservation_group_id: AKS will associate the specified agent pool with the + Capacity Reservation Group. + :vartype capacity_reservation_group_id: str + :ivar host_group_id: This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}. + For more information see `Azure dedicated hosts + `_. + :vartype host_group_id: str + """ + + _validation = { + 'os_disk_size_gb': {'maximum': 2048, 'minimum': 0}, + 'current_orchestrator_version': {'readonly': True}, + 'node_image_version': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'count': {'key': 'count', 'type': 'int'}, + 'vm_size': {'key': 'vmSize', 'type': 'str'}, + 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, + 'os_disk_type': {'key': 'osDiskType', 'type': 'str'}, + 'kubelet_disk_type': {'key': 'kubeletDiskType', 'type': 'str'}, + 'workload_runtime': {'key': 'workloadRuntime', 'type': 'str'}, + 'message_of_the_day': {'key': 'messageOfTheDay', 'type': 'str'}, + 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, + 'pod_subnet_id': {'key': 'podSubnetID', 'type': 'str'}, + 'max_pods': {'key': 'maxPods', 'type': 'int'}, + 'os_type': {'key': 'osType', 'type': 'str'}, + 'os_sku': {'key': 'osSKU', 'type': 'str'}, + 'max_count': {'key': 'maxCount', 'type': 'int'}, + 'min_count': {'key': 'minCount', 'type': 'int'}, + 'enable_auto_scaling': {'key': 'enableAutoScaling', 'type': 'bool'}, + 'scale_down_mode': {'key': 'scaleDownMode', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'mode': {'key': 'mode', 'type': 'str'}, + 'orchestrator_version': {'key': 'orchestratorVersion', 'type': 'str'}, + 'current_orchestrator_version': {'key': 'currentOrchestratorVersion', 'type': 'str'}, + 'node_image_version': {'key': 'nodeImageVersion', 'type': 'str'}, + 'upgrade_settings': {'key': 'upgradeSettings', 'type': 'AgentPoolUpgradeSettings'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'power_state': {'key': 'powerState', 'type': 'PowerState'}, + 'availability_zones': {'key': 'availabilityZones', 'type': '[str]'}, + 'enable_node_public_ip': {'key': 'enableNodePublicIP', 'type': 'bool'}, + 'enable_custom_ca_trust': {'key': 'enableCustomCATrust', 'type': 'bool'}, + 'node_public_ip_prefix_id': {'key': 'nodePublicIPPrefixID', 'type': 'str'}, + 'scale_set_priority': {'key': 'scaleSetPriority', 'type': 'str'}, + 'scale_set_eviction_policy': {'key': 'scaleSetEvictionPolicy', 'type': 'str'}, + 'spot_max_price': {'key': 'spotMaxPrice', 'type': 'float'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'node_labels': {'key': 'nodeLabels', 'type': '{str}'}, + 'node_taints': {'key': 'nodeTaints', 'type': '[str]'}, + 'proximity_placement_group_id': {'key': 'proximityPlacementGroupID', 'type': 'str'}, + 'kubelet_config': {'key': 'kubeletConfig', 'type': 'KubeletConfig'}, + 'linux_os_config': {'key': 'linuxOSConfig', 'type': 'LinuxOSConfig'}, + 'enable_encryption_at_host': {'key': 'enableEncryptionAtHost', 'type': 'bool'}, + 'enable_ultra_ssd': {'key': 'enableUltraSSD', 'type': 'bool'}, + 'enable_fips': {'key': 'enableFIPS', 'type': 'bool'}, + 'gpu_instance_profile': {'key': 'gpuInstanceProfile', 'type': 'str'}, + 'creation_data': {'key': 'creationData', 'type': 'CreationData'}, + 'capacity_reservation_group_id': {'key': 'capacityReservationGroupID', 'type': 'str'}, + 'host_group_id': {'key': 'hostGroupID', 'type': 'str'}, + } + + def __init__( + self, + *, + count: Optional[int] = None, + vm_size: Optional[str] = None, + os_disk_size_gb: Optional[int] = None, + os_disk_type: Optional[Union[str, "_models.OSDiskType"]] = None, + kubelet_disk_type: Optional[Union[str, "_models.KubeletDiskType"]] = None, + workload_runtime: Optional[Union[str, "_models.WorkloadRuntime"]] = None, + message_of_the_day: Optional[str] = None, + vnet_subnet_id: Optional[str] = None, + pod_subnet_id: Optional[str] = None, + max_pods: Optional[int] = None, + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_sku: Optional[Union[str, "_models.OSSKU"]] = None, + max_count: Optional[int] = None, + min_count: Optional[int] = None, + enable_auto_scaling: Optional[bool] = None, + scale_down_mode: Optional[Union[str, "_models.ScaleDownMode"]] = None, + type: Optional[Union[str, "_models.AgentPoolType"]] = None, + mode: Optional[Union[str, "_models.AgentPoolMode"]] = None, + orchestrator_version: Optional[str] = None, + upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, + power_state: Optional["_models.PowerState"] = None, + availability_zones: Optional[List[str]] = None, + enable_node_public_ip: Optional[bool] = None, + enable_custom_ca_trust: Optional[bool] = None, + node_public_ip_prefix_id: Optional[str] = None, + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", + spot_max_price: Optional[float] = -1, + tags: Optional[Dict[str, str]] = None, + node_labels: Optional[Dict[str, str]] = None, + node_taints: Optional[List[str]] = None, + proximity_placement_group_id: Optional[str] = None, + kubelet_config: Optional["_models.KubeletConfig"] = None, + linux_os_config: Optional["_models.LinuxOSConfig"] = None, + enable_encryption_at_host: Optional[bool] = None, + enable_ultra_ssd: Optional[bool] = None, + enable_fips: Optional[bool] = None, + gpu_instance_profile: Optional[Union[str, "_models.GPUInstanceProfile"]] = None, + creation_data: Optional["_models.CreationData"] = None, + capacity_reservation_group_id: Optional[str] = None, + host_group_id: Optional[str] = None, + **kwargs + ): + """ + :keyword count: Number of agents (VMs) to host docker containers. Allowed values must be in the + range of 0 to 1000 (inclusive) for user pools and in the range of 1 to 1000 (inclusive) for + system pools. The default value is 1. + :paramtype count: int + :keyword vm_size: VM size availability varies by region. If a node contains insufficient + compute resources (memory, cpu, etc) pods might fail to run correctly. For more details on + restricted VM sizes, see: https://docs.microsoft.com/azure/aks/quotas-skus-regions. + :paramtype vm_size: str + :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every + machine in the master/agent pool. If you specify 0, it will apply the default osDisk size + according to the vmSize specified. + :paramtype os_disk_size_gb: int + :keyword os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk + larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed + after creation. For more information see `Ephemeral OS + `_. Known values are: + "Managed", "Ephemeral". + :paramtype os_disk_type: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.OSDiskType + :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime + data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + :paramtype kubelet_disk_type: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.KubeletDiskType + :keyword workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer", "WasmWasi". + :paramtype workload_runtime: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.WorkloadRuntime + :keyword message_of_the_day: A base64-encoded string which will be written to /etc/motd after + decoding. This allows customization of the message of the day for Linux nodes. It must not be + specified for Windows nodes. It must be a static string (i.e., will be printed raw and not be + executed as a script). + :paramtype message_of_the_day: str + :keyword vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and + used. If no podSubnetID is specified, this applies to nodes and pods, otherwise it applies to + just nodes. This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. + :paramtype vnet_subnet_id: str + :keyword pod_subnet_id: If omitted, pod IPs are statically assigned on the node subnet (see + vnetSubnetID for more details). This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. + :paramtype pod_subnet_id: str + :keyword max_pods: The maximum number of pods that can run on a node. + :paramtype max_pods: int + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". + :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.OSType + :keyword os_sku: Specifies the OS SKU used by the agent pool. If not specified, the default is + Ubuntu if OSType=Linux or Windows2019 if OSType=Windows. And the default Windows OSSKU will be + changed to Windows2022 after Windows2019 is deprecated. Known values are: "Ubuntu", + "CBLMariner", "Windows2019", "Windows2022". + :paramtype os_sku: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.OSSKU + :keyword max_count: The maximum number of nodes for auto-scaling. + :paramtype max_count: int + :keyword min_count: The minimum number of nodes for auto-scaling. + :paramtype min_count: int + :keyword enable_auto_scaling: Whether to enable auto-scaler. + :paramtype enable_auto_scaling: bool + :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, + it defaults to Delete. Known values are: "Delete", "Deallocate". + :paramtype scale_down_mode: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ScaleDownMode + :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", + "AvailabilitySet". + :paramtype type: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.AgentPoolType + :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For + additional information on agent pool restrictions and best practices, see: + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + :paramtype mode: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.AgentPoolMode + :keyword orchestrator_version: Both patch version and are + supported. When is specified, the latest supported patch version is chosen + automatically. Updating the agent pool with the same once it has been created + will not trigger an upgrade, even if a newer patch version is available. As a best practice, + you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node + pool version must have the same major version as the control plane. The node pool minor version + must be within two minor versions of the control plane version. The node pool version cannot be + greater than the control plane version. For more information see `upgrading a node pool + `_. + :paramtype orchestrator_version: str + :keyword upgrade_settings: Settings for upgrading the agentpool. + :paramtype upgrade_settings: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.AgentPoolUpgradeSettings + :keyword power_state: When an Agent Pool is first created it is initially Running. The Agent + Pool can be stopped by setting this field to Stopped. A stopped Agent Pool stops all of its VMs + and does not accrue billing charges. An Agent Pool can only be stopped if it is Running and + provisioning state is Succeeded. + :paramtype power_state: ~azure.mgmt.containerservice.v2022_06_02_preview.models.PowerState + :keyword availability_zones: The list of Availability zones to use for nodes. This can only be + specified if the AgentPoolType property is 'VirtualMachineScaleSets'. + :paramtype availability_zones: list[str] + :keyword enable_node_public_ip: Some scenarios may require nodes in a node pool to receive + their own dedicated public IP addresses. A common scenario is for gaming workloads, where a + console needs to make a direct connection to a cloud virtual machine to minimize hops. For more + information see `assigning a public IP per node + `_. + The default is false. + :paramtype enable_node_public_ip: bool + :keyword enable_custom_ca_trust: When set to true, AKS deploys a daemonset and host services to + sync custom certificate authorities from a user-provided config map into node trust stores. + Defaults to false. + :paramtype enable_custom_ca_trust: bool + :keyword node_public_ip_prefix_id: This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. + :paramtype node_public_ip_prefix_id: str + :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the + default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + :paramtype scale_set_priority: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ScaleSetPriority + :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". + :paramtype scale_set_eviction_policy: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ScaleSetEvictionPolicy + :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which + indicates the willingness to pay any on-demand price. For more details on spot pricing, see + `spot VMs pricing `_. + :paramtype spot_max_price: float + :keyword tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale + set. + :paramtype tags: dict[str, str] + :keyword node_labels: The node labels to be persisted across all nodes in agent pool. + :paramtype node_labels: dict[str, str] + :keyword node_taints: The taints added to new nodes during node pool create and scale. For + example, key=value:NoSchedule. + :paramtype node_taints: list[str] + :keyword proximity_placement_group_id: The ID for Proximity Placement Group. + :paramtype proximity_placement_group_id: str + :keyword kubelet_config: The Kubelet configuration on the agent pool nodes. + :paramtype kubelet_config: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.KubeletConfig + :keyword linux_os_config: The OS configuration of Linux agent nodes. + :paramtype linux_os_config: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.LinuxOSConfig + :keyword enable_encryption_at_host: This is only supported on certain VM sizes and in certain + Azure regions. For more information, see: + https://docs.microsoft.com/azure/aks/enable-host-encryption. + :paramtype enable_encryption_at_host: bool + :keyword enable_ultra_ssd: Whether to enable UltraSSD. + :paramtype enable_ultra_ssd: bool + :keyword enable_fips: See `Add a FIPS-enabled node pool + `_ + for more details. + :paramtype enable_fips: bool + :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + "MIG7g". + :paramtype gpu_instance_profile: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.GPUInstanceProfile + :keyword creation_data: CreationData to be used to specify the source Snapshot ID if the node + pool will be created/upgraded using a snapshot. + :paramtype creation_data: ~azure.mgmt.containerservice.v2022_06_02_preview.models.CreationData + :keyword capacity_reservation_group_id: AKS will associate the specified agent pool with the + Capacity Reservation Group. + :paramtype capacity_reservation_group_id: str + :keyword host_group_id: This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}. + For more information see `Azure dedicated hosts + `_. + :paramtype host_group_id: str + """ + super(ManagedClusterAgentPoolProfileProperties, self).__init__(**kwargs) + self.count = count + self.vm_size = vm_size + self.os_disk_size_gb = os_disk_size_gb + self.os_disk_type = os_disk_type + self.kubelet_disk_type = kubelet_disk_type + self.workload_runtime = workload_runtime + self.message_of_the_day = message_of_the_day + self.vnet_subnet_id = vnet_subnet_id + self.pod_subnet_id = pod_subnet_id + self.max_pods = max_pods + self.os_type = os_type + self.os_sku = os_sku + self.max_count = max_count + self.min_count = min_count + self.enable_auto_scaling = enable_auto_scaling + self.scale_down_mode = scale_down_mode + self.type = type + self.mode = mode + self.orchestrator_version = orchestrator_version + self.current_orchestrator_version = None + self.node_image_version = None + self.upgrade_settings = upgrade_settings + self.provisioning_state = None + self.power_state = power_state + self.availability_zones = availability_zones + self.enable_node_public_ip = enable_node_public_ip + self.enable_custom_ca_trust = enable_custom_ca_trust + self.node_public_ip_prefix_id = node_public_ip_prefix_id + self.scale_set_priority = scale_set_priority + self.scale_set_eviction_policy = scale_set_eviction_policy + self.spot_max_price = spot_max_price + self.tags = tags + self.node_labels = node_labels + self.node_taints = node_taints + self.proximity_placement_group_id = proximity_placement_group_id + self.kubelet_config = kubelet_config + self.linux_os_config = linux_os_config + self.enable_encryption_at_host = enable_encryption_at_host + self.enable_ultra_ssd = enable_ultra_ssd + self.enable_fips = enable_fips + self.gpu_instance_profile = gpu_instance_profile + self.creation_data = creation_data + self.capacity_reservation_group_id = capacity_reservation_group_id + self.host_group_id = host_group_id + + +class ManagedClusterAgentPoolProfile(ManagedClusterAgentPoolProfileProperties): + """Profile for the container service agent pool. + + 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 count: Number of agents (VMs) to host docker containers. Allowed values must be in the + range of 0 to 1000 (inclusive) for user pools and in the range of 1 to 1000 (inclusive) for + system pools. The default value is 1. + :vartype count: int + :ivar vm_size: VM size availability varies by region. If a node contains insufficient compute + resources (memory, cpu, etc) pods might fail to run correctly. For more details on restricted + VM sizes, see: https://docs.microsoft.com/azure/aks/quotas-skus-regions. + :vartype vm_size: str + :ivar os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every machine + in the master/agent pool. If you specify 0, it will apply the default osDisk size according to + the vmSize specified. + :vartype os_disk_size_gb: int + :ivar os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk + larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed + after creation. For more information see `Ephemeral OS + `_. Known values are: + "Managed", "Ephemeral". + :vartype os_disk_type: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.OSDiskType + :ivar kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime data + root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + :vartype kubelet_disk_type: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.KubeletDiskType + :ivar workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer", "WasmWasi". + :vartype workload_runtime: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.WorkloadRuntime + :ivar message_of_the_day: A base64-encoded string which will be written to /etc/motd after + decoding. This allows customization of the message of the day for Linux nodes. It must not be + specified for Windows nodes. It must be a static string (i.e., will be printed raw and not be + executed as a script). + :vartype message_of_the_day: str + :ivar vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and used. + If no podSubnetID is specified, this applies to nodes and pods, otherwise it applies to just + nodes. This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. + :vartype vnet_subnet_id: str + :ivar pod_subnet_id: If omitted, pod IPs are statically assigned on the node subnet (see + vnetSubnetID for more details). This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. + :vartype pod_subnet_id: str + :ivar max_pods: The maximum number of pods that can run on a node. + :vartype max_pods: int + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". + :vartype os_type: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.OSType + :ivar os_sku: Specifies the OS SKU used by the agent pool. If not specified, the default is + Ubuntu if OSType=Linux or Windows2019 if OSType=Windows. And the default Windows OSSKU will be + changed to Windows2022 after Windows2019 is deprecated. Known values are: "Ubuntu", + "CBLMariner", "Windows2019", "Windows2022". + :vartype os_sku: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.OSSKU + :ivar max_count: The maximum number of nodes for auto-scaling. + :vartype max_count: int + :ivar min_count: The minimum number of nodes for auto-scaling. + :vartype min_count: int + :ivar enable_auto_scaling: Whether to enable auto-scaler. + :vartype enable_auto_scaling: bool + :ivar scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, it + defaults to Delete. Known values are: "Delete", "Deallocate". + :vartype scale_down_mode: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ScaleDownMode + :ivar type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", + "AvailabilitySet". + :vartype type: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.AgentPoolType + :ivar mode: A cluster must have at least one 'System' Agent Pool at all times. For additional + information on agent pool restrictions and best practices, see: + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + :vartype mode: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.AgentPoolMode + :ivar orchestrator_version: Both patch version and are + supported. When is specified, the latest supported patch version is chosen + automatically. Updating the agent pool with the same once it has been created + will not trigger an upgrade, even if a newer patch version is available. As a best practice, + you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node + pool version must have the same major version as the control plane. The node pool minor version + must be within two minor versions of the control plane version. The node pool version cannot be + greater than the control plane version. For more information see `upgrading a node pool + `_. + :vartype orchestrator_version: str + :ivar current_orchestrator_version: If orchestratorVersion was a fully specified version + , this field will be exactly equal to it. If orchestratorVersion was + , this field will contain the full version being used. + :vartype current_orchestrator_version: str + :ivar node_image_version: The version of node image. + :vartype node_image_version: str + :ivar upgrade_settings: Settings for upgrading the agentpool. + :vartype upgrade_settings: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.AgentPoolUpgradeSettings + :ivar provisioning_state: The current deployment or provisioning state. + :vartype provisioning_state: str + :ivar power_state: When an Agent Pool is first created it is initially Running. The Agent Pool + can be stopped by setting this field to Stopped. A stopped Agent Pool stops all of its VMs and + does not accrue billing charges. An Agent Pool can only be stopped if it is Running and + provisioning state is Succeeded. + :vartype power_state: ~azure.mgmt.containerservice.v2022_06_02_preview.models.PowerState + :ivar availability_zones: The list of Availability zones to use for nodes. This can only be + specified if the AgentPoolType property is 'VirtualMachineScaleSets'. + :vartype availability_zones: list[str] + :ivar enable_node_public_ip: Some scenarios may require nodes in a node pool to receive their + own dedicated public IP addresses. A common scenario is for gaming workloads, where a console + needs to make a direct connection to a cloud virtual machine to minimize hops. For more + information see `assigning a public IP per node + `_. + The default is false. + :vartype enable_node_public_ip: bool + :ivar enable_custom_ca_trust: When set to true, AKS deploys a daemonset and host services to + sync custom certificate authorities from a user-provided config map into node trust stores. + Defaults to false. + :vartype enable_custom_ca_trust: bool + :ivar node_public_ip_prefix_id: This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. + :vartype node_public_ip_prefix_id: str + :ivar scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the default + is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + :vartype scale_set_priority: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ScaleSetPriority + :ivar scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". + :vartype scale_set_eviction_policy: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ScaleSetEvictionPolicy + :ivar spot_max_price: Possible values are any decimal value greater than zero or -1 which + indicates the willingness to pay any on-demand price. For more details on spot pricing, see + `spot VMs pricing `_. + :vartype spot_max_price: float + :ivar tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale + set. + :vartype tags: dict[str, str] + :ivar node_labels: The node labels to be persisted across all nodes in agent pool. + :vartype node_labels: dict[str, str] + :ivar node_taints: The taints added to new nodes during node pool create and scale. For + example, key=value:NoSchedule. + :vartype node_taints: list[str] + :ivar proximity_placement_group_id: The ID for Proximity Placement Group. + :vartype proximity_placement_group_id: str + :ivar kubelet_config: The Kubelet configuration on the agent pool nodes. + :vartype kubelet_config: ~azure.mgmt.containerservice.v2022_06_02_preview.models.KubeletConfig + :ivar linux_os_config: The OS configuration of Linux agent nodes. + :vartype linux_os_config: ~azure.mgmt.containerservice.v2022_06_02_preview.models.LinuxOSConfig + :ivar enable_encryption_at_host: This is only supported on certain VM sizes and in certain + Azure regions. For more information, see: + https://docs.microsoft.com/azure/aks/enable-host-encryption. + :vartype enable_encryption_at_host: bool + :ivar enable_ultra_ssd: Whether to enable UltraSSD. + :vartype enable_ultra_ssd: bool + :ivar enable_fips: See `Add a FIPS-enabled node pool + `_ + for more details. + :vartype enable_fips: bool + :ivar gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance profile + for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", "MIG7g". + :vartype gpu_instance_profile: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.GPUInstanceProfile + :ivar creation_data: CreationData to be used to specify the source Snapshot ID if the node pool + will be created/upgraded using a snapshot. + :vartype creation_data: ~azure.mgmt.containerservice.v2022_06_02_preview.models.CreationData + :ivar capacity_reservation_group_id: AKS will associate the specified agent pool with the + Capacity Reservation Group. + :vartype capacity_reservation_group_id: str + :ivar host_group_id: This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}. + For more information see `Azure dedicated hosts + `_. + :vartype host_group_id: str + :ivar name: Required. Windows agent pool names must be 6 characters or less. + :vartype name: str + """ + + _validation = { + 'os_disk_size_gb': {'maximum': 2048, 'minimum': 0}, + 'current_orchestrator_version': {'readonly': True}, + 'node_image_version': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'name': {'required': True, 'pattern': r'^[a-z][a-z0-9]{0,11}$'}, + } + + _attribute_map = { + 'count': {'key': 'count', 'type': 'int'}, + 'vm_size': {'key': 'vmSize', 'type': 'str'}, + 'os_disk_size_gb': {'key': 'osDiskSizeGB', 'type': 'int'}, + 'os_disk_type': {'key': 'osDiskType', 'type': 'str'}, + 'kubelet_disk_type': {'key': 'kubeletDiskType', 'type': 'str'}, + 'workload_runtime': {'key': 'workloadRuntime', 'type': 'str'}, + 'message_of_the_day': {'key': 'messageOfTheDay', 'type': 'str'}, + 'vnet_subnet_id': {'key': 'vnetSubnetID', 'type': 'str'}, + 'pod_subnet_id': {'key': 'podSubnetID', 'type': 'str'}, + 'max_pods': {'key': 'maxPods', 'type': 'int'}, + 'os_type': {'key': 'osType', 'type': 'str'}, + 'os_sku': {'key': 'osSKU', 'type': 'str'}, + 'max_count': {'key': 'maxCount', 'type': 'int'}, + 'min_count': {'key': 'minCount', 'type': 'int'}, + 'enable_auto_scaling': {'key': 'enableAutoScaling', 'type': 'bool'}, + 'scale_down_mode': {'key': 'scaleDownMode', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'mode': {'key': 'mode', 'type': 'str'}, + 'orchestrator_version': {'key': 'orchestratorVersion', 'type': 'str'}, + 'current_orchestrator_version': {'key': 'currentOrchestratorVersion', 'type': 'str'}, + 'node_image_version': {'key': 'nodeImageVersion', 'type': 'str'}, + 'upgrade_settings': {'key': 'upgradeSettings', 'type': 'AgentPoolUpgradeSettings'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'power_state': {'key': 'powerState', 'type': 'PowerState'}, + 'availability_zones': {'key': 'availabilityZones', 'type': '[str]'}, + 'enable_node_public_ip': {'key': 'enableNodePublicIP', 'type': 'bool'}, + 'enable_custom_ca_trust': {'key': 'enableCustomCATrust', 'type': 'bool'}, + 'node_public_ip_prefix_id': {'key': 'nodePublicIPPrefixID', 'type': 'str'}, + 'scale_set_priority': {'key': 'scaleSetPriority', 'type': 'str'}, + 'scale_set_eviction_policy': {'key': 'scaleSetEvictionPolicy', 'type': 'str'}, + 'spot_max_price': {'key': 'spotMaxPrice', 'type': 'float'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'node_labels': {'key': 'nodeLabels', 'type': '{str}'}, + 'node_taints': {'key': 'nodeTaints', 'type': '[str]'}, + 'proximity_placement_group_id': {'key': 'proximityPlacementGroupID', 'type': 'str'}, + 'kubelet_config': {'key': 'kubeletConfig', 'type': 'KubeletConfig'}, + 'linux_os_config': {'key': 'linuxOSConfig', 'type': 'LinuxOSConfig'}, + 'enable_encryption_at_host': {'key': 'enableEncryptionAtHost', 'type': 'bool'}, + 'enable_ultra_ssd': {'key': 'enableUltraSSD', 'type': 'bool'}, + 'enable_fips': {'key': 'enableFIPS', 'type': 'bool'}, + 'gpu_instance_profile': {'key': 'gpuInstanceProfile', 'type': 'str'}, + 'creation_data': {'key': 'creationData', 'type': 'CreationData'}, + 'capacity_reservation_group_id': {'key': 'capacityReservationGroupID', 'type': 'str'}, + 'host_group_id': {'key': 'hostGroupID', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + count: Optional[int] = None, + vm_size: Optional[str] = None, + os_disk_size_gb: Optional[int] = None, + os_disk_type: Optional[Union[str, "_models.OSDiskType"]] = None, + kubelet_disk_type: Optional[Union[str, "_models.KubeletDiskType"]] = None, + workload_runtime: Optional[Union[str, "_models.WorkloadRuntime"]] = None, + message_of_the_day: Optional[str] = None, + vnet_subnet_id: Optional[str] = None, + pod_subnet_id: Optional[str] = None, + max_pods: Optional[int] = None, + os_type: Optional[Union[str, "_models.OSType"]] = "Linux", + os_sku: Optional[Union[str, "_models.OSSKU"]] = None, + max_count: Optional[int] = None, + min_count: Optional[int] = None, + enable_auto_scaling: Optional[bool] = None, + scale_down_mode: Optional[Union[str, "_models.ScaleDownMode"]] = None, + type: Optional[Union[str, "_models.AgentPoolType"]] = None, + mode: Optional[Union[str, "_models.AgentPoolMode"]] = None, + orchestrator_version: Optional[str] = None, + upgrade_settings: Optional["_models.AgentPoolUpgradeSettings"] = None, + power_state: Optional["_models.PowerState"] = None, + availability_zones: Optional[List[str]] = None, + enable_node_public_ip: Optional[bool] = None, + enable_custom_ca_trust: Optional[bool] = None, + node_public_ip_prefix_id: Optional[str] = None, + scale_set_priority: Optional[Union[str, "_models.ScaleSetPriority"]] = "Regular", + scale_set_eviction_policy: Optional[Union[str, "_models.ScaleSetEvictionPolicy"]] = "Delete", + spot_max_price: Optional[float] = -1, + tags: Optional[Dict[str, str]] = None, + node_labels: Optional[Dict[str, str]] = None, + node_taints: Optional[List[str]] = None, + proximity_placement_group_id: Optional[str] = None, + kubelet_config: Optional["_models.KubeletConfig"] = None, + linux_os_config: Optional["_models.LinuxOSConfig"] = None, + enable_encryption_at_host: Optional[bool] = None, + enable_ultra_ssd: Optional[bool] = None, + enable_fips: Optional[bool] = None, + gpu_instance_profile: Optional[Union[str, "_models.GPUInstanceProfile"]] = None, + creation_data: Optional["_models.CreationData"] = None, + capacity_reservation_group_id: Optional[str] = None, + host_group_id: Optional[str] = None, + **kwargs + ): + """ + :keyword count: Number of agents (VMs) to host docker containers. Allowed values must be in the + range of 0 to 1000 (inclusive) for user pools and in the range of 1 to 1000 (inclusive) for + system pools. The default value is 1. + :paramtype count: int + :keyword vm_size: VM size availability varies by region. If a node contains insufficient + compute resources (memory, cpu, etc) pods might fail to run correctly. For more details on + restricted VM sizes, see: https://docs.microsoft.com/azure/aks/quotas-skus-regions. + :paramtype vm_size: str + :keyword os_disk_size_gb: OS Disk Size in GB to be used to specify the disk size for every + machine in the master/agent pool. If you specify 0, it will apply the default osDisk size + according to the vmSize specified. + :paramtype os_disk_size_gb: int + :keyword os_disk_type: The default is 'Ephemeral' if the VM supports it and has a cache disk + larger than the requested OSDiskSizeGB. Otherwise, defaults to 'Managed'. May not be changed + after creation. For more information see `Ephemeral OS + `_. Known values are: + "Managed", "Ephemeral". + :paramtype os_disk_type: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.OSDiskType + :keyword kubelet_disk_type: Determines the placement of emptyDir volumes, container runtime + data root, and Kubelet ephemeral storage. Known values are: "OS", "Temporary". + :paramtype kubelet_disk_type: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.KubeletDiskType + :keyword workload_runtime: Determines the type of workload a node can run. Known values are: + "OCIContainer", "WasmWasi". + :paramtype workload_runtime: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.WorkloadRuntime + :keyword message_of_the_day: A base64-encoded string which will be written to /etc/motd after + decoding. This allows customization of the message of the day for Linux nodes. It must not be + specified for Windows nodes. It must be a static string (i.e., will be printed raw and not be + executed as a script). + :paramtype message_of_the_day: str + :keyword vnet_subnet_id: If this is not specified, a VNET and subnet will be generated and + used. If no podSubnetID is specified, this applies to nodes and pods, otherwise it applies to + just nodes. This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. + :paramtype vnet_subnet_id: str + :keyword pod_subnet_id: If omitted, pod IPs are statically assigned on the node subnet (see + vnetSubnetID for more details). This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. + :paramtype pod_subnet_id: str + :keyword max_pods: The maximum number of pods that can run on a node. + :paramtype max_pods: int + :keyword os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". + :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.OSType + :keyword os_sku: Specifies the OS SKU used by the agent pool. If not specified, the default is + Ubuntu if OSType=Linux or Windows2019 if OSType=Windows. And the default Windows OSSKU will be + changed to Windows2022 after Windows2019 is deprecated. Known values are: "Ubuntu", + "CBLMariner", "Windows2019", "Windows2022". + :paramtype os_sku: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.OSSKU + :keyword max_count: The maximum number of nodes for auto-scaling. + :paramtype max_count: int + :keyword min_count: The minimum number of nodes for auto-scaling. + :paramtype min_count: int + :keyword enable_auto_scaling: Whether to enable auto-scaler. + :paramtype enable_auto_scaling: bool + :keyword scale_down_mode: This also effects the cluster autoscaler behavior. If not specified, + it defaults to Delete. Known values are: "Delete", "Deallocate". + :paramtype scale_down_mode: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ScaleDownMode + :keyword type: The type of Agent Pool. Known values are: "VirtualMachineScaleSets", + "AvailabilitySet". + :paramtype type: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.AgentPoolType + :keyword mode: A cluster must have at least one 'System' Agent Pool at all times. For + additional information on agent pool restrictions and best practices, see: + https://docs.microsoft.com/azure/aks/use-system-pools. Known values are: "System", "User". + :paramtype mode: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.AgentPoolMode + :keyword orchestrator_version: Both patch version and are + supported. When is specified, the latest supported patch version is chosen + automatically. Updating the agent pool with the same once it has been created + will not trigger an upgrade, even if a newer patch version is available. As a best practice, + you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node + pool version must have the same major version as the control plane. The node pool minor version + must be within two minor versions of the control plane version. The node pool version cannot be + greater than the control plane version. For more information see `upgrading a node pool + `_. + :paramtype orchestrator_version: str + :keyword upgrade_settings: Settings for upgrading the agentpool. + :paramtype upgrade_settings: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.AgentPoolUpgradeSettings + :keyword power_state: When an Agent Pool is first created it is initially Running. The Agent + Pool can be stopped by setting this field to Stopped. A stopped Agent Pool stops all of its VMs + and does not accrue billing charges. An Agent Pool can only be stopped if it is Running and + provisioning state is Succeeded. + :paramtype power_state: ~azure.mgmt.containerservice.v2022_06_02_preview.models.PowerState + :keyword availability_zones: The list of Availability zones to use for nodes. This can only be + specified if the AgentPoolType property is 'VirtualMachineScaleSets'. + :paramtype availability_zones: list[str] + :keyword enable_node_public_ip: Some scenarios may require nodes in a node pool to receive + their own dedicated public IP addresses. A common scenario is for gaming workloads, where a + console needs to make a direct connection to a cloud virtual machine to minimize hops. For more + information see `assigning a public IP per node + `_. + The default is false. + :paramtype enable_node_public_ip: bool + :keyword enable_custom_ca_trust: When set to true, AKS deploys a daemonset and host services to + sync custom certificate authorities from a user-provided config map into node trust stores. + Defaults to false. + :paramtype enable_custom_ca_trust: bool + :keyword node_public_ip_prefix_id: This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. + :paramtype node_public_ip_prefix_id: str + :keyword scale_set_priority: The Virtual Machine Scale Set priority. If not specified, the + default is 'Regular'. Known values are: "Spot", "Regular". Default value: "Regular". + :paramtype scale_set_priority: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ScaleSetPriority + :keyword scale_set_eviction_policy: This cannot be specified unless the scaleSetPriority is + 'Spot'. If not specified, the default is 'Delete'. Known values are: "Delete", "Deallocate". + Default value: "Delete". + :paramtype scale_set_eviction_policy: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ScaleSetEvictionPolicy + :keyword spot_max_price: Possible values are any decimal value greater than zero or -1 which + indicates the willingness to pay any on-demand price. For more details on spot pricing, see + `spot VMs pricing `_. + :paramtype spot_max_price: float + :keyword tags: A set of tags. The tags to be persisted on the agent pool virtual machine scale + set. + :paramtype tags: dict[str, str] + :keyword node_labels: The node labels to be persisted across all nodes in agent pool. + :paramtype node_labels: dict[str, str] + :keyword node_taints: The taints added to new nodes during node pool create and scale. For + example, key=value:NoSchedule. + :paramtype node_taints: list[str] + :keyword proximity_placement_group_id: The ID for Proximity Placement Group. + :paramtype proximity_placement_group_id: str + :keyword kubelet_config: The Kubelet configuration on the agent pool nodes. + :paramtype kubelet_config: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.KubeletConfig + :keyword linux_os_config: The OS configuration of Linux agent nodes. + :paramtype linux_os_config: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.LinuxOSConfig + :keyword enable_encryption_at_host: This is only supported on certain VM sizes and in certain + Azure regions. For more information, see: + https://docs.microsoft.com/azure/aks/enable-host-encryption. + :paramtype enable_encryption_at_host: bool + :keyword enable_ultra_ssd: Whether to enable UltraSSD. + :paramtype enable_ultra_ssd: bool + :keyword enable_fips: See `Add a FIPS-enabled node pool + `_ + for more details. + :paramtype enable_fips: bool + :keyword gpu_instance_profile: GPUInstanceProfile to be used to specify GPU MIG instance + profile for supported GPU VM SKU. Known values are: "MIG1g", "MIG2g", "MIG3g", "MIG4g", + "MIG7g". + :paramtype gpu_instance_profile: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.GPUInstanceProfile + :keyword creation_data: CreationData to be used to specify the source Snapshot ID if the node + pool will be created/upgraded using a snapshot. + :paramtype creation_data: ~azure.mgmt.containerservice.v2022_06_02_preview.models.CreationData + :keyword capacity_reservation_group_id: AKS will associate the specified agent pool with the + Capacity Reservation Group. + :paramtype capacity_reservation_group_id: str + :keyword host_group_id: This is of the form: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}. + For more information see `Azure dedicated hosts + `_. + :paramtype host_group_id: str + :keyword name: Required. Windows agent pool names must be 6 characters or less. + :paramtype name: str + """ + super(ManagedClusterAgentPoolProfile, self).__init__(count=count, vm_size=vm_size, os_disk_size_gb=os_disk_size_gb, os_disk_type=os_disk_type, kubelet_disk_type=kubelet_disk_type, workload_runtime=workload_runtime, message_of_the_day=message_of_the_day, vnet_subnet_id=vnet_subnet_id, pod_subnet_id=pod_subnet_id, max_pods=max_pods, os_type=os_type, os_sku=os_sku, max_count=max_count, min_count=min_count, enable_auto_scaling=enable_auto_scaling, scale_down_mode=scale_down_mode, type=type, mode=mode, orchestrator_version=orchestrator_version, upgrade_settings=upgrade_settings, power_state=power_state, availability_zones=availability_zones, enable_node_public_ip=enable_node_public_ip, enable_custom_ca_trust=enable_custom_ca_trust, node_public_ip_prefix_id=node_public_ip_prefix_id, scale_set_priority=scale_set_priority, scale_set_eviction_policy=scale_set_eviction_policy, spot_max_price=spot_max_price, tags=tags, node_labels=node_labels, node_taints=node_taints, proximity_placement_group_id=proximity_placement_group_id, kubelet_config=kubelet_config, linux_os_config=linux_os_config, enable_encryption_at_host=enable_encryption_at_host, enable_ultra_ssd=enable_ultra_ssd, enable_fips=enable_fips, gpu_instance_profile=gpu_instance_profile, creation_data=creation_data, capacity_reservation_group_id=capacity_reservation_group_id, host_group_id=host_group_id, **kwargs) + self.name = name + + +class ManagedClusterAPIServerAccessProfile(msrest.serialization.Model): + """Access profile for managed cluster API server. + + :ivar authorized_ip_ranges: IP ranges are specified in CIDR format, e.g. 137.117.106.88/29. + This feature is not compatible with clusters that use Public IP Per Node, or clusters that are + using a Basic Load Balancer. For more information see `API server authorized IP ranges + `_. + :vartype authorized_ip_ranges: list[str] + :ivar enable_private_cluster: For more details, see `Creating a private AKS cluster + `_. + :vartype enable_private_cluster: bool + :ivar private_dns_zone: The default is System. For more details see `configure private DNS zone + `_. Allowed + values are 'system' and 'none'. + :vartype private_dns_zone: str + :ivar enable_private_cluster_public_fqdn: Whether to create additional public FQDN for private + cluster or not. + :vartype enable_private_cluster_public_fqdn: bool + :ivar disable_run_command: Whether to disable run command for the cluster or not. + :vartype disable_run_command: bool + :ivar enable_vnet_integration: Whether to enable apiserver vnet integration for the cluster or + not. + :vartype enable_vnet_integration: bool + :ivar subnet_id: It is required when: 1. creating a new cluster with BYO Vnet; 2. updating an + existing cluster to enable apiserver vnet integration. + :vartype subnet_id: str + """ + + _attribute_map = { + 'authorized_ip_ranges': {'key': 'authorizedIPRanges', 'type': '[str]'}, + 'enable_private_cluster': {'key': 'enablePrivateCluster', 'type': 'bool'}, + 'private_dns_zone': {'key': 'privateDNSZone', 'type': 'str'}, + 'enable_private_cluster_public_fqdn': {'key': 'enablePrivateClusterPublicFQDN', 'type': 'bool'}, + 'disable_run_command': {'key': 'disableRunCommand', 'type': 'bool'}, + 'enable_vnet_integration': {'key': 'enableVnetIntegration', 'type': 'bool'}, + 'subnet_id': {'key': 'subnetId', 'type': 'str'}, + } + + def __init__( + self, + *, + authorized_ip_ranges: Optional[List[str]] = None, + enable_private_cluster: Optional[bool] = None, + private_dns_zone: Optional[str] = None, + enable_private_cluster_public_fqdn: Optional[bool] = None, + disable_run_command: Optional[bool] = None, + enable_vnet_integration: Optional[bool] = None, + subnet_id: Optional[str] = None, + **kwargs + ): + """ + :keyword authorized_ip_ranges: IP ranges are specified in CIDR format, e.g. 137.117.106.88/29. + This feature is not compatible with clusters that use Public IP Per Node, or clusters that are + using a Basic Load Balancer. For more information see `API server authorized IP ranges + `_. + :paramtype authorized_ip_ranges: list[str] + :keyword enable_private_cluster: For more details, see `Creating a private AKS cluster + `_. + :paramtype enable_private_cluster: bool + :keyword private_dns_zone: The default is System. For more details see `configure private DNS + zone `_. + Allowed values are 'system' and 'none'. + :paramtype private_dns_zone: str + :keyword enable_private_cluster_public_fqdn: Whether to create additional public FQDN for + private cluster or not. + :paramtype enable_private_cluster_public_fqdn: bool + :keyword disable_run_command: Whether to disable run command for the cluster or not. + :paramtype disable_run_command: bool + :keyword enable_vnet_integration: Whether to enable apiserver vnet integration for the cluster + or not. + :paramtype enable_vnet_integration: bool + :keyword subnet_id: It is required when: 1. creating a new cluster with BYO Vnet; 2. updating + an existing cluster to enable apiserver vnet integration. + :paramtype subnet_id: str + """ + super(ManagedClusterAPIServerAccessProfile, self).__init__(**kwargs) + self.authorized_ip_ranges = authorized_ip_ranges + self.enable_private_cluster = enable_private_cluster + self.private_dns_zone = private_dns_zone + self.enable_private_cluster_public_fqdn = enable_private_cluster_public_fqdn + self.disable_run_command = disable_run_command + self.enable_vnet_integration = enable_vnet_integration + self.subnet_id = subnet_id + + +class ManagedClusterAutoUpgradeProfile(msrest.serialization.Model): + """Auto upgrade profile for a managed cluster. + + :ivar upgrade_channel: For more information see `setting the AKS cluster auto-upgrade channel + `_. Known values + are: "rapid", "stable", "patch", "node-image", "none". + :vartype upgrade_channel: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.UpgradeChannel + """ + + _attribute_map = { + 'upgrade_channel': {'key': 'upgradeChannel', 'type': 'str'}, + } + + def __init__( + self, + *, + upgrade_channel: Optional[Union[str, "_models.UpgradeChannel"]] = None, + **kwargs + ): + """ + :keyword upgrade_channel: For more information see `setting the AKS cluster auto-upgrade + channel `_. + Known values are: "rapid", "stable", "patch", "node-image", "none". + :paramtype upgrade_channel: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.UpgradeChannel + """ + super(ManagedClusterAutoUpgradeProfile, self).__init__(**kwargs) + self.upgrade_channel = upgrade_channel + + +class ManagedClusterHTTPProxyConfig(msrest.serialization.Model): + """Cluster HTTP proxy configuration. + + Variables are only populated by the server, and will be ignored when sending a request. + + :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 effective_no_proxy: A read-only list of all endpoints for which traffic should not be + sent to the proxy. This list is a superset of noProxy and values injected by AKS. + :vartype effective_no_proxy: list[str] + :ivar trusted_ca: Alternative CA cert to use for connecting to proxy servers. + :vartype trusted_ca: str + """ + + _validation = { + 'effective_no_proxy': {'readonly': True}, + } + + _attribute_map = { + 'http_proxy': {'key': 'httpProxy', 'type': 'str'}, + 'https_proxy': {'key': 'httpsProxy', 'type': 'str'}, + 'no_proxy': {'key': 'noProxy', 'type': '[str]'}, + 'effective_no_proxy': {'key': 'effectiveNoProxy', 'type': '[str]'}, + 'trusted_ca': {'key': 'trustedCa', '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, + **kwargs + ): + """ + :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 + """ + super(ManagedClusterHTTPProxyConfig, self).__init__(**kwargs) + self.http_proxy = http_proxy + self.https_proxy = https_proxy + self.no_proxy = no_proxy + self.effective_no_proxy = None + self.trusted_ca = trusted_ca + + +class ManagedClusterIdentity(msrest.serialization.Model): + """Identity for the managed cluster. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal id of the system assigned identity which is used by master + components. + :vartype principal_id: str + :ivar tenant_id: The tenant id of the system assigned identity which is used by master + components. + :vartype tenant_id: str + :ivar type: For more information see `use managed identities in AKS + `_. Known values are: + "SystemAssigned", "UserAssigned", "None". + :vartype type: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ResourceIdentityType + :ivar user_assigned_identities: The keys must be ARM resource IDs in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + :vartype user_assigned_identities: dict[str, + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedServiceIdentityUserAssignedIdentitiesValue] + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'tenant_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{ManagedServiceIdentityUserAssignedIdentitiesValue}'}, + } + + def __init__( + self, + *, + type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, + user_assigned_identities: Optional[Dict[str, "_models.ManagedServiceIdentityUserAssignedIdentitiesValue"]] = None, + **kwargs + ): + """ + :keyword type: For more information see `use managed identities in AKS + `_. Known values are: + "SystemAssigned", "UserAssigned", "None". + :paramtype type: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ResourceIdentityType + :keyword user_assigned_identities: The keys must be ARM resource IDs in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + :paramtype user_assigned_identities: dict[str, + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedServiceIdentityUserAssignedIdentitiesValue] + """ + super(ManagedClusterIdentity, self).__init__(**kwargs) + self.principal_id = None + self.tenant_id = None + self.type = type + self.user_assigned_identities = user_assigned_identities + + +class ManagedClusterIngressProfile(msrest.serialization.Model): + """Ingress profile for the container service cluster. + + :ivar web_app_routing: Web App Routing settings for the ingress profile. + :vartype web_app_routing: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterIngressProfileWebAppRouting + """ + + _attribute_map = { + 'web_app_routing': {'key': 'webAppRouting', 'type': 'ManagedClusterIngressProfileWebAppRouting'}, + } + + def __init__( + self, + *, + web_app_routing: Optional["_models.ManagedClusterIngressProfileWebAppRouting"] = None, + **kwargs + ): + """ + :keyword web_app_routing: Web App Routing settings for the ingress profile. + :paramtype web_app_routing: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterIngressProfileWebAppRouting + """ + super(ManagedClusterIngressProfile, self).__init__(**kwargs) + self.web_app_routing = web_app_routing + + +class ManagedClusterIngressProfileWebAppRouting(msrest.serialization.Model): + """Web App Routing settings for the ingress profile. + + :ivar enabled: Whether to enable Web App Routing. + :vartype enabled: bool + :ivar dns_zone_resource_id: Resource ID of the DNS Zone to be associated with the web app. Used + only when Web App Routing is enabled. + :vartype dns_zone_resource_id: str + """ + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'dns_zone_resource_id': {'key': 'dnsZoneResourceId', 'type': 'str'}, + } + + def __init__( + self, + *, + enabled: Optional[bool] = None, + dns_zone_resource_id: Optional[str] = None, + **kwargs + ): + """ + :keyword enabled: Whether to enable Web App Routing. + :paramtype enabled: bool + :keyword dns_zone_resource_id: Resource ID of the DNS Zone to be associated with the web app. + Used only when Web App Routing is enabled. + :paramtype dns_zone_resource_id: str + """ + super(ManagedClusterIngressProfileWebAppRouting, self).__init__(**kwargs) + self.enabled = enabled + self.dns_zone_resource_id = dns_zone_resource_id + + +class ManagedClusterListResult(msrest.serialization.Model): + """The response from the List Managed Clusters operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The list of managed clusters. + :vartype value: list[~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedCluster] + :ivar next_link: The URL to get the next set of managed cluster results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ManagedCluster]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["_models.ManagedCluster"]] = None, + **kwargs + ): + """ + :keyword value: The list of managed clusters. + :paramtype value: list[~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedCluster] + """ + super(ManagedClusterListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class ManagedClusterLoadBalancerProfile(msrest.serialization.Model): + """Profile of the managed cluster load balancer. + + :ivar managed_outbound_i_ps: Desired managed outbound IPs for the cluster load balancer. + :vartype managed_outbound_i_ps: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterLoadBalancerProfileManagedOutboundIPs + :ivar outbound_ip_prefixes: Desired outbound IP Prefix resources for the cluster load balancer. + :vartype outbound_ip_prefixes: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterLoadBalancerProfileOutboundIPPrefixes + :ivar outbound_i_ps: Desired outbound IP resources for the cluster load balancer. + :vartype outbound_i_ps: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterLoadBalancerProfileOutboundIPs + :ivar effective_outbound_i_ps: The effective outbound IP resources of the cluster load + balancer. + :vartype effective_outbound_i_ps: + list[~azure.mgmt.containerservice.v2022_06_02_preview.models.ResourceReference] + :ivar allocated_outbound_ports: The desired number of allocated SNAT ports per VM. Allowed + values are in the range of 0 to 64000 (inclusive). The default value is 0 which results in + Azure dynamically allocating ports. + :vartype allocated_outbound_ports: int + :ivar idle_timeout_in_minutes: Desired outbound flow idle timeout in minutes. Allowed values + are in the range of 4 to 120 (inclusive). The default value is 30 minutes. + :vartype idle_timeout_in_minutes: int + :ivar enable_multiple_standard_load_balancers: Enable multiple standard load balancers per AKS + cluster or not. + :vartype enable_multiple_standard_load_balancers: bool + """ + + _validation = { + 'allocated_outbound_ports': {'maximum': 64000, 'minimum': 0}, + 'idle_timeout_in_minutes': {'maximum': 120, 'minimum': 4}, + } + + _attribute_map = { + 'managed_outbound_i_ps': {'key': 'managedOutboundIPs', 'type': 'ManagedClusterLoadBalancerProfileManagedOutboundIPs'}, + 'outbound_ip_prefixes': {'key': 'outboundIPPrefixes', 'type': 'ManagedClusterLoadBalancerProfileOutboundIPPrefixes'}, + 'outbound_i_ps': {'key': 'outboundIPs', 'type': 'ManagedClusterLoadBalancerProfileOutboundIPs'}, + 'effective_outbound_i_ps': {'key': 'effectiveOutboundIPs', 'type': '[ResourceReference]'}, + 'allocated_outbound_ports': {'key': 'allocatedOutboundPorts', 'type': 'int'}, + 'idle_timeout_in_minutes': {'key': 'idleTimeoutInMinutes', 'type': 'int'}, + 'enable_multiple_standard_load_balancers': {'key': 'enableMultipleStandardLoadBalancers', 'type': 'bool'}, + } + + def __init__( + self, + *, + managed_outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileManagedOutboundIPs"] = None, + outbound_ip_prefixes: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPPrefixes"] = None, + outbound_i_ps: Optional["_models.ManagedClusterLoadBalancerProfileOutboundIPs"] = None, + effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, + allocated_outbound_ports: Optional[int] = 0, + idle_timeout_in_minutes: Optional[int] = 30, + enable_multiple_standard_load_balancers: Optional[bool] = None, + **kwargs + ): + """ + :keyword managed_outbound_i_ps: Desired managed outbound IPs for the cluster load balancer. + :paramtype managed_outbound_i_ps: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterLoadBalancerProfileManagedOutboundIPs + :keyword outbound_ip_prefixes: Desired outbound IP Prefix resources for the cluster load + balancer. + :paramtype outbound_ip_prefixes: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterLoadBalancerProfileOutboundIPPrefixes + :keyword outbound_i_ps: Desired outbound IP resources for the cluster load balancer. + :paramtype outbound_i_ps: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterLoadBalancerProfileOutboundIPs + :keyword effective_outbound_i_ps: The effective outbound IP resources of the cluster load + balancer. + :paramtype effective_outbound_i_ps: + list[~azure.mgmt.containerservice.v2022_06_02_preview.models.ResourceReference] + :keyword allocated_outbound_ports: The desired number of allocated SNAT ports per VM. Allowed + values are in the range of 0 to 64000 (inclusive). The default value is 0 which results in + Azure dynamically allocating ports. + :paramtype allocated_outbound_ports: int + :keyword idle_timeout_in_minutes: Desired outbound flow idle timeout in minutes. Allowed values + are in the range of 4 to 120 (inclusive). The default value is 30 minutes. + :paramtype idle_timeout_in_minutes: int + :keyword enable_multiple_standard_load_balancers: Enable multiple standard load balancers per + AKS cluster or not. + :paramtype enable_multiple_standard_load_balancers: bool + """ + super(ManagedClusterLoadBalancerProfile, self).__init__(**kwargs) + self.managed_outbound_i_ps = managed_outbound_i_ps + self.outbound_ip_prefixes = outbound_ip_prefixes + self.outbound_i_ps = outbound_i_ps + self.effective_outbound_i_ps = effective_outbound_i_ps + self.allocated_outbound_ports = allocated_outbound_ports + self.idle_timeout_in_minutes = idle_timeout_in_minutes + self.enable_multiple_standard_load_balancers = enable_multiple_standard_load_balancers + + +class ManagedClusterLoadBalancerProfileManagedOutboundIPs(msrest.serialization.Model): + """Desired managed outbound IPs for the cluster load balancer. + + :ivar count: The desired number of IPv4 outbound IPs created/managed by Azure for the cluster + load balancer. Allowed values must be in the range of 1 to 100 (inclusive). The default value + is 1. + :vartype count: int + :ivar count_ipv6: The desired number of IPv6 outbound IPs created/managed by Azure for the + cluster load balancer. Allowed values must be in the range of 1 to 100 (inclusive). The default + value is 0 for single-stack and 1 for dual-stack. + :vartype count_ipv6: int + """ + + _validation = { + 'count': {'maximum': 100, 'minimum': 1}, + 'count_ipv6': {'maximum': 100, 'minimum': 0}, + } + + _attribute_map = { + 'count': {'key': 'count', 'type': 'int'}, + 'count_ipv6': {'key': 'countIPv6', 'type': 'int'}, + } + + def __init__( + self, + *, + count: Optional[int] = 1, + count_ipv6: Optional[int] = 0, + **kwargs + ): + """ + :keyword count: The desired number of IPv4 outbound IPs created/managed by Azure for the + cluster load balancer. Allowed values must be in the range of 1 to 100 (inclusive). The default + value is 1. + :paramtype count: int + :keyword count_ipv6: The desired number of IPv6 outbound IPs created/managed by Azure for the + cluster load balancer. Allowed values must be in the range of 1 to 100 (inclusive). The default + value is 0 for single-stack and 1 for dual-stack. + :paramtype count_ipv6: int + """ + super(ManagedClusterLoadBalancerProfileManagedOutboundIPs, self).__init__(**kwargs) + self.count = count + self.count_ipv6 = count_ipv6 + + +class ManagedClusterLoadBalancerProfileOutboundIPPrefixes(msrest.serialization.Model): + """Desired outbound IP Prefix resources for the cluster load balancer. + + :ivar public_ip_prefixes: A list of public IP prefix resources. + :vartype public_ip_prefixes: + list[~azure.mgmt.containerservice.v2022_06_02_preview.models.ResourceReference] + """ + + _attribute_map = { + 'public_ip_prefixes': {'key': 'publicIPPrefixes', 'type': '[ResourceReference]'}, + } + + def __init__( + self, + *, + public_ip_prefixes: Optional[List["_models.ResourceReference"]] = None, + **kwargs + ): + """ + :keyword public_ip_prefixes: A list of public IP prefix resources. + :paramtype public_ip_prefixes: + list[~azure.mgmt.containerservice.v2022_06_02_preview.models.ResourceReference] + """ + super(ManagedClusterLoadBalancerProfileOutboundIPPrefixes, self).__init__(**kwargs) + self.public_ip_prefixes = public_ip_prefixes + + +class ManagedClusterLoadBalancerProfileOutboundIPs(msrest.serialization.Model): + """Desired outbound IP resources for the cluster load balancer. + + :ivar public_i_ps: A list of public IP resources. + :vartype public_i_ps: + list[~azure.mgmt.containerservice.v2022_06_02_preview.models.ResourceReference] + """ + + _attribute_map = { + 'public_i_ps': {'key': 'publicIPs', 'type': '[ResourceReference]'}, + } + + def __init__( + self, + *, + public_i_ps: Optional[List["_models.ResourceReference"]] = None, + **kwargs + ): + """ + :keyword public_i_ps: A list of public IP resources. + :paramtype public_i_ps: + list[~azure.mgmt.containerservice.v2022_06_02_preview.models.ResourceReference] + """ + super(ManagedClusterLoadBalancerProfileOutboundIPs, self).__init__(**kwargs) + self.public_i_ps = public_i_ps + + +class ManagedClusterManagedOutboundIPProfile(msrest.serialization.Model): + """Profile of the managed outbound IP resources of the managed cluster. + + :ivar count: The desired number of outbound IPs created/managed by Azure. Allowed values must + be in the range of 1 to 16 (inclusive). The default value is 1. + :vartype count: int + """ + + _validation = { + 'count': {'maximum': 16, 'minimum': 1}, + } + + _attribute_map = { + 'count': {'key': 'count', 'type': 'int'}, + } + + def __init__( + self, + *, + count: Optional[int] = 1, + **kwargs + ): + """ + :keyword count: The desired number of outbound IPs created/managed by Azure. Allowed values + must be in the range of 1 to 16 (inclusive). The default value is 1. + :paramtype count: int + """ + super(ManagedClusterManagedOutboundIPProfile, self).__init__(**kwargs) + self.count = count + + +class ManagedClusterNATGatewayProfile(msrest.serialization.Model): + """Profile of the managed cluster NAT gateway. + + :ivar managed_outbound_ip_profile: Profile of the managed outbound IP resources of the cluster + NAT gateway. + :vartype managed_outbound_ip_profile: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterManagedOutboundIPProfile + :ivar effective_outbound_i_ps: The effective outbound IP resources of the cluster NAT gateway. + :vartype effective_outbound_i_ps: + list[~azure.mgmt.containerservice.v2022_06_02_preview.models.ResourceReference] + :ivar idle_timeout_in_minutes: Desired outbound flow idle timeout in minutes. Allowed values + are in the range of 4 to 120 (inclusive). The default value is 4 minutes. + :vartype idle_timeout_in_minutes: int + """ + + _validation = { + 'idle_timeout_in_minutes': {'maximum': 120, 'minimum': 4}, + } + + _attribute_map = { + 'managed_outbound_ip_profile': {'key': 'managedOutboundIPProfile', 'type': 'ManagedClusterManagedOutboundIPProfile'}, + 'effective_outbound_i_ps': {'key': 'effectiveOutboundIPs', 'type': '[ResourceReference]'}, + 'idle_timeout_in_minutes': {'key': 'idleTimeoutInMinutes', 'type': 'int'}, + } + + def __init__( + self, + *, + managed_outbound_ip_profile: Optional["_models.ManagedClusterManagedOutboundIPProfile"] = None, + effective_outbound_i_ps: Optional[List["_models.ResourceReference"]] = None, + idle_timeout_in_minutes: Optional[int] = 4, + **kwargs + ): + """ + :keyword managed_outbound_ip_profile: Profile of the managed outbound IP resources of the + cluster NAT gateway. + :paramtype managed_outbound_ip_profile: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterManagedOutboundIPProfile + :keyword effective_outbound_i_ps: The effective outbound IP resources of the cluster NAT + gateway. + :paramtype effective_outbound_i_ps: + list[~azure.mgmt.containerservice.v2022_06_02_preview.models.ResourceReference] + :keyword idle_timeout_in_minutes: Desired outbound flow idle timeout in minutes. Allowed values + are in the range of 4 to 120 (inclusive). The default value is 4 minutes. + :paramtype idle_timeout_in_minutes: int + """ + super(ManagedClusterNATGatewayProfile, self).__init__(**kwargs) + self.managed_outbound_ip_profile = managed_outbound_ip_profile + self.effective_outbound_i_ps = effective_outbound_i_ps + self.idle_timeout_in_minutes = idle_timeout_in_minutes + + +class ManagedClusterOIDCIssuerProfile(msrest.serialization.Model): + """The OIDC issuer profile of the Managed Cluster. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar issuer_url: The OIDC issuer url of the Managed Cluster. + :vartype issuer_url: str + :ivar enabled: Whether the OIDC issuer is enabled. + :vartype enabled: bool + """ + + _validation = { + 'issuer_url': {'readonly': True}, + } + + _attribute_map = { + 'issuer_url': {'key': 'issuerURL', 'type': 'str'}, + 'enabled': {'key': 'enabled', 'type': 'bool'}, + } + + def __init__( + self, + *, + enabled: Optional[bool] = None, + **kwargs + ): + """ + :keyword enabled: Whether the OIDC issuer is enabled. + :paramtype enabled: bool + """ + super(ManagedClusterOIDCIssuerProfile, self).__init__(**kwargs) + self.issuer_url = None + self.enabled = enabled + + +class ManagedClusterPodIdentity(msrest.serialization.Model): + """Details about the pod identity assigned to the Managed Cluster. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar name: Required. The name of the pod identity. + :vartype name: str + :ivar namespace: Required. The namespace of the pod identity. + :vartype namespace: str + :ivar binding_selector: The binding selector to use for the AzureIdentityBinding resource. + :vartype binding_selector: str + :ivar identity: Required. The user assigned identity details. + :vartype identity: ~azure.mgmt.containerservice.v2022_06_02_preview.models.UserAssignedIdentity + :ivar provisioning_state: The current provisioning state of the pod identity. Known values are: + "Assigned", "Updating", "Deleting", "Failed". + :vartype provisioning_state: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterPodIdentityProvisioningState + :ivar provisioning_info: + :vartype provisioning_info: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterPodIdentityProvisioningInfo + """ + + _validation = { + 'name': {'required': True}, + 'namespace': {'required': True}, + 'identity': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'provisioning_info': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'namespace': {'key': 'namespace', 'type': 'str'}, + 'binding_selector': {'key': 'bindingSelector', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'UserAssignedIdentity'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'provisioning_info': {'key': 'provisioningInfo', 'type': 'ManagedClusterPodIdentityProvisioningInfo'}, + } + + def __init__( + self, + *, + name: str, + namespace: str, + identity: "_models.UserAssignedIdentity", + binding_selector: Optional[str] = None, + **kwargs + ): + """ + :keyword name: Required. The name of the pod identity. + :paramtype name: str + :keyword namespace: Required. The namespace of the pod identity. + :paramtype namespace: str + :keyword binding_selector: The binding selector to use for the AzureIdentityBinding resource. + :paramtype binding_selector: str + :keyword identity: Required. The user assigned identity details. + :paramtype identity: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.UserAssignedIdentity + """ + super(ManagedClusterPodIdentity, self).__init__(**kwargs) + self.name = name + self.namespace = namespace + self.binding_selector = binding_selector + self.identity = identity + self.provisioning_state = None + self.provisioning_info = None + + +class ManagedClusterPodIdentityException(msrest.serialization.Model): + """See `disable AAD Pod Identity for a specific Pod/Application `_ for more details. + + All required parameters must be populated in order to send to Azure. + + :ivar name: Required. The name of the pod identity exception. + :vartype name: str + :ivar namespace: Required. The namespace of the pod identity exception. + :vartype namespace: str + :ivar pod_labels: Required. The pod labels to match. + :vartype pod_labels: dict[str, str] + """ + + _validation = { + 'name': {'required': True}, + 'namespace': {'required': True}, + 'pod_labels': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'namespace': {'key': 'namespace', 'type': 'str'}, + 'pod_labels': {'key': 'podLabels', 'type': '{str}'}, + } + + def __init__( + self, + *, + name: str, + namespace: str, + pod_labels: Dict[str, str], + **kwargs + ): + """ + :keyword name: Required. The name of the pod identity exception. + :paramtype name: str + :keyword namespace: Required. The namespace of the pod identity exception. + :paramtype namespace: str + :keyword pod_labels: Required. The pod labels to match. + :paramtype pod_labels: dict[str, str] + """ + super(ManagedClusterPodIdentityException, self).__init__(**kwargs) + self.name = name + self.namespace = namespace + self.pod_labels = pod_labels + + +class ManagedClusterPodIdentityProfile(msrest.serialization.Model): + """See `use AAD pod identity `_ for more details on pod identity integration. + + :ivar enabled: Whether the pod identity addon is enabled. + :vartype enabled: bool + :ivar allow_network_plugin_kubenet: Running in Kubenet is disabled by default due to the + security related nature of AAD Pod Identity and the risks of IP spoofing. See `using Kubenet + network plugin with AAD Pod Identity + `_ + for more information. + :vartype allow_network_plugin_kubenet: bool + :ivar user_assigned_identities: The pod identities to use in the cluster. + :vartype user_assigned_identities: + list[~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterPodIdentity] + :ivar user_assigned_identity_exceptions: The pod identity exceptions to allow. + :vartype user_assigned_identity_exceptions: + list[~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterPodIdentityException] + """ + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'allow_network_plugin_kubenet': {'key': 'allowNetworkPluginKubenet', 'type': 'bool'}, + 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '[ManagedClusterPodIdentity]'}, + 'user_assigned_identity_exceptions': {'key': 'userAssignedIdentityExceptions', 'type': '[ManagedClusterPodIdentityException]'}, + } + + def __init__( + self, + *, + enabled: Optional[bool] = None, + allow_network_plugin_kubenet: Optional[bool] = None, + user_assigned_identities: Optional[List["_models.ManagedClusterPodIdentity"]] = None, + user_assigned_identity_exceptions: Optional[List["_models.ManagedClusterPodIdentityException"]] = None, + **kwargs + ): + """ + :keyword enabled: Whether the pod identity addon is enabled. + :paramtype enabled: bool + :keyword allow_network_plugin_kubenet: Running in Kubenet is disabled by default due to the + security related nature of AAD Pod Identity and the risks of IP spoofing. See `using Kubenet + network plugin with AAD Pod Identity + `_ + for more information. + :paramtype allow_network_plugin_kubenet: bool + :keyword user_assigned_identities: The pod identities to use in the cluster. + :paramtype user_assigned_identities: + list[~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterPodIdentity] + :keyword user_assigned_identity_exceptions: The pod identity exceptions to allow. + :paramtype user_assigned_identity_exceptions: + list[~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterPodIdentityException] + """ + super(ManagedClusterPodIdentityProfile, self).__init__(**kwargs) + self.enabled = enabled + self.allow_network_plugin_kubenet = allow_network_plugin_kubenet + self.user_assigned_identities = user_assigned_identities + self.user_assigned_identity_exceptions = user_assigned_identity_exceptions + + +class ManagedClusterPodIdentityProvisioningError(msrest.serialization.Model): + """An error response from the pod identity provisioning. + + :ivar error: Details about the error. + :vartype error: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterPodIdentityProvisioningErrorBody + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ManagedClusterPodIdentityProvisioningErrorBody'}, + } + + def __init__( + self, + *, + error: Optional["_models.ManagedClusterPodIdentityProvisioningErrorBody"] = None, + **kwargs + ): + """ + :keyword error: Details about the error. + :paramtype error: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterPodIdentityProvisioningErrorBody + """ + super(ManagedClusterPodIdentityProvisioningError, self).__init__(**kwargs) + self.error = error + + +class ManagedClusterPodIdentityProvisioningErrorBody(msrest.serialization.Model): + """An error response from the pod identity provisioning. + + :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :vartype code: str + :ivar message: A message describing the error, intended to be suitable for display in a user + interface. + :vartype message: str + :ivar target: The target of the particular error. For example, the name of the property in + error. + :vartype target: str + :ivar details: A list of additional details about the error. + :vartype details: + list[~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterPodIdentityProvisioningErrorBody] + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ManagedClusterPodIdentityProvisioningErrorBody]'}, + } + + def __init__( + self, + *, + code: Optional[str] = None, + message: Optional[str] = None, + target: Optional[str] = None, + details: Optional[List["_models.ManagedClusterPodIdentityProvisioningErrorBody"]] = None, + **kwargs + ): + """ + :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :paramtype code: str + :keyword message: A message describing the error, intended to be suitable for display in a user + interface. + :paramtype message: str + :keyword target: The target of the particular error. For example, the name of the property in + error. + :paramtype target: str + :keyword details: A list of additional details about the error. + :paramtype details: + list[~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterPodIdentityProvisioningErrorBody] + """ + super(ManagedClusterPodIdentityProvisioningErrorBody, self).__init__(**kwargs) + self.code = code + self.message = message + self.target = target + self.details = details + + +class ManagedClusterPodIdentityProvisioningInfo(msrest.serialization.Model): + """ManagedClusterPodIdentityProvisioningInfo. + + :ivar error: Pod identity assignment error (if any). + :vartype error: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterPodIdentityProvisioningError + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ManagedClusterPodIdentityProvisioningError'}, + } + + def __init__( + self, + *, + error: Optional["_models.ManagedClusterPodIdentityProvisioningError"] = None, + **kwargs + ): + """ + :keyword error: Pod identity assignment error (if any). + :paramtype error: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterPodIdentityProvisioningError + """ + super(ManagedClusterPodIdentityProvisioningInfo, self).__init__(**kwargs) + self.error = error + + +class ManagedClusterPoolUpgradeProfile(msrest.serialization.Model): + """The list of available upgrade versions. + + All required parameters must be populated in order to send to Azure. + + :ivar kubernetes_version: Required. The Kubernetes version (major.minor.patch). + :vartype kubernetes_version: str + :ivar name: The Agent Pool name. + :vartype name: str + :ivar os_type: Required. The operating system type. The default is Linux. Known values are: + "Linux", "Windows". Default value: "Linux". + :vartype os_type: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.OSType + :ivar upgrades: List of orchestrator types and versions available for upgrade. + :vartype upgrades: + list[~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterPoolUpgradeProfileUpgradesItem] + """ + + _validation = { + 'kubernetes_version': {'required': True}, + 'os_type': {'required': True}, + } + + _attribute_map = { + 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'os_type': {'key': 'osType', 'type': 'str'}, + 'upgrades': {'key': 'upgrades', 'type': '[ManagedClusterPoolUpgradeProfileUpgradesItem]'}, + } + + def __init__( + self, + *, + kubernetes_version: str, + os_type: Union[str, "_models.OSType"] = "Linux", + name: Optional[str] = None, + upgrades: Optional[List["_models.ManagedClusterPoolUpgradeProfileUpgradesItem"]] = None, + **kwargs + ): + """ + :keyword kubernetes_version: Required. The Kubernetes version (major.minor.patch). + :paramtype kubernetes_version: str + :keyword name: The Agent Pool name. + :paramtype name: str + :keyword os_type: Required. The operating system type. The default is Linux. Known values are: + "Linux", "Windows". Default value: "Linux". + :paramtype os_type: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.OSType + :keyword upgrades: List of orchestrator types and versions available for upgrade. + :paramtype upgrades: + list[~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterPoolUpgradeProfileUpgradesItem] + """ + super(ManagedClusterPoolUpgradeProfile, self).__init__(**kwargs) + self.kubernetes_version = kubernetes_version + self.name = name + self.os_type = os_type + self.upgrades = upgrades + + +class ManagedClusterPoolUpgradeProfileUpgradesItem(msrest.serialization.Model): + """ManagedClusterPoolUpgradeProfileUpgradesItem. + + :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 + """ + + _attribute_map = { + 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, + 'is_preview': {'key': 'isPreview', 'type': 'bool'}, + } + + def __init__( + self, + *, + kubernetes_version: Optional[str] = None, + is_preview: Optional[bool] = None, + **kwargs + ): + """ + :keyword kubernetes_version: The Kubernetes version (major.minor.patch). + :paramtype kubernetes_version: str + :keyword is_preview: Whether the Kubernetes version is currently in preview. + :paramtype is_preview: bool + """ + super(ManagedClusterPoolUpgradeProfileUpgradesItem, self).__init__(**kwargs) + self.kubernetes_version = kubernetes_version + self.is_preview = is_preview + + +class ManagedClusterPropertiesAutoScalerProfile(msrest.serialization.Model): + """Parameters to be applied to the cluster-autoscaler when enabled. + + :ivar balance_similar_node_groups: Valid values are 'true' and 'false'. + :vartype balance_similar_node_groups: str + :ivar expander: If not specified, the default is 'random'. See `expanders + `_ + for more information. Known values are: "least-waste", "most-pods", "priority", "random". + :vartype expander: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.Expander + :ivar max_empty_bulk_delete: The default is 10. + :vartype max_empty_bulk_delete: str + :ivar max_graceful_termination_sec: The default is 600. + :vartype max_graceful_termination_sec: str + :ivar max_node_provision_time: The default is '15m'. Values must be an integer followed by an + 'm'. No unit of time other than minutes (m) is supported. + :vartype max_node_provision_time: str + :ivar max_total_unready_percentage: The default is 45. The maximum is 100 and the minimum is 0. + :vartype max_total_unready_percentage: str + :ivar new_pod_scale_up_delay: For scenarios like burst/batch scale where you don't want CA to + act before the kubernetes scheduler could schedule all the pods, you can tell CA to ignore + unscheduled pods before they're a certain age. The default is '0s'. Values must be an integer + followed by a unit ('s' for seconds, 'm' for minutes, 'h' for hours, etc). + :vartype new_pod_scale_up_delay: str + :ivar ok_total_unready_count: This must be an integer. The default is 3. + :vartype ok_total_unready_count: str + :ivar scan_interval: The default is '10'. Values must be an integer number of seconds. + :vartype scan_interval: str + :ivar scale_down_delay_after_add: The default is '10m'. Values must be an integer followed by + an 'm'. No unit of time other than minutes (m) is supported. + :vartype scale_down_delay_after_add: str + :ivar scale_down_delay_after_delete: The default is the scan-interval. Values must be an + integer followed by an 'm'. No unit of time other than minutes (m) is supported. + :vartype scale_down_delay_after_delete: str + :ivar scale_down_delay_after_failure: The default is '3m'. Values must be an integer followed + by an 'm'. No unit of time other than minutes (m) is supported. + :vartype scale_down_delay_after_failure: str + :ivar scale_down_unneeded_time: The default is '10m'. Values must be an integer followed by an + 'm'. No unit of time other than minutes (m) is supported. + :vartype scale_down_unneeded_time: str + :ivar scale_down_unready_time: The default is '20m'. Values must be an integer followed by an + 'm'. No unit of time other than minutes (m) is supported. + :vartype scale_down_unready_time: str + :ivar scale_down_utilization_threshold: The default is '0.5'. + :vartype scale_down_utilization_threshold: str + :ivar skip_nodes_with_local_storage: The default is true. + :vartype skip_nodes_with_local_storage: str + :ivar skip_nodes_with_system_pods: The default is true. + :vartype skip_nodes_with_system_pods: str + """ + + _attribute_map = { + 'balance_similar_node_groups': {'key': 'balance-similar-node-groups', 'type': 'str'}, + 'expander': {'key': 'expander', 'type': 'str'}, + 'max_empty_bulk_delete': {'key': 'max-empty-bulk-delete', 'type': 'str'}, + 'max_graceful_termination_sec': {'key': 'max-graceful-termination-sec', 'type': 'str'}, + 'max_node_provision_time': {'key': 'max-node-provision-time', 'type': 'str'}, + 'max_total_unready_percentage': {'key': 'max-total-unready-percentage', 'type': 'str'}, + 'new_pod_scale_up_delay': {'key': 'new-pod-scale-up-delay', 'type': 'str'}, + 'ok_total_unready_count': {'key': 'ok-total-unready-count', 'type': 'str'}, + 'scan_interval': {'key': 'scan-interval', 'type': 'str'}, + 'scale_down_delay_after_add': {'key': 'scale-down-delay-after-add', 'type': 'str'}, + 'scale_down_delay_after_delete': {'key': 'scale-down-delay-after-delete', 'type': 'str'}, + 'scale_down_delay_after_failure': {'key': 'scale-down-delay-after-failure', 'type': 'str'}, + 'scale_down_unneeded_time': {'key': 'scale-down-unneeded-time', 'type': 'str'}, + 'scale_down_unready_time': {'key': 'scale-down-unready-time', 'type': 'str'}, + 'scale_down_utilization_threshold': {'key': 'scale-down-utilization-threshold', 'type': 'str'}, + 'skip_nodes_with_local_storage': {'key': 'skip-nodes-with-local-storage', 'type': 'str'}, + 'skip_nodes_with_system_pods': {'key': 'skip-nodes-with-system-pods', 'type': 'str'}, + } + + def __init__( + self, + *, + balance_similar_node_groups: Optional[str] = None, + expander: Optional[Union[str, "_models.Expander"]] = None, + max_empty_bulk_delete: Optional[str] = None, + max_graceful_termination_sec: Optional[str] = None, + max_node_provision_time: Optional[str] = None, + max_total_unready_percentage: Optional[str] = None, + new_pod_scale_up_delay: Optional[str] = None, + ok_total_unready_count: Optional[str] = None, + scan_interval: Optional[str] = None, + scale_down_delay_after_add: Optional[str] = None, + scale_down_delay_after_delete: Optional[str] = None, + scale_down_delay_after_failure: Optional[str] = None, + scale_down_unneeded_time: Optional[str] = None, + scale_down_unready_time: Optional[str] = None, + scale_down_utilization_threshold: Optional[str] = None, + skip_nodes_with_local_storage: Optional[str] = None, + skip_nodes_with_system_pods: Optional[str] = None, + **kwargs + ): + """ + :keyword balance_similar_node_groups: Valid values are 'true' and 'false'. + :paramtype balance_similar_node_groups: str + :keyword expander: If not specified, the default is 'random'. See `expanders + `_ + for more information. Known values are: "least-waste", "most-pods", "priority", "random". + :paramtype expander: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.Expander + :keyword max_empty_bulk_delete: The default is 10. + :paramtype max_empty_bulk_delete: str + :keyword max_graceful_termination_sec: The default is 600. + :paramtype max_graceful_termination_sec: str + :keyword max_node_provision_time: The default is '15m'. Values must be an integer followed by + an 'm'. No unit of time other than minutes (m) is supported. + :paramtype max_node_provision_time: str + :keyword max_total_unready_percentage: The default is 45. The maximum is 100 and the minimum is + 0. + :paramtype max_total_unready_percentage: str + :keyword new_pod_scale_up_delay: For scenarios like burst/batch scale where you don't want CA + to act before the kubernetes scheduler could schedule all the pods, you can tell CA to ignore + unscheduled pods before they're a certain age. The default is '0s'. Values must be an integer + followed by a unit ('s' for seconds, 'm' for minutes, 'h' for hours, etc). + :paramtype new_pod_scale_up_delay: str + :keyword ok_total_unready_count: This must be an integer. The default is 3. + :paramtype ok_total_unready_count: str + :keyword scan_interval: The default is '10'. Values must be an integer number of seconds. + :paramtype scan_interval: str + :keyword scale_down_delay_after_add: The default is '10m'. Values must be an integer followed + by an 'm'. No unit of time other than minutes (m) is supported. + :paramtype scale_down_delay_after_add: str + :keyword scale_down_delay_after_delete: The default is the scan-interval. Values must be an + integer followed by an 'm'. No unit of time other than minutes (m) is supported. + :paramtype scale_down_delay_after_delete: str + :keyword scale_down_delay_after_failure: The default is '3m'. Values must be an integer + followed by an 'm'. No unit of time other than minutes (m) is supported. + :paramtype scale_down_delay_after_failure: str + :keyword scale_down_unneeded_time: The default is '10m'. Values must be an integer followed by + an 'm'. No unit of time other than minutes (m) is supported. + :paramtype scale_down_unneeded_time: str + :keyword scale_down_unready_time: The default is '20m'. Values must be an integer followed by + an 'm'. No unit of time other than minutes (m) is supported. + :paramtype scale_down_unready_time: str + :keyword scale_down_utilization_threshold: The default is '0.5'. + :paramtype scale_down_utilization_threshold: str + :keyword skip_nodes_with_local_storage: The default is true. + :paramtype skip_nodes_with_local_storage: str + :keyword skip_nodes_with_system_pods: The default is true. + :paramtype skip_nodes_with_system_pods: str + """ + super(ManagedClusterPropertiesAutoScalerProfile, self).__init__(**kwargs) + self.balance_similar_node_groups = balance_similar_node_groups + self.expander = expander + self.max_empty_bulk_delete = max_empty_bulk_delete + self.max_graceful_termination_sec = max_graceful_termination_sec + self.max_node_provision_time = max_node_provision_time + self.max_total_unready_percentage = max_total_unready_percentage + self.new_pod_scale_up_delay = new_pod_scale_up_delay + self.ok_total_unready_count = ok_total_unready_count + self.scan_interval = scan_interval + self.scale_down_delay_after_add = scale_down_delay_after_add + self.scale_down_delay_after_delete = scale_down_delay_after_delete + self.scale_down_delay_after_failure = scale_down_delay_after_failure + self.scale_down_unneeded_time = scale_down_unneeded_time + self.scale_down_unready_time = scale_down_unready_time + self.scale_down_utilization_threshold = scale_down_utilization_threshold + self.skip_nodes_with_local_storage = skip_nodes_with_local_storage + self.skip_nodes_with_system_pods = skip_nodes_with_system_pods + + +class ManagedClusterPropertiesForSnapshot(msrest.serialization.Model): + """managed cluster properties for snapshot, these properties are read only. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar kubernetes_version: The current kubernetes version. + :vartype kubernetes_version: str + :ivar sku: The current managed cluster sku. + :vartype sku: ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterSKU + :ivar enable_rbac: Whether the cluster has enabled Kubernetes Role-Based Access Control or not. + :vartype enable_rbac: bool + :ivar network_profile: The current network profile. + :vartype network_profile: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.NetworkProfileForSnapshot + """ + + _validation = { + 'network_profile': {'readonly': True}, + } + + _attribute_map = { + 'kubernetes_version': {'key': 'kubernetesVersion', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'ManagedClusterSKU'}, + 'enable_rbac': {'key': 'enableRbac', 'type': 'bool'}, + 'network_profile': {'key': 'networkProfile', 'type': 'NetworkProfileForSnapshot'}, + } + + def __init__( + self, + *, + kubernetes_version: Optional[str] = None, + sku: Optional["_models.ManagedClusterSKU"] = None, + enable_rbac: Optional[bool] = None, + **kwargs + ): + """ + :keyword kubernetes_version: The current kubernetes version. + :paramtype kubernetes_version: str + :keyword sku: The current managed cluster sku. + :paramtype sku: ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterSKU + :keyword enable_rbac: Whether the cluster has enabled Kubernetes Role-Based Access Control or + not. + :paramtype enable_rbac: bool + """ + super(ManagedClusterPropertiesForSnapshot, self).__init__(**kwargs) + self.kubernetes_version = kubernetes_version + self.sku = sku + self.enable_rbac = enable_rbac + self.network_profile = None + + +class ManagedClusterSecurityProfile(msrest.serialization.Model): + """Security profile for the container service cluster. + + :ivar defender: Microsoft Defender settings for the security profile. + :vartype defender: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterSecurityProfileDefender + :ivar azure_key_vault_kms: Azure Key Vault `key management service + `_ settings for the security + profile. + :vartype azure_key_vault_kms: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.AzureKeyVaultKms + :ivar workload_identity: `Workload Identity + `_ settings for the security profile. + :vartype workload_identity: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterSecurityProfileWorkloadIdentity + """ + + _attribute_map = { + 'defender': {'key': 'defender', 'type': 'ManagedClusterSecurityProfileDefender'}, + 'azure_key_vault_kms': {'key': 'azureKeyVaultKms', 'type': 'AzureKeyVaultKms'}, + 'workload_identity': {'key': 'workloadIdentity', 'type': 'ManagedClusterSecurityProfileWorkloadIdentity'}, + } + + def __init__( + self, + *, + defender: Optional["_models.ManagedClusterSecurityProfileDefender"] = None, + azure_key_vault_kms: Optional["_models.AzureKeyVaultKms"] = None, + workload_identity: Optional["_models.ManagedClusterSecurityProfileWorkloadIdentity"] = None, + **kwargs + ): + """ + :keyword defender: Microsoft Defender settings for the security profile. + :paramtype defender: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterSecurityProfileDefender + :keyword azure_key_vault_kms: Azure Key Vault `key management service + `_ settings for the security + profile. + :paramtype azure_key_vault_kms: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.AzureKeyVaultKms + :keyword workload_identity: `Workload Identity + `_ settings for the security profile. + :paramtype workload_identity: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterSecurityProfileWorkloadIdentity + """ + super(ManagedClusterSecurityProfile, self).__init__(**kwargs) + self.defender = defender + self.azure_key_vault_kms = azure_key_vault_kms + self.workload_identity = workload_identity + + +class ManagedClusterSecurityProfileDefender(msrest.serialization.Model): + """Microsoft Defender settings for the security profile. + + :ivar log_analytics_workspace_resource_id: Resource ID of the Log Analytics workspace to be + associated with Microsoft Defender. When Microsoft Defender is enabled, this field is required + and must be a valid workspace resource ID. When Microsoft Defender is disabled, leave the field + empty. + :vartype log_analytics_workspace_resource_id: str + :ivar security_monitoring: Microsoft Defender threat detection for Cloud settings for the + security profile. + :vartype security_monitoring: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterSecurityProfileDefenderSecurityMonitoring + """ + + _attribute_map = { + 'log_analytics_workspace_resource_id': {'key': 'logAnalyticsWorkspaceResourceId', 'type': 'str'}, + 'security_monitoring': {'key': 'securityMonitoring', 'type': 'ManagedClusterSecurityProfileDefenderSecurityMonitoring'}, + } + + def __init__( + self, + *, + log_analytics_workspace_resource_id: Optional[str] = None, + security_monitoring: Optional["_models.ManagedClusterSecurityProfileDefenderSecurityMonitoring"] = None, + **kwargs + ): + """ + :keyword log_analytics_workspace_resource_id: Resource ID of the Log Analytics workspace to be + associated with Microsoft Defender. When Microsoft Defender is enabled, this field is required + and must be a valid workspace resource ID. When Microsoft Defender is disabled, leave the field + empty. + :paramtype log_analytics_workspace_resource_id: str + :keyword security_monitoring: Microsoft Defender threat detection for Cloud settings for the + security profile. + :paramtype security_monitoring: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterSecurityProfileDefenderSecurityMonitoring + """ + super(ManagedClusterSecurityProfileDefender, self).__init__(**kwargs) + self.log_analytics_workspace_resource_id = log_analytics_workspace_resource_id + self.security_monitoring = security_monitoring + + +class ManagedClusterSecurityProfileDefenderSecurityMonitoring(msrest.serialization.Model): + """Microsoft Defender settings for the security profile threat detection. + + :ivar enabled: Whether to enable Defender threat detection. + :vartype enabled: bool + """ + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + } + + def __init__( + self, + *, + enabled: Optional[bool] = None, + **kwargs + ): + """ + :keyword enabled: Whether to enable Defender threat detection. + :paramtype enabled: bool + """ + super(ManagedClusterSecurityProfileDefenderSecurityMonitoring, self).__init__(**kwargs) + self.enabled = enabled + + +class ManagedClusterSecurityProfileWorkloadIdentity(msrest.serialization.Model): + """Workload Identity settings for the security profile. + + :ivar enabled: Whether to enable Workload Identity. + :vartype enabled: bool + """ + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + } + + def __init__( + self, + *, + enabled: Optional[bool] = None, + **kwargs + ): + """ + :keyword enabled: Whether to enable Workload Identity. + :paramtype enabled: bool + """ + super(ManagedClusterSecurityProfileWorkloadIdentity, self).__init__(**kwargs) + self.enabled = enabled + + +class ManagedClusterServicePrincipalProfile(msrest.serialization.Model): + """Information about a service principal identity for the cluster to use for manipulating Azure APIs. + + All required parameters must be populated in order to send to Azure. + + :ivar client_id: Required. The ID for the service principal. + :vartype client_id: str + :ivar secret: The secret password associated with the service principal in plain text. + :vartype secret: str + """ + + _validation = { + 'client_id': {'required': True}, + } + + _attribute_map = { + 'client_id': {'key': 'clientId', 'type': 'str'}, + 'secret': {'key': 'secret', 'type': 'str'}, + } + + def __init__( + self, + *, + client_id: str, + secret: Optional[str] = None, + **kwargs + ): + """ + :keyword client_id: Required. The ID for the service principal. + :paramtype client_id: str + :keyword secret: The secret password associated with the service principal in plain text. + :paramtype secret: str + """ + super(ManagedClusterServicePrincipalProfile, self).__init__(**kwargs) + self.client_id = client_id + self.secret = secret + + +class ManagedClusterSKU(msrest.serialization.Model): + """The SKU of a Managed Cluster. + + :ivar name: The name of a managed cluster SKU. Known values are: "Basic". + :vartype name: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterSKUName + :ivar tier: If not specified, the default is 'Free'. See `uptime SLA + `_ for more details. Known values are: "Paid", + "Free". + :vartype tier: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterSKUTier + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[Union[str, "_models.ManagedClusterSKUName"]] = None, + tier: Optional[Union[str, "_models.ManagedClusterSKUTier"]] = None, + **kwargs + ): + """ + :keyword name: The name of a managed cluster SKU. Known values are: "Basic". + :paramtype name: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterSKUName + :keyword tier: If not specified, the default is 'Free'. See `uptime SLA + `_ for more details. Known values are: "Paid", + "Free". + :paramtype tier: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterSKUTier + """ + super(ManagedClusterSKU, self).__init__(**kwargs) + self.name = name + self.tier = tier + + +class ManagedClusterSnapshot(TrackedResource): + """A managed cluster snapshot resource. + + 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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.containerservice.v2022_06_02_preview.models.SystemData + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str + :ivar creation_data: CreationData to be used to specify the source resource ID to create this + snapshot. + :vartype creation_data: ~azure.mgmt.containerservice.v2022_06_02_preview.models.CreationData + :ivar snapshot_type: The type of a snapshot. The default is NodePool. Known values are: + "NodePool", "ManagedCluster". Default value: "NodePool". + :vartype snapshot_type: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.SnapshotType + :ivar managed_cluster_properties_read_only: What the properties will be showed when getting + managed cluster snapshot. Those properties are read-only. + :vartype managed_cluster_properties_read_only: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterPropertiesForSnapshot + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'location': {'required': True}, + 'managed_cluster_properties_read_only': {'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'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'creation_data': {'key': 'properties.creationData', 'type': 'CreationData'}, + 'snapshot_type': {'key': 'properties.snapshotType', 'type': 'str'}, + 'managed_cluster_properties_read_only': {'key': 'properties.managedClusterPropertiesReadOnly', 'type': 'ManagedClusterPropertiesForSnapshot'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + creation_data: Optional["_models.CreationData"] = None, + snapshot_type: Optional[Union[str, "_models.SnapshotType"]] = "NodePool", + **kwargs + ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + :keyword creation_data: CreationData to be used to specify the source resource ID to create + this snapshot. + :paramtype creation_data: ~azure.mgmt.containerservice.v2022_06_02_preview.models.CreationData + :keyword snapshot_type: The type of a snapshot. The default is NodePool. Known values are: + "NodePool", "ManagedCluster". Default value: "NodePool". + :paramtype snapshot_type: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.SnapshotType + """ + super(ManagedClusterSnapshot, self).__init__(tags=tags, location=location, **kwargs) + self.creation_data = creation_data + self.snapshot_type = snapshot_type + self.managed_cluster_properties_read_only = None + + +class ManagedClusterSnapshotListResult(msrest.serialization.Model): + """The response from the List Managed Cluster Snapshots operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The list of managed cluster snapshots. + :vartype value: + list[~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterSnapshot] + :ivar next_link: The URL to get the next set of managed cluster snapshot results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ManagedClusterSnapshot]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["_models.ManagedClusterSnapshot"]] = None, + **kwargs + ): + """ + :keyword value: The list of managed cluster snapshots. + :paramtype value: + list[~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterSnapshot] + """ + super(ManagedClusterSnapshotListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class ManagedClusterStorageProfile(msrest.serialization.Model): + """Storage profile for the container service cluster. + + :ivar disk_csi_driver: AzureDisk CSI Driver settings for the storage profile. + :vartype disk_csi_driver: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterStorageProfileDiskCSIDriver + :ivar file_csi_driver: AzureFile CSI Driver settings for the storage profile. + :vartype file_csi_driver: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterStorageProfileFileCSIDriver + :ivar snapshot_controller: Snapshot Controller settings for the storage profile. + :vartype snapshot_controller: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterStorageProfileSnapshotController + :ivar blob_csi_driver: AzureBlob CSI Driver settings for the storage profile. + :vartype blob_csi_driver: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterStorageProfileBlobCSIDriver + """ + + _attribute_map = { + 'disk_csi_driver': {'key': 'diskCSIDriver', 'type': 'ManagedClusterStorageProfileDiskCSIDriver'}, + 'file_csi_driver': {'key': 'fileCSIDriver', 'type': 'ManagedClusterStorageProfileFileCSIDriver'}, + 'snapshot_controller': {'key': 'snapshotController', 'type': 'ManagedClusterStorageProfileSnapshotController'}, + 'blob_csi_driver': {'key': 'blobCSIDriver', 'type': 'ManagedClusterStorageProfileBlobCSIDriver'}, + } + + def __init__( + self, + *, + disk_csi_driver: Optional["_models.ManagedClusterStorageProfileDiskCSIDriver"] = None, + file_csi_driver: Optional["_models.ManagedClusterStorageProfileFileCSIDriver"] = None, + snapshot_controller: Optional["_models.ManagedClusterStorageProfileSnapshotController"] = None, + blob_csi_driver: Optional["_models.ManagedClusterStorageProfileBlobCSIDriver"] = None, + **kwargs + ): + """ + :keyword disk_csi_driver: AzureDisk CSI Driver settings for the storage profile. + :paramtype disk_csi_driver: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterStorageProfileDiskCSIDriver + :keyword file_csi_driver: AzureFile CSI Driver settings for the storage profile. + :paramtype file_csi_driver: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterStorageProfileFileCSIDriver + :keyword snapshot_controller: Snapshot Controller settings for the storage profile. + :paramtype snapshot_controller: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterStorageProfileSnapshotController + :keyword blob_csi_driver: AzureBlob CSI Driver settings for the storage profile. + :paramtype blob_csi_driver: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterStorageProfileBlobCSIDriver + """ + super(ManagedClusterStorageProfile, self).__init__(**kwargs) + self.disk_csi_driver = disk_csi_driver + self.file_csi_driver = file_csi_driver + self.snapshot_controller = snapshot_controller + self.blob_csi_driver = blob_csi_driver + + +class ManagedClusterStorageProfileBlobCSIDriver(msrest.serialization.Model): + """AzureBlob CSI Driver settings for the storage profile. + + :ivar enabled: Whether to enable AzureBlob CSI Driver. The default value is false. + :vartype enabled: bool + """ + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + } + + def __init__( + self, + *, + enabled: Optional[bool] = None, + **kwargs + ): + """ + :keyword enabled: Whether to enable AzureBlob CSI Driver. The default value is false. + :paramtype enabled: bool + """ + super(ManagedClusterStorageProfileBlobCSIDriver, self).__init__(**kwargs) + self.enabled = enabled + + +class ManagedClusterStorageProfileDiskCSIDriver(msrest.serialization.Model): + """AzureDisk CSI Driver settings for the storage profile. + + :ivar enabled: Whether to enable AzureDisk CSI Driver. The default value is true. + :vartype enabled: bool + :ivar version: The version of AzureDisk CSI Driver. The default value is v1. + :vartype version: str + """ + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'version': {'key': 'version', 'type': 'str'}, + } + + def __init__( + self, + *, + enabled: Optional[bool] = None, + version: Optional[str] = None, + **kwargs + ): + """ + :keyword enabled: Whether to enable AzureDisk CSI Driver. The default value is true. + :paramtype enabled: bool + :keyword version: The version of AzureDisk CSI Driver. The default value is v1. + :paramtype version: str + """ + super(ManagedClusterStorageProfileDiskCSIDriver, self).__init__(**kwargs) + self.enabled = enabled + self.version = version + + +class ManagedClusterStorageProfileFileCSIDriver(msrest.serialization.Model): + """AzureFile CSI Driver settings for the storage profile. + + :ivar enabled: Whether to enable AzureFile CSI Driver. The default value is true. + :vartype enabled: bool + """ + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + } + + def __init__( + self, + *, + enabled: Optional[bool] = None, + **kwargs + ): + """ + :keyword enabled: Whether to enable AzureFile CSI Driver. The default value is true. + :paramtype enabled: bool + """ + super(ManagedClusterStorageProfileFileCSIDriver, self).__init__(**kwargs) + self.enabled = enabled + + +class ManagedClusterStorageProfileSnapshotController(msrest.serialization.Model): + """Snapshot Controller settings for the storage profile. + + :ivar enabled: Whether to enable Snapshot Controller. The default value is true. + :vartype enabled: bool + """ + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + } + + def __init__( + self, + *, + enabled: Optional[bool] = None, + **kwargs + ): + """ + :keyword enabled: Whether to enable Snapshot Controller. The default value is true. + :paramtype enabled: bool + """ + super(ManagedClusterStorageProfileSnapshotController, self).__init__(**kwargs) + self.enabled = enabled + + +class ManagedClusterUpgradeProfile(msrest.serialization.Model): + """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 id: The ID of the upgrade profile. + :vartype id: str + :ivar name: The name of the upgrade profile. + :vartype name: str + :ivar type: The type of the upgrade profile. + :vartype type: str + :ivar control_plane_profile: Required. The list of available upgrade versions for the control + plane. + :vartype control_plane_profile: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterPoolUpgradeProfile + :ivar agent_pool_profiles: Required. The list of available upgrade versions for agent pools. + :vartype agent_pool_profiles: + list[~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterPoolUpgradeProfile] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'control_plane_profile': {'required': True}, + 'agent_pool_profiles': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'control_plane_profile': {'key': 'properties.controlPlaneProfile', 'type': 'ManagedClusterPoolUpgradeProfile'}, + 'agent_pool_profiles': {'key': 'properties.agentPoolProfiles', 'type': '[ManagedClusterPoolUpgradeProfile]'}, + } + + def __init__( + self, + *, + control_plane_profile: "_models.ManagedClusterPoolUpgradeProfile", + agent_pool_profiles: List["_models.ManagedClusterPoolUpgradeProfile"], + **kwargs + ): + """ + :keyword control_plane_profile: Required. The list of available upgrade versions for the + control plane. + :paramtype control_plane_profile: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterPoolUpgradeProfile + :keyword agent_pool_profiles: Required. The list of available upgrade versions for agent pools. + :paramtype agent_pool_profiles: + list[~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterPoolUpgradeProfile] + """ + super(ManagedClusterUpgradeProfile, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.control_plane_profile = control_plane_profile + self.agent_pool_profiles = agent_pool_profiles + + +class ManagedClusterWindowsProfile(msrest.serialization.Model): + """Profile for Windows VMs in the managed cluster. + + All required parameters must be populated in order to send to Azure. + + :ivar admin_username: Required. 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 admin_password: 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 license_type: The license type to use for Windows VMs. See `Azure Hybrid User Benefits + `_ for more details. Known values are: + "None", "Windows_Server". + :vartype license_type: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.LicenseType + :ivar enable_csi_proxy: For more details on CSI proxy, see the `CSI proxy GitHub repo + `_. + :vartype enable_csi_proxy: bool + :ivar gmsa_profile: The Windows gMSA Profile in the Managed Cluster. + :vartype gmsa_profile: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.WindowsGmsaProfile + """ + + _validation = { + 'admin_username': {'required': True}, + } + + _attribute_map = { + 'admin_username': {'key': 'adminUsername', 'type': 'str'}, + 'admin_password': {'key': 'adminPassword', 'type': 'str'}, + 'license_type': {'key': 'licenseType', 'type': 'str'}, + 'enable_csi_proxy': {'key': 'enableCSIProxy', 'type': 'bool'}, + 'gmsa_profile': {'key': 'gmsaProfile', 'type': 'WindowsGmsaProfile'}, + } + + def __init__( + self, + *, + admin_username: str, + admin_password: Optional[str] = None, + license_type: Optional[Union[str, "_models.LicenseType"]] = None, + enable_csi_proxy: Optional[bool] = None, + gmsa_profile: Optional["_models.WindowsGmsaProfile"] = None, + **kwargs + ): + """ + :keyword admin_username: Required. 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 admin_password: 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 license_type: The license type to use for Windows VMs. See `Azure Hybrid User Benefits + `_ for more details. Known values are: + "None", "Windows_Server". + :paramtype license_type: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.LicenseType + :keyword enable_csi_proxy: For more details on CSI proxy, see the `CSI proxy GitHub repo + `_. + :paramtype enable_csi_proxy: bool + :keyword gmsa_profile: The Windows gMSA Profile in the Managed Cluster. + :paramtype gmsa_profile: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.WindowsGmsaProfile + """ + super(ManagedClusterWindowsProfile, self).__init__(**kwargs) + self.admin_username = admin_username + self.admin_password = admin_password + self.license_type = license_type + self.enable_csi_proxy = enable_csi_proxy + self.gmsa_profile = gmsa_profile + + +class ManagedClusterWorkloadAutoScalerProfile(msrest.serialization.Model): + """Workload Auto-scaler profile for the container service cluster. + + :ivar keda: KEDA (Kubernetes Event-driven Autoscaling) settings for the workload auto-scaler + profile. + :vartype keda: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterWorkloadAutoScalerProfileKeda + """ + + _attribute_map = { + 'keda': {'key': 'keda', 'type': 'ManagedClusterWorkloadAutoScalerProfileKeda'}, + } + + def __init__( + self, + *, + keda: Optional["_models.ManagedClusterWorkloadAutoScalerProfileKeda"] = None, + **kwargs + ): + """ + :keyword keda: KEDA (Kubernetes Event-driven Autoscaling) settings for the workload auto-scaler + profile. + :paramtype keda: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterWorkloadAutoScalerProfileKeda + """ + super(ManagedClusterWorkloadAutoScalerProfile, self).__init__(**kwargs) + self.keda = keda + + +class ManagedClusterWorkloadAutoScalerProfileKeda(msrest.serialization.Model): + """KEDA (Kubernetes Event-driven Autoscaling) settings for the workload auto-scaler profile. + + All required parameters must be populated in order to send to Azure. + + :ivar enabled: Required. Whether to enable KEDA. + :vartype enabled: bool + """ + + _validation = { + 'enabled': {'required': True}, + } + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + } + + def __init__( + self, + *, + enabled: bool, + **kwargs + ): + """ + :keyword enabled: Required. Whether to enable KEDA. + :paramtype enabled: bool + """ + super(ManagedClusterWorkloadAutoScalerProfileKeda, self).__init__(**kwargs) + self.enabled = enabled + + +class ManagedServiceIdentityUserAssignedIdentitiesValue(msrest.serialization.Model): + """ManagedServiceIdentityUserAssignedIdentitiesValue. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal id of user assigned identity. + :vartype principal_id: str + :ivar client_id: The client id of user assigned identity. + :vartype client_id: str + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'client_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'client_id': {'key': 'clientId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ManagedServiceIdentityUserAssignedIdentitiesValue, self).__init__(**kwargs) + self.principal_id = None + self.client_id = None + + +class NetworkProfileForSnapshot(msrest.serialization.Model): + """network profile for managed cluster snapshot, these properties are read only. + + :ivar network_plugin: networkPlugin for managed cluster snapshot. Known values are: "azure", + "kubenet", "none". Default value: "kubenet". + :vartype network_plugin: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.NetworkPlugin + :ivar network_plugin_mode: NetworkPluginMode for managed cluster snapshot. Known values are: + "Overlay". + :vartype network_plugin_mode: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.NetworkPluginMode + :ivar network_policy: networkPolicy for managed cluster snapshot. Known values are: "calico", + "azure". + :vartype network_policy: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.NetworkPolicy + :ivar network_mode: networkMode for managed cluster snapshot. Known values are: "transparent", + "bridge". + :vartype network_mode: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.NetworkMode + :ivar load_balancer_sku: loadBalancerSku for managed cluster snapshot. Known values are: + "standard", "basic". + :vartype load_balancer_sku: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.LoadBalancerSku + """ + + _attribute_map = { + 'network_plugin': {'key': 'networkPlugin', 'type': 'str'}, + 'network_plugin_mode': {'key': 'networkPluginMode', 'type': 'str'}, + 'network_policy': {'key': 'networkPolicy', 'type': 'str'}, + 'network_mode': {'key': 'networkMode', 'type': 'str'}, + 'load_balancer_sku': {'key': 'loadBalancerSku', 'type': 'str'}, + } + + def __init__( + self, + *, + network_plugin: Optional[Union[str, "_models.NetworkPlugin"]] = "kubenet", + network_plugin_mode: Optional[Union[str, "_models.NetworkPluginMode"]] = None, + network_policy: Optional[Union[str, "_models.NetworkPolicy"]] = None, + network_mode: Optional[Union[str, "_models.NetworkMode"]] = None, + load_balancer_sku: Optional[Union[str, "_models.LoadBalancerSku"]] = None, + **kwargs + ): + """ + :keyword network_plugin: networkPlugin for managed cluster snapshot. Known values are: "azure", + "kubenet", "none". Default value: "kubenet". + :paramtype network_plugin: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.NetworkPlugin + :keyword network_plugin_mode: NetworkPluginMode for managed cluster snapshot. Known values are: + "Overlay". + :paramtype network_plugin_mode: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.NetworkPluginMode + :keyword network_policy: networkPolicy for managed cluster snapshot. Known values are: + "calico", "azure". + :paramtype network_policy: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.NetworkPolicy + :keyword network_mode: networkMode for managed cluster snapshot. Known values are: + "transparent", "bridge". + :paramtype network_mode: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.NetworkMode + :keyword load_balancer_sku: loadBalancerSku for managed cluster snapshot. Known values are: + "standard", "basic". + :paramtype load_balancer_sku: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.LoadBalancerSku + """ + super(NetworkProfileForSnapshot, self).__init__(**kwargs) + self.network_plugin = network_plugin + self.network_plugin_mode = network_plugin_mode + self.network_policy = network_policy + self.network_mode = network_mode + self.load_balancer_sku = load_balancer_sku + + +class OperationListResult(msrest.serialization.Model): + """The List Operation response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The list of operations. + :vartype value: list[~azure.mgmt.containerservice.v2022_06_02_preview.models.OperationValue] + """ + + _validation = { + 'value': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[OperationValue]'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(OperationListResult, self).__init__(**kwargs) + self.value = None + + +class OperationValue(msrest.serialization.Model): + """Describes the properties of a Operation value. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar origin: The origin of the operation. + :vartype origin: str + :ivar name: The name of the operation. + :vartype name: str + :ivar operation: The display name of the operation. + :vartype operation: str + :ivar resource: The display name of the resource the operation applies to. + :vartype resource: str + :ivar description: The description of the operation. + :vartype description: str + :ivar provider: The resource provider for the operation. + :vartype provider: str + """ + + _validation = { + 'origin': {'readonly': True}, + 'name': {'readonly': True}, + 'operation': {'readonly': True}, + 'resource': {'readonly': True}, + 'description': {'readonly': True}, + 'provider': {'readonly': True}, + } + + _attribute_map = { + 'origin': {'key': 'origin', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'operation': {'key': 'display.operation', 'type': 'str'}, + 'resource': {'key': 'display.resource', 'type': 'str'}, + 'description': {'key': 'display.description', 'type': 'str'}, + 'provider': {'key': 'display.provider', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(OperationValue, self).__init__(**kwargs) + self.origin = None + self.name = None + self.operation = None + self.resource = None + self.description = None + self.provider = None + + +class OSOptionProfile(msrest.serialization.Model): + """The OS option profile. + + 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: The ID of the OS option resource. + :vartype id: str + :ivar name: The name of the OS option resource. + :vartype name: str + :ivar type: The type of the OS option resource. + :vartype type: str + :ivar os_option_property_list: Required. The list of OS options. + :vartype os_option_property_list: + list[~azure.mgmt.containerservice.v2022_06_02_preview.models.OSOptionProperty] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'os_option_property_list': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'os_option_property_list': {'key': 'properties.osOptionPropertyList', 'type': '[OSOptionProperty]'}, + } + + def __init__( + self, + *, + os_option_property_list: List["_models.OSOptionProperty"], + **kwargs + ): + """ + :keyword os_option_property_list: Required. The list of OS options. + :paramtype os_option_property_list: + list[~azure.mgmt.containerservice.v2022_06_02_preview.models.OSOptionProperty] + """ + super(OSOptionProfile, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.os_option_property_list = os_option_property_list + + +class OSOptionProperty(msrest.serialization.Model): + """OS option property. + + All required parameters must be populated in order to send to Azure. + + :ivar os_type: Required. The OS type. + :vartype os_type: str + :ivar enable_fips_image: Required. Whether the image is FIPS-enabled. + :vartype enable_fips_image: bool + """ + + _validation = { + 'os_type': {'required': True}, + 'enable_fips_image': {'required': True}, + } + + _attribute_map = { + 'os_type': {'key': 'os-type', 'type': 'str'}, + 'enable_fips_image': {'key': 'enable-fips-image', 'type': 'bool'}, + } + + def __init__( + self, + *, + os_type: str, + enable_fips_image: bool, + **kwargs + ): + """ + :keyword os_type: Required. The OS type. + :paramtype os_type: str + :keyword enable_fips_image: Required. Whether the image is FIPS-enabled. + :paramtype enable_fips_image: bool + """ + super(OSOptionProperty, self).__init__(**kwargs) + self.os_type = os_type + self.enable_fips_image = enable_fips_image + + +class OutboundEnvironmentEndpoint(msrest.serialization.Model): + """Egress endpoints which AKS agent nodes connect to for common purpose. + + :ivar category: The category of endpoints accessed by the AKS agent node, e.g. + azure-resource-management, apiserver, etc. + :vartype category: str + :ivar endpoints: The endpoints that AKS agent nodes connect to. + :vartype endpoints: + list[~azure.mgmt.containerservice.v2022_06_02_preview.models.EndpointDependency] + """ + + _attribute_map = { + 'category': {'key': 'category', 'type': 'str'}, + 'endpoints': {'key': 'endpoints', 'type': '[EndpointDependency]'}, + } + + def __init__( + self, + *, + category: Optional[str] = None, + endpoints: Optional[List["_models.EndpointDependency"]] = None, + **kwargs + ): + """ + :keyword category: The category of endpoints accessed by the AKS agent node, e.g. + azure-resource-management, apiserver, etc. + :paramtype category: str + :keyword endpoints: The endpoints that AKS agent nodes connect to. + :paramtype endpoints: + list[~azure.mgmt.containerservice.v2022_06_02_preview.models.EndpointDependency] + """ + super(OutboundEnvironmentEndpoint, self).__init__(**kwargs) + self.category = category + self.endpoints = endpoints + + +class OutboundEnvironmentEndpointCollection(msrest.serialization.Model): + """Collection of OutboundEnvironmentEndpoint. + + 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 value: Required. Collection of resources. + :vartype value: + list[~azure.mgmt.containerservice.v2022_06_02_preview.models.OutboundEnvironmentEndpoint] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[OutboundEnvironmentEndpoint]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["_models.OutboundEnvironmentEndpoint"], + **kwargs + ): + """ + :keyword value: Required. Collection of resources. + :paramtype value: + list[~azure.mgmt.containerservice.v2022_06_02_preview.models.OutboundEnvironmentEndpoint] + """ + super(OutboundEnvironmentEndpointCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class PowerState(msrest.serialization.Model): + """Describes the Power State of the cluster. + + :ivar code: Tells whether the cluster is Running or Stopped. Known values are: "Running", + "Stopped". + :vartype code: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.Code + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + } + + def __init__( + self, + *, + code: Optional[Union[str, "_models.Code"]] = None, + **kwargs + ): + """ + :keyword code: Tells whether the cluster is Running or Stopped. Known values are: "Running", + "Stopped". + :paramtype code: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.Code + """ + super(PowerState, self).__init__(**kwargs) + self.code = code + + +class PrivateEndpoint(msrest.serialization.Model): + """Private endpoint which a connection belongs to. + + :ivar id: The resource ID of the private endpoint. + :vartype id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + **kwargs + ): + """ + :keyword id: The resource ID of the private endpoint. + :paramtype id: str + """ + super(PrivateEndpoint, self).__init__(**kwargs) + self.id = id + + +class PrivateEndpointConnection(msrest.serialization.Model): + """A private endpoint connection. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The ID of the private endpoint connection. + :vartype id: str + :ivar name: The name of the private endpoint connection. + :vartype name: str + :ivar type: The resource type. + :vartype type: str + :ivar provisioning_state: The current provisioning state. Known values are: "Succeeded", + "Creating", "Deleting", "Failed". + :vartype provisioning_state: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.PrivateEndpointConnectionProvisioningState + :ivar private_endpoint: The resource of private endpoint. + :vartype private_endpoint: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.PrivateEndpoint + :ivar private_link_service_connection_state: A collection of information about the state of the + connection between service consumer and provider. + :vartype private_link_service_connection_state: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.PrivateLinkServiceConnectionState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, + 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, + } + + def __init__( + self, + *, + private_endpoint: Optional["_models.PrivateEndpoint"] = None, + private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionState"] = None, + **kwargs + ): + """ + :keyword private_endpoint: The resource of private endpoint. + :paramtype private_endpoint: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.PrivateEndpoint + :keyword private_link_service_connection_state: A collection of information about the state of + the connection between service consumer and provider. + :paramtype private_link_service_connection_state: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.PrivateLinkServiceConnectionState + """ + super(PrivateEndpointConnection, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.provisioning_state = None + self.private_endpoint = private_endpoint + self.private_link_service_connection_state = private_link_service_connection_state + + +class PrivateEndpointConnectionListResult(msrest.serialization.Model): + """A list of private endpoint connections. + + :ivar value: The collection value. + :vartype value: + list[~azure.mgmt.containerservice.v2022_06_02_preview.models.PrivateEndpointConnection] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, + } + + def __init__( + self, + *, + value: Optional[List["_models.PrivateEndpointConnection"]] = None, + **kwargs + ): + """ + :keyword value: The collection value. + :paramtype value: + list[~azure.mgmt.containerservice.v2022_06_02_preview.models.PrivateEndpointConnection] + """ + super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) + self.value = value + + +class PrivateLinkResource(msrest.serialization.Model): + """A private link resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The ID of the private link resource. + :vartype id: str + :ivar name: The name of the private link resource. + :vartype name: str + :ivar type: The resource type. + :vartype type: str + :ivar group_id: The group ID of the resource. + :vartype group_id: str + :ivar required_members: The RequiredMembers of the resource. + :vartype required_members: list[str] + :ivar private_link_service_id: The private link service ID of the resource, this field is + exposed only to NRP internally. + :vartype private_link_service_id: str + """ + + _validation = { + 'private_link_service_id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'group_id': {'key': 'groupId', 'type': 'str'}, + 'required_members': {'key': 'requiredMembers', 'type': '[str]'}, + 'private_link_service_id': {'key': 'privateLinkServiceID', 'type': 'str'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + name: Optional[str] = None, + type: Optional[str] = None, + group_id: Optional[str] = None, + required_members: Optional[List[str]] = None, + **kwargs + ): + """ + :keyword id: The ID of the private link resource. + :paramtype id: str + :keyword name: The name of the private link resource. + :paramtype name: str + :keyword type: The resource type. + :paramtype type: str + :keyword group_id: The group ID of the resource. + :paramtype group_id: str + :keyword required_members: The RequiredMembers of the resource. + :paramtype required_members: list[str] + """ + super(PrivateLinkResource, self).__init__(**kwargs) + self.id = id + self.name = name + self.type = type + self.group_id = group_id + self.required_members = required_members + self.private_link_service_id = None + + +class PrivateLinkResourcesListResult(msrest.serialization.Model): + """A list of private link resources. + + :ivar value: The collection value. + :vartype value: + list[~azure.mgmt.containerservice.v2022_06_02_preview.models.PrivateLinkResource] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, + } + + def __init__( + self, + *, + value: Optional[List["_models.PrivateLinkResource"]] = None, + **kwargs + ): + """ + :keyword value: The collection value. + :paramtype value: + list[~azure.mgmt.containerservice.v2022_06_02_preview.models.PrivateLinkResource] + """ + super(PrivateLinkResourcesListResult, self).__init__(**kwargs) + self.value = value + + +class PrivateLinkServiceConnectionState(msrest.serialization.Model): + """The state of a private link service connection. + + :ivar status: The private link service connection status. Known values are: "Pending", + "Approved", "Rejected", "Disconnected". + :vartype status: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ConnectionStatus + :ivar description: The private link service connection description. + :vartype description: str + """ + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + *, + status: Optional[Union[str, "_models.ConnectionStatus"]] = None, + description: Optional[str] = None, + **kwargs + ): + """ + :keyword status: The private link service connection status. Known values are: "Pending", + "Approved", "Rejected", "Disconnected". + :paramtype status: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ConnectionStatus + :keyword description: The private link service connection description. + :paramtype description: str + """ + super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) + self.status = status + self.description = description + + +class ResourceReference(msrest.serialization.Model): + """A reference to an Azure resource. + + :ivar id: The fully qualified Azure resource id. + :vartype id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + **kwargs + ): + """ + :keyword id: The fully qualified Azure resource id. + :paramtype id: str + """ + super(ResourceReference, self).__init__(**kwargs) + self.id = id + + +class RunCommandRequest(msrest.serialization.Model): + """A run command request. + + All required parameters must be populated in order to send to Azure. + + :ivar command: Required. The command to run. + :vartype command: str + :ivar context: A base64 encoded zip file containing the files required by the command. + :vartype context: str + :ivar cluster_token: AuthToken issued for AKS AAD Server App. + :vartype cluster_token: str + """ + + _validation = { + 'command': {'required': True}, + } + + _attribute_map = { + 'command': {'key': 'command', 'type': 'str'}, + 'context': {'key': 'context', 'type': 'str'}, + 'cluster_token': {'key': 'clusterToken', 'type': 'str'}, + } + + def __init__( + self, + *, + command: str, + context: Optional[str] = None, + cluster_token: Optional[str] = None, + **kwargs + ): + """ + :keyword command: Required. The command to run. + :paramtype command: str + :keyword context: A base64 encoded zip file containing the files required by the command. + :paramtype context: str + :keyword cluster_token: AuthToken issued for AKS AAD Server App. + :paramtype cluster_token: str + """ + super(RunCommandRequest, self).__init__(**kwargs) + self.command = command + self.context = context + self.cluster_token = cluster_token + + +class RunCommandResult(msrest.serialization.Model): + """run command result. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The command id. + :vartype id: str + :ivar provisioning_state: provisioning State. + :vartype provisioning_state: str + :ivar exit_code: The exit code of the command. + :vartype exit_code: int + :ivar started_at: The time when the command started. + :vartype started_at: ~datetime.datetime + :ivar finished_at: The time when the command finished. + :vartype finished_at: ~datetime.datetime + :ivar logs: The command output. + :vartype logs: str + :ivar reason: An explanation of why provisioningState is set to failed (if so). + :vartype reason: str + """ + + _validation = { + 'id': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'exit_code': {'readonly': True}, + 'started_at': {'readonly': True}, + 'finished_at': {'readonly': True}, + 'logs': {'readonly': True}, + 'reason': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'exit_code': {'key': 'properties.exitCode', 'type': 'int'}, + 'started_at': {'key': 'properties.startedAt', 'type': 'iso-8601'}, + 'finished_at': {'key': 'properties.finishedAt', 'type': 'iso-8601'}, + 'logs': {'key': 'properties.logs', 'type': 'str'}, + 'reason': {'key': 'properties.reason', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(RunCommandResult, self).__init__(**kwargs) + self.id = None + self.provisioning_state = None + self.exit_code = None + self.started_at = None + self.finished_at = None + self.logs = None + self.reason = None + + +class Snapshot(TrackedResource): + """A node pool snapshot resource. + + 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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.containerservice.v2022_06_02_preview.models.SystemData + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str + :ivar creation_data: CreationData to be used to specify the source agent pool resource ID to + create this snapshot. + :vartype creation_data: ~azure.mgmt.containerservice.v2022_06_02_preview.models.CreationData + :ivar snapshot_type: The type of a snapshot. The default is NodePool. Known values are: + "NodePool", "ManagedCluster". Default value: "NodePool". + :vartype snapshot_type: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.SnapshotType + :ivar kubernetes_version: The version of Kubernetes. + :vartype kubernetes_version: str + :ivar node_image_version: The version of node image. + :vartype node_image_version: str + :ivar os_type: The operating system type. The default is Linux. Known values are: "Linux", + "Windows". Default value: "Linux". + :vartype os_type: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.OSType + :ivar os_sku: Specifies the OS SKU used by the agent pool. If not specified, the default is + Ubuntu if OSType=Linux or Windows2019 if OSType=Windows. And the default Windows OSSKU will be + changed to Windows2022 after Windows2019 is deprecated. Known values are: "Ubuntu", + "CBLMariner", "Windows2019", "Windows2022". + :vartype os_sku: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.OSSKU + :ivar vm_size: The size of the VM. + :vartype vm_size: str + :ivar enable_fips: Whether to use a FIPS-enabled OS. + :vartype enable_fips: bool + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'location': {'required': True}, + 'kubernetes_version': {'readonly': True}, + 'node_image_version': {'readonly': True}, + 'os_type': {'readonly': True}, + 'os_sku': {'readonly': True}, + 'vm_size': {'readonly': True}, + 'enable_fips': {'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'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'creation_data': {'key': 'properties.creationData', 'type': 'CreationData'}, + 'snapshot_type': {'key': 'properties.snapshotType', 'type': 'str'}, + 'kubernetes_version': {'key': 'properties.kubernetesVersion', 'type': 'str'}, + 'node_image_version': {'key': 'properties.nodeImageVersion', 'type': 'str'}, + 'os_type': {'key': 'properties.osType', 'type': 'str'}, + 'os_sku': {'key': 'properties.osSku', 'type': 'str'}, + 'vm_size': {'key': 'properties.vmSize', 'type': 'str'}, + 'enable_fips': {'key': 'properties.enableFIPS', 'type': 'bool'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + creation_data: Optional["_models.CreationData"] = None, + snapshot_type: Optional[Union[str, "_models.SnapshotType"]] = "NodePool", + **kwargs + ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + :keyword creation_data: CreationData to be used to specify the source agent pool resource ID to + create this snapshot. + :paramtype creation_data: ~azure.mgmt.containerservice.v2022_06_02_preview.models.CreationData + :keyword snapshot_type: The type of a snapshot. The default is NodePool. Known values are: + "NodePool", "ManagedCluster". Default value: "NodePool". + :paramtype snapshot_type: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.SnapshotType + """ + super(Snapshot, self).__init__(tags=tags, location=location, **kwargs) + self.creation_data = creation_data + self.snapshot_type = snapshot_type + self.kubernetes_version = None + self.node_image_version = None + self.os_type = None + self.os_sku = None + self.vm_size = None + self.enable_fips = None + + +class SnapshotListResult(msrest.serialization.Model): + """The response from the List Snapshots operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The list of snapshots. + :vartype value: list[~azure.mgmt.containerservice.v2022_06_02_preview.models.Snapshot] + :ivar next_link: The URL to get the next set of snapshot results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Snapshot]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["_models.Snapshot"]] = None, + **kwargs + ): + """ + :keyword value: The list of snapshots. + :paramtype value: list[~azure.mgmt.containerservice.v2022_06_02_preview.models.Snapshot] + """ + super(SnapshotListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class SysctlConfig(msrest.serialization.Model): + """Sysctl settings for Linux agent nodes. + + :ivar net_core_somaxconn: Sysctl setting net.core.somaxconn. + :vartype net_core_somaxconn: int + :ivar net_core_netdev_max_backlog: Sysctl setting net.core.netdev_max_backlog. + :vartype net_core_netdev_max_backlog: int + :ivar net_core_rmem_default: Sysctl setting net.core.rmem_default. + :vartype net_core_rmem_default: int + :ivar net_core_rmem_max: Sysctl setting net.core.rmem_max. + :vartype net_core_rmem_max: int + :ivar net_core_wmem_default: Sysctl setting net.core.wmem_default. + :vartype net_core_wmem_default: int + :ivar net_core_wmem_max: Sysctl setting net.core.wmem_max. + :vartype net_core_wmem_max: int + :ivar net_core_optmem_max: Sysctl setting net.core.optmem_max. + :vartype net_core_optmem_max: int + :ivar net_ipv4_tcp_max_syn_backlog: Sysctl setting net.ipv4.tcp_max_syn_backlog. + :vartype net_ipv4_tcp_max_syn_backlog: int + :ivar net_ipv4_tcp_max_tw_buckets: Sysctl setting net.ipv4.tcp_max_tw_buckets. + :vartype net_ipv4_tcp_max_tw_buckets: int + :ivar net_ipv4_tcp_fin_timeout: Sysctl setting net.ipv4.tcp_fin_timeout. + :vartype net_ipv4_tcp_fin_timeout: int + :ivar net_ipv4_tcp_keepalive_time: Sysctl setting net.ipv4.tcp_keepalive_time. + :vartype net_ipv4_tcp_keepalive_time: int + :ivar net_ipv4_tcp_keepalive_probes: Sysctl setting net.ipv4.tcp_keepalive_probes. + :vartype net_ipv4_tcp_keepalive_probes: int + :ivar net_ipv4_tcpkeepalive_intvl: Sysctl setting net.ipv4.tcp_keepalive_intvl. + :vartype net_ipv4_tcpkeepalive_intvl: int + :ivar net_ipv4_tcp_tw_reuse: Sysctl setting net.ipv4.tcp_tw_reuse. + :vartype net_ipv4_tcp_tw_reuse: bool + :ivar net_ipv4_ip_local_port_range: Sysctl setting net.ipv4.ip_local_port_range. + :vartype net_ipv4_ip_local_port_range: str + :ivar net_ipv4_neigh_default_gc_thresh1: Sysctl setting net.ipv4.neigh.default.gc_thresh1. + :vartype net_ipv4_neigh_default_gc_thresh1: int + :ivar net_ipv4_neigh_default_gc_thresh2: Sysctl setting net.ipv4.neigh.default.gc_thresh2. + :vartype net_ipv4_neigh_default_gc_thresh2: int + :ivar net_ipv4_neigh_default_gc_thresh3: Sysctl setting net.ipv4.neigh.default.gc_thresh3. + :vartype net_ipv4_neigh_default_gc_thresh3: int + :ivar net_netfilter_nf_conntrack_max: Sysctl setting net.netfilter.nf_conntrack_max. + :vartype net_netfilter_nf_conntrack_max: int + :ivar net_netfilter_nf_conntrack_buckets: Sysctl setting net.netfilter.nf_conntrack_buckets. + :vartype net_netfilter_nf_conntrack_buckets: int + :ivar fs_inotify_max_user_watches: Sysctl setting fs.inotify.max_user_watches. + :vartype fs_inotify_max_user_watches: int + :ivar fs_file_max: Sysctl setting fs.file-max. + :vartype fs_file_max: int + :ivar fs_aio_max_nr: Sysctl setting fs.aio-max-nr. + :vartype fs_aio_max_nr: int + :ivar fs_nr_open: Sysctl setting fs.nr_open. + :vartype fs_nr_open: int + :ivar kernel_threads_max: Sysctl setting kernel.threads-max. + :vartype kernel_threads_max: int + :ivar vm_max_map_count: Sysctl setting vm.max_map_count. + :vartype vm_max_map_count: int + :ivar vm_swappiness: Sysctl setting vm.swappiness. + :vartype vm_swappiness: int + :ivar vm_vfs_cache_pressure: Sysctl setting vm.vfs_cache_pressure. + :vartype vm_vfs_cache_pressure: int + """ + + _attribute_map = { + 'net_core_somaxconn': {'key': 'netCoreSomaxconn', 'type': 'int'}, + 'net_core_netdev_max_backlog': {'key': 'netCoreNetdevMaxBacklog', 'type': 'int'}, + 'net_core_rmem_default': {'key': 'netCoreRmemDefault', 'type': 'int'}, + 'net_core_rmem_max': {'key': 'netCoreRmemMax', 'type': 'int'}, + 'net_core_wmem_default': {'key': 'netCoreWmemDefault', 'type': 'int'}, + 'net_core_wmem_max': {'key': 'netCoreWmemMax', 'type': 'int'}, + 'net_core_optmem_max': {'key': 'netCoreOptmemMax', 'type': 'int'}, + 'net_ipv4_tcp_max_syn_backlog': {'key': 'netIpv4TcpMaxSynBacklog', 'type': 'int'}, + 'net_ipv4_tcp_max_tw_buckets': {'key': 'netIpv4TcpMaxTwBuckets', 'type': 'int'}, + 'net_ipv4_tcp_fin_timeout': {'key': 'netIpv4TcpFinTimeout', 'type': 'int'}, + 'net_ipv4_tcp_keepalive_time': {'key': 'netIpv4TcpKeepaliveTime', 'type': 'int'}, + 'net_ipv4_tcp_keepalive_probes': {'key': 'netIpv4TcpKeepaliveProbes', 'type': 'int'}, + 'net_ipv4_tcpkeepalive_intvl': {'key': 'netIpv4TcpkeepaliveIntvl', 'type': 'int'}, + 'net_ipv4_tcp_tw_reuse': {'key': 'netIpv4TcpTwReuse', 'type': 'bool'}, + 'net_ipv4_ip_local_port_range': {'key': 'netIpv4IpLocalPortRange', 'type': 'str'}, + 'net_ipv4_neigh_default_gc_thresh1': {'key': 'netIpv4NeighDefaultGcThresh1', 'type': 'int'}, + 'net_ipv4_neigh_default_gc_thresh2': {'key': 'netIpv4NeighDefaultGcThresh2', 'type': 'int'}, + 'net_ipv4_neigh_default_gc_thresh3': {'key': 'netIpv4NeighDefaultGcThresh3', 'type': 'int'}, + 'net_netfilter_nf_conntrack_max': {'key': 'netNetfilterNfConntrackMax', 'type': 'int'}, + 'net_netfilter_nf_conntrack_buckets': {'key': 'netNetfilterNfConntrackBuckets', 'type': 'int'}, + 'fs_inotify_max_user_watches': {'key': 'fsInotifyMaxUserWatches', 'type': 'int'}, + 'fs_file_max': {'key': 'fsFileMax', 'type': 'int'}, + 'fs_aio_max_nr': {'key': 'fsAioMaxNr', 'type': 'int'}, + 'fs_nr_open': {'key': 'fsNrOpen', 'type': 'int'}, + 'kernel_threads_max': {'key': 'kernelThreadsMax', 'type': 'int'}, + 'vm_max_map_count': {'key': 'vmMaxMapCount', 'type': 'int'}, + 'vm_swappiness': {'key': 'vmSwappiness', 'type': 'int'}, + 'vm_vfs_cache_pressure': {'key': 'vmVfsCachePressure', 'type': 'int'}, + } + + def __init__( + self, + *, + net_core_somaxconn: Optional[int] = None, + net_core_netdev_max_backlog: Optional[int] = None, + net_core_rmem_default: Optional[int] = None, + net_core_rmem_max: Optional[int] = None, + net_core_wmem_default: Optional[int] = None, + net_core_wmem_max: Optional[int] = None, + net_core_optmem_max: Optional[int] = None, + net_ipv4_tcp_max_syn_backlog: Optional[int] = None, + net_ipv4_tcp_max_tw_buckets: Optional[int] = None, + net_ipv4_tcp_fin_timeout: Optional[int] = None, + net_ipv4_tcp_keepalive_time: Optional[int] = None, + net_ipv4_tcp_keepalive_probes: Optional[int] = None, + net_ipv4_tcpkeepalive_intvl: Optional[int] = None, + net_ipv4_tcp_tw_reuse: Optional[bool] = None, + net_ipv4_ip_local_port_range: Optional[str] = None, + net_ipv4_neigh_default_gc_thresh1: Optional[int] = None, + net_ipv4_neigh_default_gc_thresh2: Optional[int] = None, + net_ipv4_neigh_default_gc_thresh3: Optional[int] = None, + net_netfilter_nf_conntrack_max: Optional[int] = None, + net_netfilter_nf_conntrack_buckets: Optional[int] = None, + fs_inotify_max_user_watches: Optional[int] = None, + fs_file_max: Optional[int] = None, + fs_aio_max_nr: Optional[int] = None, + fs_nr_open: Optional[int] = None, + kernel_threads_max: Optional[int] = None, + vm_max_map_count: Optional[int] = None, + vm_swappiness: Optional[int] = None, + vm_vfs_cache_pressure: Optional[int] = None, + **kwargs + ): + """ + :keyword net_core_somaxconn: Sysctl setting net.core.somaxconn. + :paramtype net_core_somaxconn: int + :keyword net_core_netdev_max_backlog: Sysctl setting net.core.netdev_max_backlog. + :paramtype net_core_netdev_max_backlog: int + :keyword net_core_rmem_default: Sysctl setting net.core.rmem_default. + :paramtype net_core_rmem_default: int + :keyword net_core_rmem_max: Sysctl setting net.core.rmem_max. + :paramtype net_core_rmem_max: int + :keyword net_core_wmem_default: Sysctl setting net.core.wmem_default. + :paramtype net_core_wmem_default: int + :keyword net_core_wmem_max: Sysctl setting net.core.wmem_max. + :paramtype net_core_wmem_max: int + :keyword net_core_optmem_max: Sysctl setting net.core.optmem_max. + :paramtype net_core_optmem_max: int + :keyword net_ipv4_tcp_max_syn_backlog: Sysctl setting net.ipv4.tcp_max_syn_backlog. + :paramtype net_ipv4_tcp_max_syn_backlog: int + :keyword net_ipv4_tcp_max_tw_buckets: Sysctl setting net.ipv4.tcp_max_tw_buckets. + :paramtype net_ipv4_tcp_max_tw_buckets: int + :keyword net_ipv4_tcp_fin_timeout: Sysctl setting net.ipv4.tcp_fin_timeout. + :paramtype net_ipv4_tcp_fin_timeout: int + :keyword net_ipv4_tcp_keepalive_time: Sysctl setting net.ipv4.tcp_keepalive_time. + :paramtype net_ipv4_tcp_keepalive_time: int + :keyword net_ipv4_tcp_keepalive_probes: Sysctl setting net.ipv4.tcp_keepalive_probes. + :paramtype net_ipv4_tcp_keepalive_probes: int + :keyword net_ipv4_tcpkeepalive_intvl: Sysctl setting net.ipv4.tcp_keepalive_intvl. + :paramtype net_ipv4_tcpkeepalive_intvl: int + :keyword net_ipv4_tcp_tw_reuse: Sysctl setting net.ipv4.tcp_tw_reuse. + :paramtype net_ipv4_tcp_tw_reuse: bool + :keyword net_ipv4_ip_local_port_range: Sysctl setting net.ipv4.ip_local_port_range. + :paramtype net_ipv4_ip_local_port_range: str + :keyword net_ipv4_neigh_default_gc_thresh1: Sysctl setting net.ipv4.neigh.default.gc_thresh1. + :paramtype net_ipv4_neigh_default_gc_thresh1: int + :keyword net_ipv4_neigh_default_gc_thresh2: Sysctl setting net.ipv4.neigh.default.gc_thresh2. + :paramtype net_ipv4_neigh_default_gc_thresh2: int + :keyword net_ipv4_neigh_default_gc_thresh3: Sysctl setting net.ipv4.neigh.default.gc_thresh3. + :paramtype net_ipv4_neigh_default_gc_thresh3: int + :keyword net_netfilter_nf_conntrack_max: Sysctl setting net.netfilter.nf_conntrack_max. + :paramtype net_netfilter_nf_conntrack_max: int + :keyword net_netfilter_nf_conntrack_buckets: Sysctl setting net.netfilter.nf_conntrack_buckets. + :paramtype net_netfilter_nf_conntrack_buckets: int + :keyword fs_inotify_max_user_watches: Sysctl setting fs.inotify.max_user_watches. + :paramtype fs_inotify_max_user_watches: int + :keyword fs_file_max: Sysctl setting fs.file-max. + :paramtype fs_file_max: int + :keyword fs_aio_max_nr: Sysctl setting fs.aio-max-nr. + :paramtype fs_aio_max_nr: int + :keyword fs_nr_open: Sysctl setting fs.nr_open. + :paramtype fs_nr_open: int + :keyword kernel_threads_max: Sysctl setting kernel.threads-max. + :paramtype kernel_threads_max: int + :keyword vm_max_map_count: Sysctl setting vm.max_map_count. + :paramtype vm_max_map_count: int + :keyword vm_swappiness: Sysctl setting vm.swappiness. + :paramtype vm_swappiness: int + :keyword vm_vfs_cache_pressure: Sysctl setting vm.vfs_cache_pressure. + :paramtype vm_vfs_cache_pressure: int + """ + super(SysctlConfig, self).__init__(**kwargs) + self.net_core_somaxconn = net_core_somaxconn + self.net_core_netdev_max_backlog = net_core_netdev_max_backlog + self.net_core_rmem_default = net_core_rmem_default + self.net_core_rmem_max = net_core_rmem_max + self.net_core_wmem_default = net_core_wmem_default + self.net_core_wmem_max = net_core_wmem_max + self.net_core_optmem_max = net_core_optmem_max + self.net_ipv4_tcp_max_syn_backlog = net_ipv4_tcp_max_syn_backlog + self.net_ipv4_tcp_max_tw_buckets = net_ipv4_tcp_max_tw_buckets + self.net_ipv4_tcp_fin_timeout = net_ipv4_tcp_fin_timeout + self.net_ipv4_tcp_keepalive_time = net_ipv4_tcp_keepalive_time + self.net_ipv4_tcp_keepalive_probes = net_ipv4_tcp_keepalive_probes + self.net_ipv4_tcpkeepalive_intvl = net_ipv4_tcpkeepalive_intvl + self.net_ipv4_tcp_tw_reuse = net_ipv4_tcp_tw_reuse + self.net_ipv4_ip_local_port_range = net_ipv4_ip_local_port_range + self.net_ipv4_neigh_default_gc_thresh1 = net_ipv4_neigh_default_gc_thresh1 + self.net_ipv4_neigh_default_gc_thresh2 = net_ipv4_neigh_default_gc_thresh2 + self.net_ipv4_neigh_default_gc_thresh3 = net_ipv4_neigh_default_gc_thresh3 + self.net_netfilter_nf_conntrack_max = net_netfilter_nf_conntrack_max + self.net_netfilter_nf_conntrack_buckets = net_netfilter_nf_conntrack_buckets + self.fs_inotify_max_user_watches = fs_inotify_max_user_watches + self.fs_file_max = fs_file_max + self.fs_aio_max_nr = fs_aio_max_nr + self.fs_nr_open = fs_nr_open + self.kernel_threads_max = kernel_threads_max + self.vm_max_map_count = vm_max_map_count + self.vm_swappiness = vm_swappiness + self.vm_vfs_cache_pressure = vm_vfs_cache_pressure + + +class SystemData(msrest.serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", "Key". + :vartype created_by_type: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", "Key". + :vartype last_modified_by_type: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, + **kwargs + ): + """ + :keyword created_by: The identity that created the resource. + :paramtype created_by: str + :keyword created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", "Key". + :paramtype created_by_type: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.CreatedByType + :keyword created_at: The timestamp of resource creation (UTC). + :paramtype created_at: ~datetime.datetime + :keyword last_modified_by: The identity that last modified the resource. + :paramtype last_modified_by: str + :keyword last_modified_by_type: The type of identity that last modified the resource. Known + values are: "User", "Application", "ManagedIdentity", "Key". + :paramtype last_modified_by_type: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.CreatedByType + :keyword last_modified_at: The timestamp of resource last modification (UTC). + :paramtype last_modified_at: ~datetime.datetime + """ + super(SystemData, self).__init__(**kwargs) + self.created_by = created_by + self.created_by_type = created_by_type + self.created_at = created_at + self.last_modified_by = last_modified_by + self.last_modified_by_type = last_modified_by_type + self.last_modified_at = last_modified_at + + +class TagsObject(msrest.serialization.Model): + """Tags object for patch operations. + + :ivar tags: A set of 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 + ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ + super(TagsObject, self).__init__(**kwargs) + self.tags = tags + + +class TimeInWeek(msrest.serialization.Model): + """Time in a week. + + :ivar day: The day of the week. Known values are: "Sunday", "Monday", "Tuesday", "Wednesday", + "Thursday", "Friday", "Saturday". + :vartype day: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.WeekDay + :ivar hour_slots: Each integer hour represents a time range beginning at 0m after the hour + ending at the next hour (non-inclusive). 0 corresponds to 00:00 UTC, 23 corresponds to 23:00 + UTC. Specifying [0, 1] means the 00:00 - 02:00 UTC time range. + :vartype hour_slots: list[int] + """ + + _attribute_map = { + 'day': {'key': 'day', 'type': 'str'}, + 'hour_slots': {'key': 'hourSlots', 'type': '[int]'}, + } + + def __init__( + self, + *, + day: Optional[Union[str, "_models.WeekDay"]] = None, + hour_slots: Optional[List[int]] = None, + **kwargs + ): + """ + :keyword day: The day of the week. Known values are: "Sunday", "Monday", "Tuesday", + "Wednesday", "Thursday", "Friday", "Saturday". + :paramtype day: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.WeekDay + :keyword hour_slots: Each integer hour represents a time range beginning at 0m after the hour + ending at the next hour (non-inclusive). 0 corresponds to 00:00 UTC, 23 corresponds to 23:00 + UTC. Specifying [0, 1] means the 00:00 - 02:00 UTC time range. + :paramtype hour_slots: list[int] + """ + super(TimeInWeek, self).__init__(**kwargs) + self.day = day + self.hour_slots = hour_slots + + +class TimeSpan(msrest.serialization.Model): + """For example, between 2021-05-25T13:00:00Z and 2021-05-25T14:00:00Z. + + :ivar start: The start of a time span. + :vartype start: ~datetime.datetime + :ivar end: The end of a time span. + :vartype end: ~datetime.datetime + """ + + _attribute_map = { + 'start': {'key': 'start', 'type': 'iso-8601'}, + 'end': {'key': 'end', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + start: Optional[datetime.datetime] = None, + end: Optional[datetime.datetime] = None, + **kwargs + ): + """ + :keyword start: The start of a time span. + :paramtype start: ~datetime.datetime + :keyword end: The end of a time span. + :paramtype end: ~datetime.datetime + """ + super(TimeSpan, self).__init__(**kwargs) + self.start = start + self.end = end + + +class TrustedAccessRole(msrest.serialization.Model): + """Trusted access role definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar source_resource_type: Resource type of Azure resource. + :vartype source_resource_type: str + :ivar name: Name of role, name is unique under a source resource type. + :vartype name: str + :ivar rules: List of rules for the role. This maps to 'rules' property of `Kubernetes Cluster + Role + `_. + :vartype rules: + list[~azure.mgmt.containerservice.v2022_06_02_preview.models.TrustedAccessRoleRule] + """ + + _validation = { + 'source_resource_type': {'readonly': True}, + 'name': {'readonly': True}, + 'rules': {'readonly': True}, + } + + _attribute_map = { + 'source_resource_type': {'key': 'sourceResourceType', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'rules': {'key': 'rules', 'type': '[TrustedAccessRoleRule]'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(TrustedAccessRole, self).__init__(**kwargs) + self.source_resource_type = None + self.name = None + self.rules = None + + +class TrustedAccessRoleBinding(Resource): + """Defines binding between a resource and role. + + 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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.containerservice.v2022_06_02_preview.models.SystemData + :ivar provisioning_state: The current provisioning state of trusted access role binding. Known + values are: "Succeeded", "Failed", "Updating", "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.containerservice.v2022_06_02_preview.models.TrustedAccessRoleBindingProvisioningState + :ivar source_resource_id: Required. The ARM resource ID of source resource that trusted access + is configured for. + :vartype source_resource_id: str + :ivar roles: Required. A list of roles to bind, each item is a resource type qualified role + name. For example: 'Microsoft.MachineLearningServices/workspaces/reader'. + :vartype roles: list[str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'source_resource_id': {'required': True}, + 'roles': {'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'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'source_resource_id': {'key': 'properties.sourceResourceId', 'type': 'str'}, + 'roles': {'key': 'properties.roles', 'type': '[str]'}, + } + + def __init__( + self, + *, + source_resource_id: str, + roles: List[str], + **kwargs + ): + """ + :keyword source_resource_id: Required. The ARM resource ID of source resource that trusted + access is configured for. + :paramtype source_resource_id: str + :keyword roles: Required. A list of roles to bind, each item is a resource type qualified role + name. For example: 'Microsoft.MachineLearningServices/workspaces/reader'. + :paramtype roles: list[str] + """ + super(TrustedAccessRoleBinding, self).__init__(**kwargs) + self.provisioning_state = None + self.source_resource_id = source_resource_id + self.roles = roles + + +class TrustedAccessRoleBindingListResult(msrest.serialization.Model): + """List of trusted access role bindings. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: Role binding list. + :vartype value: + list[~azure.mgmt.containerservice.v2022_06_02_preview.models.TrustedAccessRoleBinding] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[TrustedAccessRoleBinding]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["_models.TrustedAccessRoleBinding"]] = None, + **kwargs + ): + """ + :keyword value: Role binding list. + :paramtype value: + list[~azure.mgmt.containerservice.v2022_06_02_preview.models.TrustedAccessRoleBinding] + """ + super(TrustedAccessRoleBindingListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class TrustedAccessRoleListResult(msrest.serialization.Model): + """List of trusted access roles. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: Role list. + :vartype value: list[~azure.mgmt.containerservice.v2022_06_02_preview.models.TrustedAccessRole] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[TrustedAccessRole]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(TrustedAccessRoleListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class TrustedAccessRoleRule(msrest.serialization.Model): + """Rule for trusted access role. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar verbs: List of allowed verbs. + :vartype verbs: list[str] + :ivar api_groups: List of allowed apiGroups. + :vartype api_groups: list[str] + :ivar resources: List of allowed resources. + :vartype resources: list[str] + :ivar resource_names: List of allowed names. + :vartype resource_names: list[str] + :ivar non_resource_ur_ls: List of allowed nonResourceURLs. + :vartype non_resource_ur_ls: list[str] + """ + + _validation = { + 'verbs': {'readonly': True}, + 'api_groups': {'readonly': True}, + 'resources': {'readonly': True}, + 'resource_names': {'readonly': True}, + 'non_resource_ur_ls': {'readonly': True}, + } + + _attribute_map = { + 'verbs': {'key': 'verbs', 'type': '[str]'}, + 'api_groups': {'key': 'apiGroups', 'type': '[str]'}, + 'resources': {'key': 'resources', 'type': '[str]'}, + 'resource_names': {'key': 'resourceNames', 'type': '[str]'}, + 'non_resource_ur_ls': {'key': 'nonResourceURLs', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(TrustedAccessRoleRule, self).__init__(**kwargs) + self.verbs = None + self.api_groups = None + self.resources = None + self.resource_names = None + self.non_resource_ur_ls = None + + +class WindowsGmsaProfile(msrest.serialization.Model): + """Windows gMSA Profile in the managed cluster. + + :ivar enabled: Specifies whether to enable Windows gMSA in the managed cluster. + :vartype enabled: bool + :ivar dns_server: Specifies the DNS server for Windows gMSA. :code:`
`:code:`
` Set it to + empty if you have configured the DNS server in the vnet which is used to create the managed + cluster. + :vartype dns_server: str + :ivar root_domain_name: Specifies the root domain name for Windows gMSA. + :code:`
`:code:`
` Set it to empty if you have configured the DNS server in the vnet + which is used to create the managed cluster. + :vartype root_domain_name: str + """ + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'dns_server': {'key': 'dnsServer', 'type': 'str'}, + 'root_domain_name': {'key': 'rootDomainName', 'type': 'str'}, + } + + def __init__( + self, + *, + enabled: Optional[bool] = None, + dns_server: Optional[str] = None, + root_domain_name: Optional[str] = None, + **kwargs + ): + """ + :keyword enabled: Specifies whether to enable Windows gMSA in the managed cluster. + :paramtype enabled: bool + :keyword dns_server: Specifies the DNS server for Windows gMSA. :code:`
`:code:`
` Set it + to empty if you have configured the DNS server in the vnet which is used to create the managed + cluster. + :paramtype dns_server: str + :keyword root_domain_name: Specifies the root domain name for Windows gMSA. + :code:`
`:code:`
` Set it to empty if you have configured the DNS server in the vnet + which is used to create the managed cluster. + :paramtype root_domain_name: str + """ + super(WindowsGmsaProfile, self).__init__(**kwargs) + self.enabled = enabled + self.dns_server = dns_server + self.root_domain_name = root_domain_name diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/models/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/models/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/__init__.py new file mode 100644 index 000000000000..03d015afec25 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/__init__.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._operations import Operations +from ._managed_clusters_operations import ManagedClustersOperations +from ._maintenance_configurations_operations import MaintenanceConfigurationsOperations +from ._agent_pools_operations import AgentPoolsOperations +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations +from ._private_link_resources_operations import PrivateLinkResourcesOperations +from ._resolve_private_link_service_id_operations import ResolvePrivateLinkServiceIdOperations +from ._snapshots_operations import SnapshotsOperations +from ._managed_cluster_snapshots_operations import ManagedClusterSnapshotsOperations +from ._trusted_access_roles_operations import TrustedAccessRolesOperations +from ._trusted_access_role_bindings_operations import TrustedAccessRoleBindingsOperations +from ._fleets_operations import FleetsOperations +from ._fleet_members_operations import FleetMembersOperations + +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk +__all__ = [ + 'Operations', + 'ManagedClustersOperations', + 'MaintenanceConfigurationsOperations', + 'AgentPoolsOperations', + 'PrivateEndpointConnectionsOperations', + 'PrivateLinkResourcesOperations', + 'ResolvePrivateLinkServiceIdOperations', + 'SnapshotsOperations', + 'ManagedClusterSnapshotsOperations', + 'TrustedAccessRolesOperations', + 'TrustedAccessRoleBindingsOperations', + 'FleetsOperations', + 'FleetMembersOperations', +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_agent_pools_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_agent_pools_operations.py new file mode 100644 index 000000000000..ef8e1b47fbb6 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_agent_pools_operations.py @@ -0,0 +1,1057 @@ +# 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, Union, cast + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import 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 .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + resource_name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/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]$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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_request( + subscription_id: str, + resource_group_name: str, + resource_name: 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/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), + "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]$'), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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_initial( + subscription_id: str, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + *, + json: Optional[_models.AgentPool] = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/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), + "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]$'), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + *, + ignore_pod_disruption_budget: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/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), + "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]$'), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if ignore_pod_disruption_budget is not None: + _params['ignore-pod-disruption-budget'] = _SERIALIZER.query("ignore_pod_disruption_budget", ignore_pod_disruption_budget, 'bool') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_get_upgrade_profile_request( + subscription_id: str, + resource_group_name: str, + resource_name: 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/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]$'), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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_available_agent_pool_versions_request( + subscription_id: str, + resource_group_name: str, + resource_name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions") # 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 = _format_url_section(_url, **path_format_arguments) + + # 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_request_initial( + subscription_id: str, + resource_group_name: str, + resource_name: 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion") # 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]$'), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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 AgentPoolsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_06_02_preview.ContainerServiceClient`'s + :attr:`agent_pools` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + + @distributed_trace + def list( + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> Iterable[_models.AgentPoolListResult]: + """Gets a list of agent pools in the specified managed cluster. + + Gets a list of agent pools in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AgentPoolListResult or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_06_02_preview.models.AgentPoolListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + 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) # type: ignore + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + api_version=api_version, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("AgentPoolListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools"} # type: ignore + + @distributed_trace + def get( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + **kwargs: Any + ) -> _models.AgentPool: + """Gets the specified managed cluster agent pool. + + Gets the specified managed cluster agent pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. + :type agent_pool_name: 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.containerservice.v2022_06_02_preview.models.AgentPool + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + agent_pool_name=agent_pool_name, + 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) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AgentPool', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + + + def _create_or_update_initial( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: _models.AgentPool, + **kwargs: Any + ) -> _models.AgentPool: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + + _json = self._serialize.body(parameters, 'AgentPool') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + agent_pool_name=agent_pool_name, + api_version=api_version, + content_type=content_type, + json=_json, + 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) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('AgentPool', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('AgentPool', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + parameters: _models.AgentPool, + **kwargs: Any + ) -> LROPoller[_models.AgentPool]: + """Creates or updates an agent pool in the specified managed cluster. + + Creates or updates an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. + :type agent_pool_name: str + :param parameters: The agent pool to create or update. + :type parameters: ~azure.mgmt.containerservice.v2022_06_02_preview.models.AgentPool + :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 AgentPool or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_06_02_preview.models.AgentPool] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + agent_pool_name=agent_pool_name, + parameters=parameters, + 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('AgentPool', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + 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) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + ignore_pod_disruption_budget: Optional[bool] = None, + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + agent_pool_name=agent_pool_name, + api_version=api_version, + ignore_pod_disruption_budget=ignore_pod_disruption_budget, + template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + ignore_pod_disruption_budget: Optional[bool] = None, + **kwargs: Any + ) -> LROPoller[None]: + """Deletes an agent pool in the specified managed cluster. + + Deletes an agent pool in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. + :type agent_pool_name: str + :param ignore_pod_disruption_budget: ignore-pod-disruption-budget=true to delete those pods on + a node without considering Pod Disruption Budget. Default value is None. + :type ignore_pod_disruption_budget: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + agent_pool_name=agent_pool_name, + ignore_pod_disruption_budget=ignore_pod_disruption_budget, + 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): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + 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) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"} # type: ignore + + @distributed_trace + def get_upgrade_profile( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + **kwargs: Any + ) -> _models.AgentPoolUpgradeProfile: + """Gets the upgrade profile for an agent pool. + + Gets the upgrade profile for an agent pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. + :type agent_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AgentPoolUpgradeProfile, or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.AgentPoolUpgradeProfile + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolUpgradeProfile] + + + request = build_get_upgrade_profile_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + agent_pool_name=agent_pool_name, + 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) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AgentPoolUpgradeProfile', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"} # type: ignore + + + @distributed_trace + def get_available_agent_pool_versions( + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> _models.AgentPoolAvailableVersions: + """Gets a list of supported Kubernetes versions for the specified agent pool. + + See `supported Kubernetes versions + `_ for more details about + the version lifecycle. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AgentPoolAvailableVersions, or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.AgentPoolAvailableVersions + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPoolAvailableVersions] + + + request = build_get_available_agent_pool_versions_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + api_version=api_version, + template_url=self.get_available_agent_pool_versions.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AgentPoolAvailableVersions', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_available_agent_pool_versions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions"} # type: ignore + + + def _upgrade_node_image_version_initial( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + **kwargs: Any + ) -> Optional[_models.AgentPool]: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AgentPool]] + + + request = build_upgrade_node_image_version_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + agent_pool_name=agent_pool_name, + api_version=api_version, + template_url=self._upgrade_node_image_version_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 202: + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + + deserialized = self._deserialize('AgentPool', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _upgrade_node_image_version_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore + + + @distributed_trace + def begin_upgrade_node_image_version( + self, + resource_group_name: str, + resource_name: str, + agent_pool_name: str, + **kwargs: Any + ) -> LROPoller[_models.AgentPool]: + """Upgrades the node image version of an agent pool to the latest. + + Upgrading the node image version of an agent pool applies the newest OS and runtime updates to + the nodes. AKS provides one new image per week with the latest updates. For more details on + node image versions, see: https://docs.microsoft.com/azure/aks/node-image-upgrade. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :type resource_name: str + :param agent_pool_name: The name of the agent pool. + :type agent_pool_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 AgentPool or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_06_02_preview.models.AgentPool] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentPool] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._upgrade_node_image_version_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + 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): + response_headers = {} + response = pipeline_response.http_response + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + + deserialized = self._deserialize('AgentPool', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, response_headers) + return deserialized + + + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + 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) + + begin_upgrade_node_image_version.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_fleet_members_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_fleet_members_operations.py new file mode 100644 index 000000000000..3dc0f381cfe9 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_fleet_members_operations.py @@ -0,0 +1,685 @@ +# 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, Union, cast + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import 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 .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + fleet_name: str, + fleet_member_name: str, + *, + json: Optional[_models.FleetMember] = None, + content: Any = None, + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}") # 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), + "fleetName": _SERIALIZER.url("fleet_name", fleet_name, 'str', max_length=63, min_length=1, pattern=r'^[a-z0-9]([-a-z0-9]*[a-z0-9])?$'), + "fleetMemberName": _SERIALIZER.url("fleet_member_name", fleet_member_name, 'str', max_length=50, min_length=1, pattern=r'^[a-z0-9]([-a-z0-9]*[a-z0-9])?$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + if if_match is not None: + _headers['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if if_none_match is not None: + _headers['If-None-Match'] = _SERIALIZER.header("if_none_match", if_none_match, 'str') + 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, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + fleet_name: str, + fleet_member_name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}") # 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), + "fleetName": _SERIALIZER.url("fleet_name", fleet_name, 'str', max_length=63, min_length=1, pattern=r'^[a-z0-9]([-a-z0-9]*[a-z0-9])?$'), + "fleetMemberName": _SERIALIZER.url("fleet_member_name", fleet_member_name, 'str', max_length=50, min_length=1, pattern=r'^[a-z0-9]([-a-z0-9]*[a-z0-9])?$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + fleet_name: str, + fleet_member_name: str, + *, + if_match: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}") # 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), + "fleetName": _SERIALIZER.url("fleet_name", fleet_name, 'str', max_length=63, min_length=1, pattern=r'^[a-z0-9]([-a-z0-9]*[a-z0-9])?$'), + "fleetMemberName": _SERIALIZER.url("fleet_member_name", fleet_member_name, 'str', max_length=50, min_length=1, pattern=r'^[a-z0-9]([-a-z0-9]*[a-z0-9])?$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + if if_match is not None: + _headers['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_list_by_fleet_request( + subscription_id: str, + resource_group_name: str, + fleet_name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members") # 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), + "fleetName": _SERIALIZER.url("fleet_name", fleet_name, 'str', max_length=63, min_length=1, pattern=r'^[a-z0-9]([-a-z0-9]*[a-z0-9])?$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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 FleetMembersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_06_02_preview.ContainerServiceClient`'s + :attr:`fleet_members` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + + def _create_or_update_initial( + self, + resource_group_name: str, + fleet_name: str, + fleet_member_name: str, + parameters: _models.FleetMember, + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + **kwargs: Any + ) -> _models.FleetMember: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.FleetMember] + + _json = self._serialize.body(parameters, 'FleetMember') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + fleet_name=fleet_name, + fleet_member_name=fleet_member_name, + api_version=api_version, + content_type=content_type, + json=_json, + if_match=if_match, + if_none_match=if_none_match, + 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) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('FleetMember', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}"} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + fleet_name: str, + fleet_member_name: str, + parameters: _models.FleetMember, + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + **kwargs: Any + ) -> LROPoller[_models.FleetMember]: + """Creates or updates a fleet member. + + A member contains a reference to an existing Kubernetes cluster. Creating a member makes the + referenced cluster join the Fleet. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. + :type fleet_name: str + :param fleet_member_name: The name of the Fleet member resource. + :type fleet_member_name: str + :param parameters: The Fleet member to create or update. + :type parameters: ~azure.mgmt.containerservice.v2022_06_02_preview.models.FleetMember + :param if_match: Omit this value to always overwrite the current resource. Specify the + last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is + None. + :type if_match: str + :param if_none_match: Set to '*' to allow a new resource to be created and prevent updating an + existing resource. Other values will result in a 412 Pre-condition Failed response. Default + value is None. + :type if_none_match: 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 FleetMember or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_06_02_preview.models.FleetMember] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.FleetMember] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( # type: ignore + resource_group_name=resource_group_name, + fleet_name=fleet_name, + fleet_member_name=fleet_member_name, + parameters=parameters, + if_match=if_match, + if_none_match=if_none_match, + 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('FleetMember', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + 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) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}"} # type: ignore + + @distributed_trace + def get( + self, + resource_group_name: str, + fleet_name: str, + fleet_member_name: str, + **kwargs: Any + ) -> _models.FleetMember: + """Gets a Fleet member. + + Gets a Fleet member. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. + :type fleet_name: str + :param fleet_member_name: The name of the Fleet member resource. + :type fleet_member_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FleetMember, or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.FleetMember + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.FleetMember] + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + fleet_name=fleet_name, + fleet_member_name=fleet_member_name, + 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) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # 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('FleetMember', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}"} # type: ignore + + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + fleet_name: str, + fleet_member_name: str, + if_match: Optional[str] = None, + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + fleet_name=fleet_name, + fleet_member_name=fleet_member_name, + api_version=api_version, + if_match=if_match, + template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}"} # type: ignore + + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + fleet_name: str, + fleet_member_name: str, + if_match: Optional[str] = None, + **kwargs: Any + ) -> LROPoller[None]: + """Deletes a fleet member. + + Deleting a Fleet member results in the member cluster leaving fleet. The Member azure resource + is deleted upon success. The underlying cluster is not deleted. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. + :type fleet_name: str + :param fleet_member_name: The name of the Fleet member resource. + :type fleet_member_name: str + :param if_match: Omit this value to always overwrite the current resource. Specify the + last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is + None. + :type if_match: 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + fleet_name=fleet_name, + fleet_member_name=fleet_member_name, + if_match=if_match, + 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): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + 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) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}"} # type: ignore + + @distributed_trace + def list_by_fleet( + self, + resource_group_name: str, + fleet_name: str, + **kwargs: Any + ) -> Iterable[_models.FleetMembersListResult]: + """Lists the members of a fleet. + + Lists the members of a fleet. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. + :type fleet_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either FleetMembersListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_06_02_preview.models.FleetMembersListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.FleetMembersListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_fleet_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + fleet_name=fleet_name, + api_version=api_version, + template_url=self.list_by_fleet.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + + request = build_list_by_fleet_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + fleet_name=fleet_name, + api_version=api_version, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("FleetMembersListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # 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_fleet.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_fleets_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_fleets_operations.py new file mode 100644 index 000000000000..6b0c74546d3f --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_fleets_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 typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import 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 .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + fleet_name: str, + *, + json: Optional[_models.Fleet] = None, + content: Any = None, + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}") # 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), + "fleetName": _SERIALIZER.url("fleet_name", fleet_name, 'str', max_length=63, min_length=1, pattern=r'^[a-z0-9]([-a-z0-9]*[a-z0-9])?$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + if if_match is not None: + _headers['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if if_none_match is not None: + _headers['If-None-Match'] = _SERIALIZER.header("if_none_match", if_none_match, 'str') + 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, + json=json, + content=content, + **kwargs + ) + + +def build_update_request( + subscription_id: str, + resource_group_name: str, + fleet_name: str, + *, + json: Optional[_models.FleetPatch] = None, + content: Any = None, + if_match: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}") # 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), + "fleetName": _SERIALIZER.url("fleet_name", fleet_name, 'str', max_length=63, min_length=1, pattern=r'^[a-z0-9]([-a-z0-9]*[a-z0-9])?$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + if if_match is not None: + _headers['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + 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, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + fleet_name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}") # 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), + "fleetName": _SERIALIZER.url("fleet_name", fleet_name, 'str', max_length=63, min_length=1, pattern=r'^[a-z0-9]([-a-z0-9]*[a-z0-9])?$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + fleet_name: str, + *, + if_match: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}") # 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), + "fleetName": _SERIALIZER.url("fleet_name", fleet_name, 'str', max_length=63, min_length=1, pattern=r'^[a-z0-9]([-a-z0-9]*[a-z0-9])?$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + if if_match is not None: + _headers['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets") # 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 = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/fleets") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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_credentials_request( + subscription_id: str, + resource_group_name: str, + fleet_name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/listCredentials") # 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), + "fleetName": _SERIALIZER.url("fleet_name", fleet_name, 'str', max_length=63, min_length=1, pattern=r'^[a-z0-9]([-a-z0-9]*[a-z0-9])?$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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 FleetsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_06_02_preview.ContainerServiceClient`'s + :attr:`fleets` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + + def _create_or_update_initial( + self, + resource_group_name: str, + fleet_name: str, + parameters: _models.Fleet, + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + **kwargs: Any + ) -> _models.Fleet: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Fleet] + + _json = self._serialize.body(parameters, 'Fleet') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + fleet_name=fleet_name, + api_version=api_version, + content_type=content_type, + json=_json, + if_match=if_match, + if_none_match=if_none_match, + 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) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Fleet', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Fleet', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}"} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + fleet_name: str, + parameters: _models.Fleet, + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + **kwargs: Any + ) -> LROPoller[_models.Fleet]: + """Creates or updates a Fleet. + + Creates or updates a Fleet. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. + :type fleet_name: str + :param parameters: The Fleet to create or update. + :type parameters: ~azure.mgmt.containerservice.v2022_06_02_preview.models.Fleet + :param if_match: Omit this value to always overwrite the current resource. Specify the + last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is + None. + :type if_match: str + :param if_none_match: Set to '*' to allow a new resource to be created and prevent updating an + existing resource. Other values will result in a 412 Pre-condition Failed response. Default + value is None. + :type if_none_match: 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 Fleet or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_06_02_preview.models.Fleet] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Fleet] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( # type: ignore + resource_group_name=resource_group_name, + fleet_name=fleet_name, + parameters=parameters, + if_match=if_match, + if_none_match=if_none_match, + 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('Fleet', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + 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) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}"} # type: ignore + + @distributed_trace + def update( + self, + resource_group_name: str, + fleet_name: str, + if_match: Optional[str] = None, + parameters: Optional[_models.FleetPatch] = None, + **kwargs: Any + ) -> _models.Fleet: + """Patches a fleet resource. + + Patches a fleet resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. + :type fleet_name: str + :param if_match: Omit this value to always overwrite the current resource. Specify the + last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is + None. + :type if_match: str + :param parameters: The properties of a Fleet to update. Default value is None. + :type parameters: ~azure.mgmt.containerservice.v2022_06_02_preview.models.FleetPatch + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Fleet, or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.Fleet + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Fleet] + + if parameters is not None: + _json = self._serialize.body(parameters, 'FleetPatch') + else: + _json = None + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + fleet_name=fleet_name, + api_version=api_version, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self.update.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # 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('Fleet', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}"} # type: ignore + + + @distributed_trace + def get( + self, + resource_group_name: str, + fleet_name: str, + **kwargs: Any + ) -> _models.Fleet: + """Gets a Fleet. + + Gets a Fleet. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. + :type fleet_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Fleet, or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.Fleet + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Fleet] + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + fleet_name=fleet_name, + 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) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # 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('Fleet', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}"} # type: ignore + + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + fleet_name: str, + if_match: Optional[str] = None, + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + fleet_name=fleet_name, + api_version=api_version, + if_match=if_match, + template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}"} # type: ignore + + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + fleet_name: str, + if_match: Optional[str] = None, + **kwargs: Any + ) -> LROPoller[None]: + """Deletes a Fleet. + + Deletes a Fleet. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. + :type fleet_name: str + :param if_match: Omit this value to always overwrite the current resource. Specify the + last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is + None. + :type if_match: 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + fleet_name=fleet_name, + if_match=if_match, + 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): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + 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) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}"} # type: ignore + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> Iterable[_models.FleetListResult]: + """Lists fleets in the specified subscription and resource group. + + Lists fleets in the specified subscription and resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either FleetListResult or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_06_02_preview.models.FleetListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.FleetListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + 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) # type: ignore + + else: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("FleetListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # 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.ContainerService/fleets"} # type: ignore + + @distributed_trace + def list( + self, + **kwargs: Any + ) -> Iterable[_models.FleetListResult]: + """Lists fleets in the specified subscription. + + Lists fleets in the specified subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either FleetListResult or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_06_02_preview.models.FleetListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.FleetListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("FleetListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # 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.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/fleets"} # type: ignore + + @distributed_trace + def list_credentials( + self, + resource_group_name: str, + fleet_name: str, + **kwargs: Any + ) -> _models.FleetCredentialResults: + """Lists the user credentials of a Fleet. + + Lists the user credentials of a Fleet. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param fleet_name: The name of the Fleet resource. + :type fleet_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FleetCredentialResults, or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.FleetCredentialResults + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.FleetCredentialResults] + + + request = build_list_credentials_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + fleet_name=fleet_name, + api_version=api_version, + template_url=self.list_credentials.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # 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('FleetCredentialResults', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/listCredentials"} # type: ignore + diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_maintenance_configurations_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_maintenance_configurations_operations.py new file mode 100644 index 000000000000..20b258720ca5 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_maintenance_configurations_operations.py @@ -0,0 +1,512 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import 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 .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_managed_cluster_request( + subscription_id: str, + resource_group_name: str, + resource_name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations") # 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 = _format_url_section(_url, **path_format_arguments) + + # 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_request( + subscription_id: str, + resource_group_name: str, + resource_name: str, + config_name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # 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]$'), + "configName": _SERIALIZER.url("config_name", config_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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( + subscription_id: str, + resource_group_name: str, + resource_name: str, + config_name: str, + *, + json: Optional[_models.MaintenanceConfiguration] = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # 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]$'), + "configName": _SERIALIZER.url("config_name", config_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + subscription_id: str, + resource_group_name: str, + resource_name: str, + config_name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}") # 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]$'), + "configName": _SERIALIZER.url("config_name", config_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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 MaintenanceConfigurationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_06_02_preview.ContainerServiceClient`'s + :attr:`maintenance_configurations` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + + @distributed_trace + def list_by_managed_cluster( + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> Iterable[_models.MaintenanceConfigurationListResult]: + """Gets a list of maintenance configurations in the specified managed cluster. + + Gets a list of maintenance configurations in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either MaintenanceConfigurationListResult or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_06_02_preview.models.MaintenanceConfigurationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfigurationListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_managed_cluster_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + api_version=api_version, + template_url=self.list_by_managed_cluster.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + + request = build_list_by_managed_cluster_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + api_version=api_version, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("MaintenanceConfigurationListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_managed_cluster.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations"} # type: ignore + + @distributed_trace + def get( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Gets the specified maintenance configuration of a managed cluster. + + Gets the specified maintenance configuration of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :type resource_name: str + :param config_name: The name of the maintenance configuration. + :type config_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration, or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.MaintenanceConfiguration + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + config_name=config_name, + 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) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore + + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + config_name: str, + parameters: _models.MaintenanceConfiguration, + **kwargs: Any + ) -> _models.MaintenanceConfiguration: + """Creates or updates a maintenance configuration in the specified managed cluster. + + Creates or updates a maintenance configuration in the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :type resource_name: str + :param config_name: The name of the maintenance configuration. + :type config_name: str + :param parameters: The maintenance configuration to create or update. + :type parameters: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.MaintenanceConfiguration + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MaintenanceConfiguration, or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.MaintenanceConfiguration + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.MaintenanceConfiguration] + + _json = self._serialize.body(parameters, 'MaintenanceConfiguration') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + config_name=config_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('MaintenanceConfiguration', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore + + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + resource_name: str, + config_name: str, + **kwargs: Any + ) -> None: + """Deletes a maintenance configuration. + + Deletes a maintenance configuration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :type resource_name: str + :param config_name: The name of the maintenance configuration. + :type config_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 + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + config_name=config_name, + 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) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"} # type: ignore + diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_managed_cluster_snapshots_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_managed_cluster_snapshots_operations.py new file mode 100644 index 000000000000..ea57e68973d1 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_managed_cluster_snapshots_operations.py @@ -0,0 +1,723 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import 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 .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedclustersnapshots") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots") # 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 = _format_url_section(_url, **path_format_arguments) + + # 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_request( + subscription_id: str, + resource_group_name: str, + resource_name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{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 = _format_url_section(_url, **path_format_arguments) + + # 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( + subscription_id: str, + resource_group_name: str, + resource_name: str, + *, + json: Optional[_models.ManagedClusterSnapshot] = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{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 = _format_url_section(_url, **path_format_arguments) + + # 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, + json=json, + content=content, + **kwargs + ) + + +def build_update_tags_request( + subscription_id: str, + resource_group_name: str, + resource_name: str, + *, + json: Optional[_models.TagsObject] = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{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 = _format_url_section(_url, **path_format_arguments) + + # 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, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + subscription_id: str, + resource_group_name: str, + resource_name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{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 = _format_url_section(_url, **path_format_arguments) + + # 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 ManagedClusterSnapshotsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_06_02_preview.ContainerServiceClient`'s + :attr:`managed_cluster_snapshots` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + + @distributed_trace + def list( + self, + **kwargs: Any + ) -> Iterable[_models.ManagedClusterSnapshotListResult]: + """Gets a list of managed cluster snapshots in the specified subscription. + + Gets a list of managed cluster snapshots in the specified subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ManagedClusterSnapshotListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterSnapshotListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshotListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ManagedClusterSnapshotListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedclustersnapshots"} # type: ignore + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> Iterable[_models.ManagedClusterSnapshotListResult]: + """Lists managed cluster snapshots in the specified subscription and resource group. + + Lists managed cluster snapshots in the specified subscription and resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ManagedClusterSnapshotListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterSnapshotListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshotListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + 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) # type: ignore + + else: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ManagedClusterSnapshotListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots"} # type: ignore + + @distributed_trace + def get( + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> _models.ManagedClusterSnapshot: + """Gets a managed cluster snapshot. + + Gets a managed cluster snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedClusterSnapshot, or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterSnapshot + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshot] + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + 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) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ManagedClusterSnapshot', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore + + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.ManagedClusterSnapshot, + **kwargs: Any + ) -> _models.ManagedClusterSnapshot: + """Creates or updates a managed cluster snapshot. + + Creates or updates a managed cluster snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :type resource_name: str + :param parameters: The managed cluster snapshot to create or update. + :type parameters: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterSnapshot + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedClusterSnapshot, or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterSnapshot + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshot] + + _json = self._serialize.body(parameters, 'ManagedClusterSnapshot') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ManagedClusterSnapshot', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ManagedClusterSnapshot', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore + + + @distributed_trace + def update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.TagsObject, + **kwargs: Any + ) -> _models.ManagedClusterSnapshot: + """Updates tags on a managed cluster snapshot. + + Updates tags on a managed cluster snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :type resource_name: str + :param parameters: Parameters supplied to the Update managed cluster snapshot Tags operation. + :type parameters: ~azure.mgmt.containerservice.v2022_06_02_preview.models.TagsObject + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedClusterSnapshot, or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterSnapshot + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterSnapshot] + + _json = self._serialize.body(parameters, 'TagsObject') + + request = build_update_tags_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update_tags.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ManagedClusterSnapshot', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore + + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> None: + """Deletes a managed cluster snapshot. + + Deletes a managed cluster snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :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 + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + 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) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}"} # type: ignore + diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_managed_clusters_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_managed_clusters_operations.py new file mode 100644 index 000000000000..93aea8423789 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_managed_clusters_operations.py @@ -0,0 +1,3023 @@ +# 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, Union, cast + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import 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 .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_os_options_request( + subscription_id: str, + location: str, + *, + resource_type: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "location": _SERIALIZER.url("location", location, 'str', min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if resource_type is not None: + _params['resource-type'] = _SERIALIZER.query("resource_type", resource_type, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters") # 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 = _format_url_section(_url, **path_format_arguments) + + # 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( + subscription_id: str, + resource_group_name: str, + resource_name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{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 = _format_url_section(_url, **path_format_arguments) + + # 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_access_profile_request( + subscription_id: str, + resource_group_name: str, + resource_name: str, + role_name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential") # 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]$'), + "roleName": _SERIALIZER.url("role_name", role_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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_cluster_admin_credentials_request( + subscription_id: str, + resource_group_name: str, + resource_name: str, + *, + server_fqdn: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential") # 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 = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if server_fqdn is not None: + _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_list_cluster_user_credentials_request( + subscription_id: str, + resource_group_name: str, + resource_name: str, + *, + server_fqdn: Optional[str] = None, + format: Optional[Union[str, "_models.Format"]] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential") # 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 = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if server_fqdn is not None: + _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + if format is not None: + _params['format'] = _SERIALIZER.query("format", format, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_list_cluster_monitoring_user_credentials_request( + subscription_id: str, + resource_group_name: str, + resource_name: str, + *, + server_fqdn: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential") # 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 = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if server_fqdn is not None: + _params['server-fqdn'] = _SERIALIZER.query("server_fqdn", server_fqdn, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + resource_name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{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 = _format_url_section(_url, **path_format_arguments) + + # 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_initial( + subscription_id: str, + resource_group_name: str, + resource_name: str, + *, + json: Optional[_models.ManagedCluster] = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{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 = _format_url_section(_url, **path_format_arguments) + + # 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, + json=json, + content=content, + **kwargs + ) + + +def build_update_tags_request_initial( + subscription_id: str, + resource_group_name: str, + resource_name: str, + *, + json: Optional[_models.TagsObject] = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{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 = _format_url_section(_url, **path_format_arguments) + + # 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, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + resource_name: str, + *, + ignore_pod_disruption_budget: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{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 = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if ignore_pod_disruption_budget is not None: + _params['ignore-pod-disruption-budget'] = _SERIALIZER.query("ignore_pod_disruption_budget", ignore_pod_disruption_budget, 'bool') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_reset_service_principal_profile_request_initial( + subscription_id: str, + resource_group_name: str, + resource_name: str, + *, + json: Optional[_models.ManagedClusterServicePrincipalProfile] = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile") # 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 = _format_url_section(_url, **path_format_arguments) + + # 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="POST", + url=_url, + params=_params, + headers=_headers, + json=json, + content=content, + **kwargs + ) + + +def build_reset_aad_profile_request_initial( + subscription_id: str, + resource_group_name: str, + resource_name: str, + *, + json: Optional[_models.ManagedClusterAADProfile] = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile") # 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 = _format_url_section(_url, **path_format_arguments) + + # 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="POST", + url=_url, + params=_params, + headers=_headers, + json=json, + content=content, + **kwargs + ) + + +def build_rotate_cluster_certificates_request_initial( + subscription_id: str, + resource_group_name: str, + resource_name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates") # 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 = _format_url_section(_url, **path_format_arguments) + + # 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_rotate_service_account_signing_keys_request_initial( + subscription_id: str, + resource_group_name: str, + resource_name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateServiceAccountSigningKeys") # 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 = _format_url_section(_url, **path_format_arguments) + + # 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_stop_request_initial( + subscription_id: str, + resource_group_name: str, + resource_name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop") # 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 = _format_url_section(_url, **path_format_arguments) + + # 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_start_request_initial( + subscription_id: str, + resource_group_name: str, + resource_name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start") # 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 = _format_url_section(_url, **path_format_arguments) + + # 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_run_command_request_initial( + subscription_id: str, + resource_group_name: str, + resource_name: str, + *, + json: Optional[_models.RunCommandRequest] = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand") # 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 = _format_url_section(_url, **path_format_arguments) + + # 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="POST", + url=_url, + params=_params, + headers=_headers, + json=json, + content=content, + **kwargs + ) + + +def build_get_command_result_request( + subscription_id: str, + resource_group_name: str, + resource_name: str, + command_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}") # 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]$'), + "commandId": _SERIALIZER.url("command_id", command_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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_outbound_network_dependencies_endpoints_request( + subscription_id: str, + resource_group_name: str, + resource_name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints") # 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 = _format_url_section(_url, **path_format_arguments) + + # 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 ManagedClustersOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_06_02_preview.ContainerServiceClient`'s + :attr:`managed_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_os_options( + self, + location: str, + resource_type: Optional[str] = None, + **kwargs: Any + ) -> _models.OSOptionProfile: + """Gets supported OS options in the specified subscription. + + Gets supported OS options in the specified subscription. + + :param location: The name of Azure region. + :type location: str + :param resource_type: The resource type for which the OS options needs to be returned. Default + value is None. + :type resource_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: OSOptionProfile, or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.OSOptionProfile + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OSOptionProfile] + + + request = build_get_os_options_request( + subscription_id=self._config.subscription_id, + location=location, + api_version=api_version, + resource_type=resource_type, + template_url=self.get_os_options.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('OSOptionProfile', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_os_options.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default"} # type: ignore + + + @distributed_trace + def list( + self, + **kwargs: Any + ) -> Iterable[_models.ManagedClusterListResult]: + """Gets a list of managed clusters in the specified subscription. + + Gets a list of managed clusters in the specified subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ManagedClusterListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ManagedClusterListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> Iterable[_models.ManagedClusterListResult]: + """Lists managed clusters in the specified subscription and resource group. + + Lists managed clusters in the specified subscription and resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ManagedClusterListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + 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) # type: ignore + + else: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ManagedClusterListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters"} # type: ignore + + @distributed_trace + def get_upgrade_profile( + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> _models.ManagedClusterUpgradeProfile: + """Gets the upgrade profile of a managed cluster. + + Gets the upgrade profile of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedClusterUpgradeProfile, or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterUpgradeProfile + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterUpgradeProfile] + + + request = build_get_upgrade_profile_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + 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) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ManagedClusterUpgradeProfile', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_upgrade_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default"} # type: ignore + + + @distributed_trace + def get_access_profile( + self, + resource_group_name: str, + resource_name: str, + role_name: str, + **kwargs: Any + ) -> _models.ManagedClusterAccessProfile: + """Gets an access profile of a managed cluster. + + **WARNING**\ : This API will be deprecated. Instead use `ListClusterUserCredentials + `_ or + `ListClusterAdminCredentials + `_ . + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :type resource_name: str + :param role_name: The name of the role for managed cluster accessProfile resource. + :type role_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedClusterAccessProfile, or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterAccessProfile + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedClusterAccessProfile] + + + request = build_get_access_profile_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + role_name=role_name, + api_version=api_version, + template_url=self.get_access_profile.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ManagedClusterAccessProfile', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_access_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential"} # type: ignore + + + @distributed_trace + def list_cluster_admin_credentials( + self, + resource_group_name: str, + resource_name: str, + server_fqdn: Optional[str] = None, + **kwargs: Any + ) -> _models.CredentialResults: + """Lists the admin credentials of a managed cluster. + + Lists the admin credentials of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :type resource_name: str + :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. + :type server_fqdn: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CredentialResults, or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.CredentialResults + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + + + request = build_list_cluster_admin_credentials_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + api_version=api_version, + server_fqdn=server_fqdn, + template_url=self.list_cluster_admin_credentials.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CredentialResults', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_cluster_admin_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential"} # type: ignore + + + @distributed_trace + def list_cluster_user_credentials( + self, + resource_group_name: str, + resource_name: str, + server_fqdn: Optional[str] = None, + format: Optional[Union[str, "_models.Format"]] = None, + **kwargs: Any + ) -> _models.CredentialResults: + """Lists the user credentials of a managed cluster. + + Lists the user credentials of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :type resource_name: str + :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. + :type server_fqdn: str + :param format: Only apply to AAD clusters, specifies the format of returned kubeconfig. Format + 'azure' will return azure auth-provider kubeconfig; format 'exec' will return exec format + kubeconfig, which requires kubelogin binary in the path. Default value is None. + :type format: str or ~azure.mgmt.containerservice.v2022_06_02_preview.models.Format + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CredentialResults, or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.CredentialResults + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + + + request = build_list_cluster_user_credentials_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + api_version=api_version, + server_fqdn=server_fqdn, + format=format, + template_url=self.list_cluster_user_credentials.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CredentialResults', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_cluster_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential"} # type: ignore + + + @distributed_trace + def list_cluster_monitoring_user_credentials( + self, + resource_group_name: str, + resource_name: str, + server_fqdn: Optional[str] = None, + **kwargs: Any + ) -> _models.CredentialResults: + """Lists the cluster monitoring user credentials of a managed cluster. + + Lists the cluster monitoring user credentials of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :type resource_name: str + :param server_fqdn: server fqdn type for credentials to be returned. Default value is None. + :type server_fqdn: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CredentialResults, or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.CredentialResults + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialResults] + + + request = build_list_cluster_monitoring_user_credentials_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + api_version=api_version, + server_fqdn=server_fqdn, + template_url=self.list_cluster_monitoring_user_credentials.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CredentialResults', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_cluster_monitoring_user_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential"} # type: ignore + + + @distributed_trace + def get( + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> _models.ManagedCluster: + """Gets a managed cluster. + + Gets a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedCluster, or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedCluster + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + 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) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ManagedCluster', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + + + def _create_or_update_initial( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.ManagedCluster, + **kwargs: Any + ) -> _models.ManagedCluster: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + + _json = self._serialize.body(parameters, 'ManagedCluster') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + api_version=api_version, + content_type=content_type, + json=_json, + 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) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ManagedCluster', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ManagedCluster', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.ManagedCluster, + **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Creates or updates a managed cluster. + + Creates or updates a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :type resource_name: str + :param parameters: The managed cluster to create or update. + :type parameters: ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedCluster + :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 ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedCluster] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + parameters=parameters, + 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('ManagedCluster', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + 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) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + + def _update_tags_initial( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.TagsObject, + **kwargs: Any + ) -> _models.ManagedCluster: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + + _json = self._serialize.body(parameters, 'TagsObject') + + request = build_update_tags_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_tags_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ManagedCluster', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_tags_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + + + @distributed_trace + def begin_update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.TagsObject, + **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Updates tags on a managed cluster. + + Updates tags on a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :type resource_name: str + :param parameters: Parameters supplied to the Update Managed Cluster Tags operation. + :type parameters: ~azure.mgmt.containerservice.v2022_06_02_preview.models.TagsObject + :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 ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedCluster] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedCluster] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_tags_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + parameters=parameters, + 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('ManagedCluster', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + 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) + + begin_update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + resource_name: str, + ignore_pod_disruption_budget: Optional[bool] = None, + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + api_version=api_version, + ignore_pod_disruption_budget=ignore_pod_disruption_budget, + template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + resource_name: str, + ignore_pod_disruption_budget: Optional[bool] = None, + **kwargs: Any + ) -> LROPoller[None]: + """Deletes a managed cluster. + + Deletes a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :type resource_name: str + :param ignore_pod_disruption_budget: ignore-pod-disruption-budget=true to delete those pods on + a node without considering Pod Disruption Budget. Default value is None. + :type ignore_pod_disruption_budget: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + ignore_pod_disruption_budget=ignore_pod_disruption_budget, + 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): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + 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) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}"} # type: ignore + + def _reset_service_principal_profile_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + resource_name: str, + parameters: _models.ManagedClusterServicePrincipalProfile, + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] + + _json = self._serialize.body(parameters, 'ManagedClusterServicePrincipalProfile') + + request = build_reset_service_principal_profile_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._reset_service_principal_profile_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _reset_service_principal_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + + + @distributed_trace + def begin_reset_service_principal_profile( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + resource_name: str, + parameters: _models.ManagedClusterServicePrincipalProfile, + **kwargs: Any + ) -> LROPoller[None]: + """Reset the Service Principal Profile of a managed cluster. + + This action cannot be performed on a cluster that is not using a service principal. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :type resource_name: str + :param parameters: The service principal profile to set on the managed cluster. + :type parameters: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterServicePrincipalProfile + :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 = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._reset_service_principal_profile_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + parameters=parameters, + 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): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + 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) + + begin_reset_service_principal_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile"} # type: ignore + + def _reset_aad_profile_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + resource_name: str, + parameters: _models.ManagedClusterAADProfile, + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] + + _json = self._serialize.body(parameters, 'ManagedClusterAADProfile') + + request = build_reset_aad_profile_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._reset_aad_profile_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _reset_aad_profile_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + + + @distributed_trace + def begin_reset_aad_profile( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + resource_name: str, + parameters: _models.ManagedClusterAADProfile, + **kwargs: Any + ) -> LROPoller[None]: + """Reset the AAD Profile of a managed cluster. + + Reset the AAD Profile of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :type resource_name: str + :param parameters: The AAD profile to set on the Managed Cluster. + :type parameters: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.ManagedClusterAADProfile + :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 = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._reset_aad_profile_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + parameters=parameters, + 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): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + 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) + + begin_reset_aad_profile.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile"} # type: ignore + + def _rotate_cluster_certificates_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 + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_rotate_cluster_certificates_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + api_version=api_version, + template_url=self._rotate_cluster_certificates_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _rotate_cluster_certificates_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore + + + @distributed_trace + def begin_rotate_cluster_certificates( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Rotates the certificates of a managed cluster. + + See `Certificate rotation `_ for + more details about rotating managed cluster certificates. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._rotate_cluster_certificates_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): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + 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) + + begin_rotate_cluster_certificates.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates"} # type: ignore + + def _rotate_service_account_signing_keys_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 + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_rotate_service_account_signing_keys_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + api_version=api_version, + template_url=self._rotate_service_account_signing_keys_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _rotate_service_account_signing_keys_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateServiceAccountSigningKeys"} # type: ignore + + + @distributed_trace + def begin_rotate_service_account_signing_keys( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Rotates the service account signing keys of a managed cluster. + + Rotates the service account signing keys of a managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._rotate_service_account_signing_keys_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): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + 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) + + begin_rotate_service_account_signing_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateServiceAccountSigningKeys"} # type: ignore + + def _stop_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 + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_stop_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + api_version=api_version, + template_url=self._stop_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore + + + @distributed_trace + def begin_stop( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Stops a Managed Cluster. + + This can only be performed on Azure Virtual Machine Scale set backed clusters. Stopping a + cluster stops the control plane and agent nodes entirely, while maintaining all object and + cluster state. A cluster does not accrue charges while it is stopped. See `stopping a cluster + `_ for more details about stopping a + cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._stop_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): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + 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) + + begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop"} # type: ignore + + def _start_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 + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_start_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + api_version=api_version, + template_url=self._start_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore + + + @distributed_trace + def begin_start( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Starts a previously stopped Managed Cluster. + + See `starting a cluster `_ for more + details about starting a cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._start_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): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + 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) + + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start"} # type: ignore + + def _run_command_initial( + self, + resource_group_name: str, + resource_name: str, + request_payload: _models.RunCommandRequest, + **kwargs: Any + ) -> Optional[_models.RunCommandResult]: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] + + _json = self._serialize.body(request_payload, 'RunCommandRequest') + + request = build_run_command_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._run_command_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('RunCommandResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _run_command_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore + + + @distributed_trace + def begin_run_command( + self, + resource_group_name: str, + resource_name: str, + request_payload: _models.RunCommandRequest, + **kwargs: Any + ) -> LROPoller[_models.RunCommandResult]: + """Submits a command to run against the Managed Cluster. + + AKS will create a pod to run the command. This is primarily useful for private clusters. For + more information see `AKS Run Command + `_. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :type resource_name: str + :param request_payload: The run command request. + :type request_payload: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.RunCommandRequest + :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 RunCommandResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerservice.v2022_06_02_preview.models.RunCommandResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.RunCommandResult] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._run_command_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + request_payload=request_payload, + 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('RunCommandResult', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + 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) + + begin_run_command.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand"} # type: ignore + + @distributed_trace + def get_command_result( + self, + resource_group_name: str, + resource_name: str, + command_id: str, + **kwargs: Any + ) -> Optional[_models.RunCommandResult]: + """Gets the results of a command which has been run on the Managed Cluster. + + Gets the results of a command which has been run on the Managed Cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :type resource_name: str + :param command_id: Id of the command. + :type command_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RunCommandResult, or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.RunCommandResult or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.RunCommandResult]] + + + request = build_get_command_result_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + command_id=command_id, + api_version=api_version, + template_url=self.get_command_result.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('RunCommandResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_command_result.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}"} # type: ignore + + + @distributed_trace + def list_outbound_network_dependencies_endpoints( + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> Iterable[_models.OutboundEnvironmentEndpointCollection]: + """Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the + specified managed cluster. + + Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the + specified managed cluster. The operation returns properties of each egress endpoint. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OutboundEnvironmentEndpointCollection or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_06_02_preview.models.OutboundEnvironmentEndpointCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OutboundEnvironmentEndpointCollection] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_outbound_network_dependencies_endpoints_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + api_version=api_version, + template_url=self.list_outbound_network_dependencies_endpoints.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + + request = build_list_outbound_network_dependencies_endpoints_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + api_version=api_version, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("OutboundEnvironmentEndpointCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_outbound_network_dependencies_endpoints.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_operations.py new file mode 100644 index 000000000000..373d8ea01547 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_operations.py @@ -0,0 +1,153 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import 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 .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/providers/Microsoft.ContainerService/operations") + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_06_02_preview.ContainerServiceClient`'s + :attr:`operations` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + + @distributed_trace + def list( + self, + **kwargs: Any + ) -> Iterable[_models.OperationListResult]: + """Gets a list of operations. + + Gets a list of operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationListResult or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_06_02_preview.models.OperationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + api_version=api_version, + template_url=self.list.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + + request = build_list_request( + api_version=api_version, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("OperationListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/providers/Microsoft.ContainerService/operations"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_private_endpoint_connections_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_private_endpoint_connections_operations.py new file mode 100644 index 000000000000..d65c073c21bf --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_private_endpoint_connections_operations.py @@ -0,0 +1,552 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, 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 .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + resource_name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections") # 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 = _format_url_section(_url, **path_format_arguments) + + # 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_request( + subscription_id: str, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # 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]$'), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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_update_request( + subscription_id: str, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + *, + json: Optional[_models.PrivateEndpointConnection] = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # 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]$'), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}") # 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]$'), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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 PrivateEndpointConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_06_02_preview.ContainerServiceClient`'s + :attr:`private_endpoint_connections` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + + @distributed_trace + def list( + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> _models.PrivateEndpointConnectionListResult: + """Gets a list of private endpoint connections in the specified managed cluster. + + To learn more about private clusters, see: + https://docs.microsoft.com/azure/aks/private-clusters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnectionListResult, or the result of cls(response) + :rtype: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.PrivateEndpointConnectionListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] + + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + 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) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections"} # type: ignore + + + @distributed_trace + def get( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Gets the specified private endpoint connection. + + To learn more about private clusters, see: + https://docs.microsoft.com/azure/aks/private-clusters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection, or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.PrivateEndpointConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + private_endpoint_connection_name=private_endpoint_connection_name, + 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) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + + + @distributed_trace + def update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + parameters: _models.PrivateEndpointConnection, + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection. + + Updates a private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. + :type private_endpoint_connection_name: str + :param parameters: The updated private endpoint connection. + :type parameters: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.PrivateEndpointConnection + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection, or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.PrivateEndpointConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + + _json = self._serialize.body(parameters, 'PrivateEndpointConnection') + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + private_endpoint_connection_name=private_endpoint_connection_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) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Deletes a private endpoint connection. + + Deletes a private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. + :type private_endpoint_connection_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + private_endpoint_connection_name=private_endpoint_connection_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): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + 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) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_private_link_resources_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_private_link_resources_operations.py new file mode 100644 index 000000000000..189d27c10e65 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_private_link_resources_operations.py @@ -0,0 +1,149 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, 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 .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + resource_name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources") # 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 = _format_url_section(_url, **path_format_arguments) + + # 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 PrivateLinkResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_06_02_preview.ContainerServiceClient`'s + :attr:`private_link_resources` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + + @distributed_trace + def list( + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> _models.PrivateLinkResourcesListResult: + """Gets a list of private link resources in the specified managed cluster. + + To learn more about private clusters, see: + https://docs.microsoft.com/azure/aks/private-clusters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResourcesListResult, or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.PrivateLinkResourcesListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourcesListResult] + + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + 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) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateLinkResourcesListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources"} # type: ignore + diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_resolve_private_link_service_id_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_resolve_private_link_service_id_operations.py new file mode 100644 index 000000000000..e4f5b2f7e788 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_resolve_private_link_service_id_operations.py @@ -0,0 +1,163 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, 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 .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_post_request( + subscription_id: str, + resource_group_name: str, + resource_name: str, + *, + json: Optional[_models.PrivateLinkResource] = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId") # 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 = _format_url_section(_url, **path_format_arguments) + + # 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="POST", + url=_url, + params=_params, + headers=_headers, + json=json, + content=content, + **kwargs + ) + +class ResolvePrivateLinkServiceIdOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_06_02_preview.ContainerServiceClient`'s + :attr:`resolve_private_link_service_id` 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 post( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.PrivateLinkResource, + **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link service ID for the specified managed cluster. + + Gets the private link service ID for the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :type resource_name: str + :param parameters: Parameters required in order to resolve a private link service ID. + :type parameters: ~azure.mgmt.containerservice.v2022_06_02_preview.models.PrivateLinkResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource, or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.PrivateLinkResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] + + _json = self._serialize.body(parameters, 'PrivateLinkResource') + + request = build_post_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.post.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateLinkResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + post.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId"} # type: ignore + diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_snapshots_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_snapshots_operations.py new file mode 100644 index 000000000000..3a0ec2d61b4f --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_snapshots_operations.py @@ -0,0 +1,720 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import 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 .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots") # 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 = _format_url_section(_url, **path_format_arguments) + + # 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_request( + subscription_id: str, + resource_group_name: str, + resource_name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{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 = _format_url_section(_url, **path_format_arguments) + + # 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( + subscription_id: str, + resource_group_name: str, + resource_name: str, + *, + json: Optional[_models.Snapshot] = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{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 = _format_url_section(_url, **path_format_arguments) + + # 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, + json=json, + content=content, + **kwargs + ) + + +def build_update_tags_request( + subscription_id: str, + resource_group_name: str, + resource_name: str, + *, + json: Optional[_models.TagsObject] = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{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 = _format_url_section(_url, **path_format_arguments) + + # 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, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + subscription_id: str, + resource_group_name: str, + resource_name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{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 = _format_url_section(_url, **path_format_arguments) + + # 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 SnapshotsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_06_02_preview.ContainerServiceClient`'s + :attr:`snapshots` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + + @distributed_trace + def list( + self, + **kwargs: Any + ) -> Iterable[_models.SnapshotListResult]: + """Gets a list of snapshots in the specified subscription. + + Gets a list of snapshots in the specified subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SnapshotListResult or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_06_02_preview.models.SnapshotListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("SnapshotListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots"} # type: ignore + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> Iterable[_models.SnapshotListResult]: + """Lists snapshots in the specified subscription and resource group. + + Lists snapshots in the specified subscription and resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SnapshotListResult or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_06_02_preview.models.SnapshotListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SnapshotListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + 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) # type: ignore + + else: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("SnapshotListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots"} # type: ignore + + @distributed_trace + def get( + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> _models.Snapshot: + """Gets a snapshot. + + Gets a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot, or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.Snapshot + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + 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) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Snapshot', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore + + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.Snapshot, + **kwargs: Any + ) -> _models.Snapshot: + """Creates or updates a snapshot. + + Creates or updates a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :type resource_name: str + :param parameters: The snapshot to create or update. + :type parameters: ~azure.mgmt.containerservice.v2022_06_02_preview.models.Snapshot + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot, or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.Snapshot + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + + _json = self._serialize.body(parameters, 'Snapshot') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Snapshot', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Snapshot', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore + + + @distributed_trace + def update_tags( + self, + resource_group_name: str, + resource_name: str, + parameters: _models.TagsObject, + **kwargs: Any + ) -> _models.Snapshot: + """Updates tags on a snapshot. + + Updates tags on a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :type resource_name: str + :param parameters: Parameters supplied to the Update snapshot Tags operation. + :type parameters: ~azure.mgmt.containerservice.v2022_06_02_preview.models.TagsObject + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Snapshot, or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.Snapshot + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Snapshot] + + _json = self._serialize.body(parameters, 'TagsObject') + + request = build_update_tags_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update_tags.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Snapshot', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_tags.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore + + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> None: + """Deletes a snapshot. + + Deletes a snapshot. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :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 + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + 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) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}"} # type: ignore + diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_trusted_access_role_bindings_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_trusted_access_role_bindings_operations.py new file mode 100644 index 000000000000..5d954e2a98c2 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_trusted_access_role_bindings_operations.py @@ -0,0 +1,512 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import 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 .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + resource_name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings") # 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 = _format_url_section(_url, **path_format_arguments) + + # 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_request( + subscription_id: str, + resource_group_name: str, + resource_name: str, + trusted_access_role_binding_name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}") # 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]$'), + "trustedAccessRoleBindingName": _SERIALIZER.url("trusted_access_role_binding_name", trusted_access_role_binding_name, 'str', max_length=36, min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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( + subscription_id: str, + resource_group_name: str, + resource_name: str, + trusted_access_role_binding_name: str, + *, + json: Optional[_models.TrustedAccessRoleBinding] = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}") # 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]$'), + "trustedAccessRoleBindingName": _SERIALIZER.url("trusted_access_role_binding_name", trusted_access_role_binding_name, 'str', max_length=36, min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + subscription_id: str, + resource_group_name: str, + resource_name: str, + trusted_access_role_binding_name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}") # 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]$'), + "trustedAccessRoleBindingName": _SERIALIZER.url("trusted_access_role_binding_name", trusted_access_role_binding_name, 'str', max_length=36, min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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 TrustedAccessRoleBindingsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_06_02_preview.ContainerServiceClient`'s + :attr:`trusted_access_role_bindings` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + + @distributed_trace + def list( + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> Iterable[_models.TrustedAccessRoleBindingListResult]: + """List trusted access role bindings. + + List trusted access role bindings. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either TrustedAccessRoleBindingListResult or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_06_02_preview.models.TrustedAccessRoleBindingListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.TrustedAccessRoleBindingListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + 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) # type: ignore + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + api_version=api_version, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("TrustedAccessRoleBindingListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings"} # type: ignore + + @distributed_trace + def get( + self, + resource_group_name: str, + resource_name: str, + trusted_access_role_binding_name: str, + **kwargs: Any + ) -> _models.TrustedAccessRoleBinding: + """Get a trusted access role binding. + + Get a trusted access role binding. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :type resource_name: str + :param trusted_access_role_binding_name: The name of trusted access role binding. + :type trusted_access_role_binding_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TrustedAccessRoleBinding, or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.TrustedAccessRoleBinding + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.TrustedAccessRoleBinding] + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + trusted_access_role_binding_name=trusted_access_role_binding_name, + 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) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TrustedAccessRoleBinding', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}"} # type: ignore + + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + trusted_access_role_binding_name: str, + trusted_access_role_binding: _models.TrustedAccessRoleBinding, + **kwargs: Any + ) -> _models.TrustedAccessRoleBinding: + """Create or update a trusted access role binding. + + Create or update a trusted access role binding. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :type resource_name: str + :param trusted_access_role_binding_name: The name of trusted access role binding. + :type trusted_access_role_binding_name: str + :param trusted_access_role_binding: A trusted access role binding. + :type trusted_access_role_binding: + ~azure.mgmt.containerservice.v2022_06_02_preview.models.TrustedAccessRoleBinding + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TrustedAccessRoleBinding, or the result of cls(response) + :rtype: ~azure.mgmt.containerservice.v2022_06_02_preview.models.TrustedAccessRoleBinding + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.TrustedAccessRoleBinding] + + _json = self._serialize.body(trusted_access_role_binding, 'TrustedAccessRoleBinding') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + trusted_access_role_binding_name=trusted_access_role_binding_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TrustedAccessRoleBinding', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}"} # type: ignore + + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + resource_name: str, + trusted_access_role_binding_name: str, + **kwargs: Any + ) -> None: + """Delete a trusted access role binding. + + Delete a trusted access role binding. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the managed cluster resource. + :type resource_name: str + :param trusted_access_role_binding_name: The name of trusted access role binding. + :type trusted_access_role_binding_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 + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + trusted_access_role_binding_name=trusted_access_role_binding_name, + 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) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}"} # type: ignore + diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_trusted_access_roles_operations.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_trusted_access_roles_operations.py new file mode 100644 index 000000000000..982e04489526 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/operations/_trusted_access_roles_operations.py @@ -0,0 +1,169 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import 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 .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + location: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/trustedAccessRoles") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "location": _SERIALIZER.url("location", location, 'str', min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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 TrustedAccessRolesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerservice.v2022_06_02_preview.ContainerServiceClient`'s + :attr:`trusted_access_roles` 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, + location: str, + **kwargs: Any + ) -> Iterable[_models.TrustedAccessRoleListResult]: + """List supported trusted access roles. + + List supported trusted access roles. + + :param location: The name of Azure region. + :type location: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either TrustedAccessRoleListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservice.v2022_06_02_preview.models.TrustedAccessRoleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-06-02-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.TrustedAccessRoleListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + location=location, + 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) # type: ignore + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + location=location, + api_version=api_version, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("TrustedAccessRoleListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/trustedAccessRoles"} # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/py.typed b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_06_02_preview/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file